#pragma once #include "GameManager.h" #ifndef __MWERKS__ #include "MenuManager.c" #endif static pascal void Timer(EventLoopTimerRef r, void * d) { #pragma unused(r) VGame * g; g = (VGame *)d; glClear(GL_DEPTH_BUFFER_BIT); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glColor4f(0.0, 0.0, 0.0, 0.008); glBegin(GL_QUADS); /* Top left */ glVertex3f(-2, 2, -4); /* Top right */ glVertex3f(2, 2, -4); /* Bottom right */ glVertex3f(2, -2, -4); /* Bottom left */ glVertex3f(-2, -2, -4); glEnd(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); g->Rot += 0.01; glPushMatrix(); glColor4f(0.5, 0.2, 0.0, 1.0); glRotatef(g->Rot, 0, 0, 1); glBegin(GL_QUADS); /* Top left */ glVertex3f(-0.5, 0.5, -2); /* Top right */ glVertex3f(0.5, 0.5, -2); /* Bottom right */ glVertex3f(0.5, -0.5, -2); /* Bottom left */ glVertex3f(-0.5, -0.5, -2); glEnd(); glPopMatrix(); aglSwapBuffers(g->w.TheContext); } void InitGame(VGame * g) { InstallEventLoopTimer(GetMainEventLoop(), 0, (kEventDurationSecond / 100000), NewEventLoopTimerUPP(Timer), g, &g->timerRef); InitMenu(&g->m); InitWindow(&g->w); g->w.quitOnClose = 1; g->Rot = 0; glClear(GL_COLOR_BUFFER_BIT); } void CleanUpGame(VGame * g) { RemoveEventLoopTimer(g->timerRef); CleanUpWindow(&g->w); CleanUpMenu(&g->m); }