www.pudn.com > bmbrsrc > Main.c


/********************************************************************* 
** Bomberman-clone                                                  ** 
**   by Steven Don                                                  ** 
*********************************************************************/ 
 
#include "stdio.h" 
#include "windows.h" 
#include "mmsystem.h" 
#include "time.h" 
#include "resource.h" 
 
//Handles to Windows stuff 
HINSTANCE       InstanceHandle; 
HWND            WindowHandle; 
MSG             Message; 
 
//Windows graphics stuff 
BITMAPINFO      BitmapInfo; 
HBITMAP         MainBitmap, 
                BackBitmap; 
HDC             MainDC, 
                BackDC, 
                ScreenDC; 
LPVOID          MainBitmapData, 
                BackBitmapData, 
                TargetData; 
 
//Keyboard input 
char            InBuffer [50]; 
volatile int    InPointer = 0, OutPointer = 0; 
 
//Global indicator 
int         Done; 
 
#include "GraphicStuff.c" 
#include "Game.c" 
#include "WindowStuff.c" 
 
#define DEBK VK_RETURN 
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) 
{ 
  //Store instance 
  InstanceHandle = hInstance; 
 
  //Initialize window and graphic display 
  InitWindow (); 
  InitGraph (); 
 
  //Initialize game 
  InitGame (); 
 
  do { 
    //Draw one game frame 
    GameFrame (); 
 
    //Copy the buffer to the screen 
    BitBlt (ScreenDC, 0, 0, 272, 272, MainDC, 0, 0, SRCCOPY); 
 
    //Process Windows messages 
    while (PeekMessage(&Message, WindowHandle, 0, 0, PM_REMOVE)) { 
      TranslateMessage (&Message); 
      DispatchMessage (&Message); 
    } 
  } while (!Done); 
 
  //Shut down the game 
  CloseGame (); 
 
  //Restore the graphic display 
  CloseGraph (); 
 
  //Remove window 
  DestroyWindow (WindowHandle); 
 
  return Message.wParam; 
}