Ejemplo n.º 1
0
HelloWindow::~HelloWindow()
{
	KillGame(); 
	KillTitle(); 

	delete snd;
}
Ejemplo n.º 2
0
Archivo: Main.cpp Proyecto: m1h4/Xetrix
INT WINAPI WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpCmdLine*/,INT /*nCmdShow*/)
{
	SetUnhandledExceptionFilter(Debug::DumpException);

	srand(GetTickCount());

	InitCommonControls();

	if(!InitializeWindow(800,600))
		return 0;

	MSG	msg = {0};

	while(msg.message != WM_QUIT)
	{
		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		
		if(!Update())
			PostQuitMessage(0);
		else if(!Draw())
			PostQuitMessage(0);
		else if(!SwapBuffers(mainDC))
			TRACE(TEXT("Failed to swap buffers.\n"));
	}

	KillGame();
	KillTimer();
	KillWindow();

	return msg.wParam;
}
Ejemplo n.º 3
0
void HelloWindow::MessageReceived(BMessage *message)
{ 
	char filename[512];
	//printf("recieved:%d\n",message);
	switch ( message->what )
	{			
		case	B_SIMPLE_DATA	:	{
									entry_ref ref;
									if( message->FindRef("refs", &ref) == B_OK )
										{
										strcpy (filename,"DynaMate - ");
										strcpy ((char *)filename+11,ref.name);
										SetTitle(filename);

										level[256]=255;
										load256(&ref,257,level);
										KillGame();
										KillTitle();
										LaunchGame();
										gameView->totalmoves=0; // added 981018
										}
									}
									break;
		case	LEVELCOMPLETE	:	{
									KillGame();
									uint16 temp=level[256]; //gamla rekordet
									if (totalmoves<level[256]){
										level[256]=totalmoves;
										saverec(level);
										level[256]=temp;
										}
									LaunchTitle();	
									}
									break;

   		case	LEVELABANDONED	:	{
									KillGame();
									LaunchTitle();
									}
									break;
 								
		default	:	BWindow::MessageReceived(message);
								break;
	}
}
Ejemplo n.º 4
0
void HelloWindow::Zoom(BPoint punkt, float w, float h)
{
	if (SIZE==24){
		SIZE=16;
		ResizeTo(255,255);
	}else{
		ResizeTo(24*16-1,24*16-1);
		SIZE=24;
	}	

	if (gameView){
		KillGame();
		LaunchGame();		
	}else{
		KillTitle();
		LaunchTitle();
	}
}
Ejemplo n.º 5
0
int main()
{
	sf::Clock clock;

	while (true)
	{
		if (!gameIsRunning)
		{
			StartGame();
		}

		if (!game->Update((float)clock.restart().asSeconds()))
		{
			KillGame();
		}
	}

	return 0;
}