forked from KolibriOS/kolibrios
Heliothryx game update
- added performance check with auto-closing on low performance git-svn-id: svn://kolibrios.org@5261 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
93fccad3ca
commit
5dd0204401
@ -24,6 +24,10 @@ int draw_dt = 1;
|
|||||||
int area_width = 160;
|
int area_width = 160;
|
||||||
int area_height = 160;
|
int area_height = 160;
|
||||||
|
|
||||||
|
int low_performance_counter = 0;
|
||||||
|
|
||||||
|
int logic_halted = 0;
|
||||||
|
|
||||||
int w_plus = 0;
|
int w_plus = 0;
|
||||||
|
|
||||||
|
|
||||||
@ -76,10 +80,17 @@ void wnd_draw()
|
|||||||
tmp[5] = '0' + ( (fps/10) % 10 );
|
tmp[5] = '0' + ( (fps/10) % 10 );
|
||||||
tmp[6] = '0' + ( (fps) % 10 );
|
tmp[6] = '0' + ( (fps) % 10 );
|
||||||
|
|
||||||
kol_wnd_define(100, 100, window_width, window_height, 0x74ddddff, 0x34ddddff, "HELLO WINDOW");
|
|
||||||
kol_wnd_caption(tmp);
|
|
||||||
|
|
||||||
GameProcess();
|
if (!logic_halted) {
|
||||||
|
kol_wnd_define(100, 100, window_width, window_height, 0x74ddddff, 0x34ddddff, "Heliothryx");
|
||||||
|
kol_wnd_caption(tmp);
|
||||||
|
GameProcess();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
kol_wnd_define(100, 100, window_width, window_height, 0x34ddddff, 0x34ddddff, "Heliothryx");
|
||||||
|
//kol_paint_bar(0, 0, window_width, window_height, 0xffffffff);
|
||||||
|
kol_paint_string(20, 20, "Performance is too low. Halted. ", 0x902222ff);
|
||||||
|
};
|
||||||
|
|
||||||
kol_paint_end();
|
kol_paint_end();
|
||||||
|
|
||||||
@ -172,11 +183,15 @@ void kol_main()
|
|||||||
key_up = key & 0x80;
|
key_up = key & 0x80;
|
||||||
key = key & 0x7F;
|
key = key & 0x7F;
|
||||||
|
|
||||||
if (key_up) {
|
if (!logic_halted) {
|
||||||
GameKeyUp(key, 1);
|
|
||||||
}
|
if (key_up) {
|
||||||
else {
|
GameKeyUp(key, 1);
|
||||||
GameKeyDown(key);
|
}
|
||||||
|
else {
|
||||||
|
GameKeyDown(key);
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -233,6 +248,24 @@ void kol_main()
|
|||||||
};
|
};
|
||||||
kol_sleep(wait_time);
|
kol_sleep(wait_time);
|
||||||
|
|
||||||
|
if (draw_dt > 10) {
|
||||||
|
low_performance_counter++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
low_performance_counter--;
|
||||||
|
if (low_performance_counter < 0) {
|
||||||
|
low_performance_counter = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (low_performance_counter > 6) {
|
||||||
|
logic_halted = 1;
|
||||||
|
window_width = 280;
|
||||||
|
window_height = 80;
|
||||||
|
kol_wnd_caption("Heliothryx");
|
||||||
|
kol_wnd_resize(window_width, window_height);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user