• R/O
  • SSH
  • HTTPS

hamigaki: 提交


Commit MetaInfo

修訂1632 (tree)
時間2008-05-03 23:58:25
作者hamigaki

Log Message

removed main_window::active()
glColor4b() -> glColor4f()

Change Summary

差異

--- sandbox/trunk/tools/gtk_action_game/main_window_impl.cpp (revision 1631)
+++ sandbox/trunk/tools/gtk_action_game/main_window_impl.cpp (revision 1632)
@@ -566,7 +566,7 @@
566566 explicit impl(GtkWidget* widget, const game_project& proj)
567567 : widget_(widget), project_(proj)
568568 , input_(widget_), system_(widget_), rc_(widget_), textures_(rc_)
569- , active_(false), last_time_(get_tick_count()), frames_(0)
569+ , last_time_(get_tick_count()), frames_(0)
570570 #if defined(HAMIGAKI_DISPLAY_FPS)
571571 , last_fps_time_(0), fps_count_(0)
572572 #endif
@@ -573,14 +573,11 @@
573573 {
574574 ::gtk_window_set_title(GTK_WINDOW(widget_), "ActionGame");
575575
576- ::glViewport(0, 0, proj.screen_width, proj.screen_height);
576+ rc_.select();
577577
578- ::glMatrixMode(GL_PROJECTION);
579- ::glPushMatrix();
580- ::glLoadIdentity();
581578 ::glOrtho(
582- 0.0, static_cast<double>(proj.screen_width),
583- static_cast<double>(proj.screen_height), 0.0,
579+ 0.0, static_cast<double>(project_.screen_width),
580+ static_cast<double>(project_.screen_height), 0.0,
584581 0.0, 1.0
585582 );
586583
@@ -608,7 +605,7 @@
608605
609606 bool process_input()
610607 {
611- if (active_)
608+ if (::gtk_window_is_active(GTK_WINDOW(widget_)))
612609 system_.command = input_();
613610 else
614611 system_.command = input_command();
@@ -650,8 +647,11 @@
650647 {
651648 system_.characters.sort(character_ptr_z_greator());
652649
650+ rc_.select();
651+
653652 set_clear_color(project_.bg_color);
654- ::glClear(GL_COLOR_BUFFER_BIT);
653+ ::glClearDepth(1.0f);
654+ ::glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
655655
656656 ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
657657 ::glEnable(GL_BLEND);
@@ -1090,8 +1090,3 @@
10901090 {
10911091 pimpl_->render();
10921092 }
1093-
1094-void main_window::active(bool val)
1095-{
1096- pimpl_->active(val);
1097-}
--- sandbox/trunk/tools/gtk_action_game/sprite.hpp (revision 1631)
+++ sandbox/trunk/tools/gtk_action_game/sprite.hpp (revision 1632)
@@ -30,11 +30,11 @@
3030 x -= 0.5f;
3131 y -= 0.5f;
3232
33- ::glColor4b(
34- static_cast<unsigned char>((color >> 16) & 0xFF),
35- static_cast<unsigned char>((color >> 8) & 0xFF),
36- static_cast<unsigned char>((color ) & 0xFF),
37- static_cast<unsigned char>((color >> 24) & 0xFF)
33+ ::glColor4f(
34+ static_cast<float>((color >> 16) & 0xFF) / 255.0f,
35+ static_cast<float>((color >> 8) & 0xFF) / 255.0f,
36+ static_cast<float>((color ) & 0xFF) / 255.0f,
37+ static_cast<float>((color >> 24) & 0xFF) / 255.0f
3838 );
3939
4040 texture.bind();
@@ -71,11 +71,11 @@
7171 x -= 0.5f;
7272 y -= 0.5f;
7373
74- ::glColor4b(
75- static_cast<unsigned char>((color >> 16) & 0xFF),
76- static_cast<unsigned char>((color >> 8) & 0xFF),
77- static_cast<unsigned char>((color ) & 0xFF),
78- static_cast<unsigned char>((color >> 24) & 0xFF)
74+ ::glColor4f(
75+ static_cast<float>((color >> 16) & 0xFF) / 255.0f,
76+ static_cast<float>((color >> 8) & 0xFF) / 255.0f,
77+ static_cast<float>((color ) & 0xFF) / 255.0f,
78+ static_cast<float>((color >> 24) & 0xFF) / 255.0f
7979 );
8080
8181 texture.bind();
--- sandbox/trunk/tools/gtk_action_game/main_window_impl.hpp (revision 1631)
+++ sandbox/trunk/tools/gtk_action_game/main_window_impl.hpp (revision 1632)
@@ -21,7 +21,6 @@
2121 explicit main_window(GtkWidget* widget, const game_project& proj);
2222 bool process_input();
2323 void render();
24- void active(bool val);
2524
2625 private:
2726 class impl;
--- sandbox/trunk/tools/gtk_action_game/draw.hpp (revision 1631)
+++ sandbox/trunk/tools/gtk_action_game/draw.hpp (revision 1632)
@@ -22,11 +22,11 @@
2222 float x, float y, float z,
2323 float width, float height, unsigned long color)
2424 {
25- ::glColor4b(
26- static_cast<unsigned char>((color >> 16) & 0xFF),
27- static_cast<unsigned char>((color >> 8) & 0xFF),
28- static_cast<unsigned char>((color ) & 0xFF),
29- static_cast<unsigned char>((color >> 24) & 0xFF)
25+ ::glColor4f(
26+ static_cast<float>((color >> 16) & 0xFF) / 255.0f,
27+ static_cast<float>((color >> 8) & 0xFF) / 255.0f,
28+ static_cast<float>((color ) & 0xFF) / 255.0f,
29+ static_cast<float>((color >> 24) & 0xFF) / 255.0f
3030 );
3131
3232 ::glBegin(GL_TRIANGLE_STRIP);
Show on old repository browser