comparison EXCLUDE/GLIMM/src/App.cpp @ 4741:bb189d44af16

Added GLIMM (using IMM instead of TSF) Uses small bit of TSF to fully disable cicero (TSF for non-TSF enabled apps)
author dewyatt
date Wed, 30 Jun 2010 17:29:20 -0400
parents
children f25518de3ee5
comparison
equal deleted inserted replaced
4740:abf528de6d2e 4741:bb189d44af16
1 #include "App.hpp"
2 #include <GL/gl.h>
3 #include <GL/glu.h>
4
5 #pragma comment(lib, "glu32.lib")
6
7 GLfloat Rotation = 0.0f;
8
9 App::App() : my_Done(false)
10 {
11
12 }
13
14 App::~App()
15 {
16 Finalize();
17 }
18
19 void App::Initialize()
20 {
21 Finalize();
22
23 my_Window.Initialize(L"GLTSF", Video_Mode(Width, Height, Bits_Per_Pixel), Fullscreen);
24 my_Window.Set_Listener(this);
25 my_Window.Show();
26 my_Window.Hide_Cursor();
27 }
28
29 void App::Finalize()
30 {
31 my_Window.Finalize();
32 }
33
34 void App::Run()
35 {
36 Initialize();
37 while (!my_Done)
38 {
39 my_Window.Handle_Events();
40
41 Update();
42 Draw();
43 my_Window.Display();
44 }
45 }
46
47 void App::On_Close()
48 {
49 my_Done = true;
50 my_Window.Hide();
51 }
52
53 void App::On_Key_Down(int Key)
54 {
55 switch (Key)
56 {
57 case VK_ESCAPE:
58 On_Close();
59 break;
60 }
61 }
62
63 void App::On_Key_Up(int Key)
64 {
65
66 }
67
68 void App::On_Char(unsigned int Char)
69 {
70 printf("Char: U+%04X\n", Char);
71 }
72
73 void App::On_Resized(unsigned int Width, unsigned int Height)
74 {
75 glViewport(0, 0, Width, Height);
76 glMatrixMode(GL_PROJECTION);
77 glLoadIdentity();
78
79 glMatrixMode(GL_MODELVIEW);
80 glLoadIdentity();
81 }
82
83 void App::Update()
84 {
85 Rotation += 0.2f;
86 }
87
88 void App::Draw()
89 {
90 glClear(GL_COLOR_BUFFER_BIT);
91
92 glLoadIdentity();
93 glRotatef(Rotation, 0.0f, 0.0f, -1.0f);
94
95 glBegin(GL_TRIANGLES);
96 glColor3f(0.7f, 0.0f, 0.0f);
97 glVertex3f(0.0f, 0.5f, 0.0f);
98 glColor3f(0.0f, 0.7f, 0.0f);
99 glVertex3f(-0.5f, -0.5f, 0.0f);
100 glColor3f(0.0f, 0.0f, 0.7f);
101 glVertex3f(0.5f, -0.5f, 0.0f);
102 glEnd();
103 }