⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 一个炸弹人游戏的源代码(win32 application)
💻 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;
}

⌨️ 快捷键说明

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