diff --git a/src/tests/kits/game/ParticlesII/particlesII.cpp b/src/tests/kits/game/ParticlesII/particlesII.cpp index 7cec4618c7..317c6258e8 100644 --- a/src/tests/kits/game/ParticlesII/particlesII.cpp +++ b/src/tests/kits/game/ParticlesII/particlesII.cpp @@ -95,7 +95,7 @@ void NApplication::ReadyToRun() NWindowScreen *ws = new NWindowScreen(&ret); PRINT(("WindowScreen ctor returned. ret = %s\n", strerror(ret))); // exit if constructing the WindowScreen failed. - if((ws == NULL) || (ret < B_OK) || !ws->CanControlFrameBuffer()) + if((ws == NULL) || (ret < B_OK)) { //printf("the window screen was NULL, or there was an error\n"); PostMessage(B_QUIT_REQUESTED); @@ -114,7 +114,7 @@ bool NApplication::QuitRequested() } NWindowScreen::NWindowScreen(status_t *ret) - : BWindowScreen("Example", B_8_BIT_640x480, ret), width(640), height(480), COLORS(256) + : BWindowScreen("Example", B_8_BIT_640x480, ret), width(639), height(479), COLORS(256) { PRINT(("WindowScreen ctor.\n")); thread_is_locked = true; @@ -148,7 +148,9 @@ NWindowScreen::NWindowScreen(status_t *ret) set_frame_rate(30.); } -void NWindowScreen::ScreenConnected(bool connected) + +void +NWindowScreen::ScreenConnected(bool connected) { PRINT(("ScreenConnected()\n")); fflush(stdout); @@ -156,7 +158,7 @@ void NWindowScreen::ScreenConnected(bool connected) { if(SetSpace(B_8_BIT_640x480) < B_OK) { - SetFrameBuffer(640,480); + //SetFrameBuffer(640, 480); PRINT(("SetSpace() failed\n")); // properly set the framebuffer. exit if an error occurs. be_app->PostMessage(B_QUIT_REQUESTED); @@ -268,19 +270,23 @@ void NWindowScreen::ScreenConnected(bool connected) } } -long NWindowScreen::Entry(void* p) { + +long +NWindowScreen::Entry(void* p) +{ return ((NWindowScreen*)p)->MyCode(); } -long NWindowScreen::MyCode() + +long +NWindowScreen::MyCode() { bigtime_t trgt = system_time() + frame_pause; srandom(system_time()); // beforehand stuff particle_count = 1024*2; particle_list = (particle *)malloc(sizeof(particle)*particle_count); - for (uint32 i=0; i>1)+(random()%(rand_max>>1)))/rand_max)*3.333; // magic number particle_list[i].gravity = -(((double)((rand_max>>1)+(random()%(rand_max>>1)))/rand_max))*0.599; // more magic @@ -297,14 +303,12 @@ long NWindowScreen::MyCode() // the loop o' fun - while(!(((NApplication*)be_app)->is_quitting)) - { + while (!(((NApplication*)be_app)->is_quitting)) { // try to sync with the vertical retrace - if(BScreen(this).WaitForRetrace() != B_OK) - { + if (BScreen(this).WaitForRetrace() != B_OK) { // snoze for a bit so that other threads can be happy. // We are realtime priority you know - if(system_time() < trgt) + if (system_time() < trgt) snooze(trgt - system_time()); trgt = system_time() + frame_pause; } @@ -319,7 +323,6 @@ long NWindowScreen::MyCode() // eye candy VII - particles! - my own cookin - particle *s; int32 x, y, cx,cy; set_frame_rate(60.); // woo. ntsc // calculate the center @@ -332,9 +335,8 @@ long NWindowScreen::MyCode() // draw_line(i,0,i,height, i); PRINT(("Starting particle drawing loop\n")); - s = particle_list; - for (uint32 i=0; i