Subversion Repositories Kolibri OS

Rev

Rev 1789 | Rev 7952 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1789 Rev 5098
Line 14... Line 14...
14
#include "ProcessTab.h"
14
#include "ProcessTab.h"
Line 15... Line 15...
15
 
15
 
16
 
16
 
17
int Fps (long x, long y);
17
int Fps (long x, long y);
18
extern "C"{
18
extern "C"{
Line 19... Line 19...
19
void app_main(void);
19
int main(void);
20
}
20
}
21
 
21
 
22
struct {
22
static struct {
Line 23... Line 23...
23
	   int x,y;
23
	   int x,y;
Line 24... Line 24...
24
	   int dx,dy;
24
	   int dx,dy;
25
	   } win;
25
	   } win;
Line 26... Line 26...
26
 
26
 
27
#define CUBE_STEP 0.1
27
#define CUBE_STEP 0.1
28
 
28
 
29
#define KEY_ESC       1
29
#define KEY_ESC       1
30
#define KEY_F     	 33
30
#define KEY_F     	 33
31
 
31
 
32
char *title1 = "TinyGL in KolibriOS";
32
static char title1[] = "TinyGL in KolibriOS";
33
char *title2 = "F full screen";
33
static char title2[] = "F full screen";
34
char *title3 = "ESC - exit";
34
static char title3[] = "ESC - exit";
35
char *fps    = "FPS:";
35
static char fps[]    = "FPS:";
36
 
36
 
Line 37... Line 37...
37
unsigned char FullScreen = 0;
37
static unsigned char FullScreen = 0;
38
unsigned char skin = 3;
38
static unsigned char skin = 3;
39
 
39
 
40
float angle;
40
static float angle;
Line 41... Line 41...
41
process_table_entry_* pri;
41
static process_table_entry_* pri;
Line 128... Line 128...
128
   }
128
   }
Line 129... Line 129...
129
 
129
 
130
  glEnd();
130
  glEnd();
Line 131... Line 131...
131
}
131
}
132
 
132
 
133
void DrawGL() 
133
static void DrawGL() 
134
{
134
{
Line 135... Line 135...
135
  glLoadIdentity();                                                                               // óñòàíàâëèâàåì åäåíè÷íóþ ìàòðèöó
135
  glLoadIdentity();                                                                               // óñòàíàâëèâàåì åäåíè÷íóþ ìàòðèöó
Line 143... Line 143...
143
  draw_cube();
143
  draw_cube();
Line 144... Line 144...
144
 
144
 
145
  kosglSwapBuffers(); 
145
  kosglSwapBuffers(); 
Line 146... Line 146...
146
 } 
146
 } 
147
 
147
 
148
void reshape()
148
static void reshape()
149
{
149
{
150
   __menuet__get_process_table((process_table_entry*)pri,-1);
150
   __menuet__get_process_table((process_table_entry*)pri,-1);
151
   glViewport(0, 0, pri->winx_size, pri->winy_size-20);
151
   glViewport(0, 0, pri->winx_size, pri->winy_size-20);
152
   glMatrixMode(GL_PROJECTION);
152
   glMatrixMode(GL_PROJECTION);
153
   glLoadIdentity();
153
   glLoadIdentity();
154
   gluPerspective(45.0, (GLfloat)pri->winx_size/pri->winy_size, 1.0, 300.0);
154
   gluPerspective(45.0, (GLfloat)pri->winx_size/pri->winy_size, 1.0, 300.0);
155
   glMatrixMode(GL_MODELVIEW);
155
   glMatrixMode(GL_MODELVIEW);
Line 156... Line 156...
156
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );     
156
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );     
157
} 
157
} 
158
 
158
 
159
void disabletgl()
159
static void disabletgl()
160
{
160
{
Line 161... Line 161...
161
	kosglDestroyContext(cgl); 
161
	kosglDestroyContext(cgl); 
162
	delete pri;
162
	delete pri;
163
}
163
}
164
 
164
 
165
void Title()
165
static void Title()
166
{
166
{
167
     __menuet__write_text(300,8,0x10ffffff,fps,strlen(fps));
167
     __menuet__write_text(300,8,0x10ffffff,fps,strlen(fps));
Line 168... Line 168...
168
     __menuet__write_text(8,8,0x10ffffff,title1,strlen(title1));
168
     __menuet__write_text(8,8,0x10ffffff,title1,strlen(title1));
169
	 __menuet__write_text(180,8,0x00ffffff,title2,strlen(title2));
169
	 __menuet__write_text(180,8,0x00ffffff,title2,strlen(title2));
170
     __menuet__write_text(600,8,0x00ffffff,title3,strlen(title3));
170
     __menuet__write_text(600,8,0x00ffffff,title3,strlen(title3));
171
}
171
}
172
 
172
 
173
void draw_window(void)
173
static void draw_window(void)
Line 180... Line 180...
180
    __menuet__window_redraw(2);
180
    __menuet__window_redraw(2);
181
    // display string
181
    // display string
182
    Title();
182
    Title();
183
}
183
}
Line 184... Line 184...
184
 
184
 
185
void app_main(void)          
185
int main(void)
Line 186... Line 186...
186
{
186
{
187
	 
187
	 
188
  win.x = 100;
188
  win.x = 100;
Line 239... Line 239...
239
									 FullScreen = 0;
239
									 FullScreen = 0;
240
									};
240
									};
241
						  			break;
241
						  			break;
Line 242... Line 242...
242
		          
242
		          
243
                           case KEY_ESC: disabletgl();
243
                           case KEY_ESC: disabletgl();
244
						  				 return;}
244
						  				 return 0;}
Line 245... Line 245...
245
						  				 break;
245
						  				 break;
246
						  			
246
						  			
247
			  	  case 3: disabletgl();
247
			  	  case 3: disabletgl();
248
						  return;
248
						  return 0;
249
		      }
249
		      }