/programs/demos/cubeline/trunk/ProcessTab.h |
---|
1,24 → 1,26 |
#pragma pack(push, 1) |
struct process_table_entry_ |
{ |
__u32 cpu_usage __attribute__((packed)); |
__u16 pos_in_windowing_stack __attribute__((packed)); |
__u16 win_stack_val_at_ecx __attribute__((packed)); |
__u16 rez1 __attribute__((packed)); |
char name[11] __attribute__((packed)); |
__u8 rez2 __attribute__((packed)); |
__u32 memstart __attribute__((packed)); |
__u32 memused __attribute__((packed)); |
__u32 pid __attribute__((packed)); |
__u32 winx_start,winy_start __attribute__((packed)); |
__u32 winx_size,winy_size __attribute__((packed)); |
__u8 slot __attribute__((packed)); |
__u8 rez3 __attribute__((packed)); |
__u32 clarx_start,clary_start __attribute__((packed)); |
__u32 clarx_size,clary_size __attribute__((packed)); |
__u8 win_condition __attribute__((packed)); |
__u8 buf[955] __attribute__((packed)); |
} __attribute__((packed)); |
__u32 cpu_usage; |
__u16 pos_in_windowing_stack; |
__u16 win_stack_val_at_ecx; |
__u16 rez1; |
char name[11]; |
__u8 rez2; |
__u32 memstart; |
__u32 memused; |
__u32 pid; |
__u32 winx_start,winy_start; |
__u32 winx_size,winy_size; |
__u8 slot; |
__u8 rez3; |
__u32 clarx_start,clary_start; |
__u32 clarx_size,clary_size; |
__u8 win_condition; |
__u8 buf[955]; |
}; |
#pragma pack(pop) |
#define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\ |
(RR<<16)|(GG<<8)|BB |
/programs/demos/cubeline/trunk/Tupfile.lua |
---|
0,0 → 1,7 |
if tup.getconfig("NO_GCC") ~= "" then return end |
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") |
tup.include(HELPERDIR .. "/use_gcc.lua") |
tup.include(HELPERDIR .. "/use_menuetlibc.lua") |
tup.include(HELPERDIR .. "/use_tinygl.lua") |
compile_gcc{"main.cpp", "fps.cpp"} |
link_gcc("cubeline") |
/programs/demos/cubeline/trunk/main.cpp |
---|
16,10 → 16,10 |
int Fps (long x, long y); |
extern "C"{ |
void app_main(void); |
int main(void); |
} |
struct { |
static struct { |
int x,y; |
int dx,dy; |
} win; |
29,19 → 29,19 |
#define KEY_ESC 1 |
#define KEY_F 33 |
char *title1 = "TinyGL in KolibriOS"; |
char *title2 = "F full screen"; |
char *title3 = "ESC - exit"; |
char *fps = "FPS:"; |
static char title1[] = "TinyGL in KolibriOS"; |
static char title2[] = "F full screen"; |
static char title3[] = "ESC - exit"; |
static char fps[] = "FPS:"; |
unsigned char FullScreen = 0; |
unsigned char skin = 3; |
static unsigned char FullScreen = 0; |
static unsigned char skin = 3; |
float angle; |
process_table_entry_* pri; |
KOSGLContext cgl; |
static float angle; |
static process_table_entry_* pri; |
static KOSGLContext cgl; |
void draw_cube() |
static void draw_cube() |
{ |
float x,y,z; |
glBegin(GL_LINES); |
130,7 → 130,7 |
glEnd(); |
} |
void DrawGL() |
static void DrawGL() |
{ |
glLoadIdentity(); // óñòàíàâëèâàåì åäåíè÷íóþ ìàòðèöó |
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
145,7 → 145,7 |
kosglSwapBuffers(); |
} |
void reshape() |
static void reshape() |
{ |
__menuet__get_process_table((process_table_entry*)pri,-1); |
glViewport(0, 0, pri->winx_size, pri->winy_size-20); |
156,13 → 156,13 |
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); |
} |
void disabletgl() |
static void disabletgl() |
{ |
kosglDestroyContext(cgl); |
delete pri; |
} |
void Title() |
static void Title() |
{ |
__menuet__write_text(300,8,0x10ffffff,fps,strlen(fps)); |
__menuet__write_text(8,8,0x10ffffff,title1,strlen(title1)); |
170,7 → 170,7 |
__menuet__write_text(600,8,0x00ffffff,title3,strlen(title3)); |
} |
void draw_window(void) |
static void draw_window(void) |
{ |
// start redraw |
__menuet__window_redraw(1); |
182,7 → 182,7 |
Title(); |
} |
void app_main(void) |
int main(void) |
{ |
win.x = 100; |
241,11 → 241,11 |
break; |
case KEY_ESC: disabletgl(); |
return;} |
return 0;} |
break; |
case 3: disabletgl(); |
return; |
return 0; |
} |
}while(1); |
} |