main.c

来自「一个炸弹人游戏的源代码(win32 application)」· C语言 代码 · 共 77 行

C
77
字号
/*********************************************************************
** 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;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?