初具模型的扫雷

This commit is contained in:
wlx
2025-07-16 18:48:06 +08:00
commit 68eebdd09f
544 changed files with 242337 additions and 0 deletions

14
include/Global.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef GLOBAL_H
#define GLOBAL_H
#include "def.h"
#include "context.h"
#include "window.h"
typedef struct Global {
Context context;
Window window;
} Global;
extern Global global;
#endif //GLOBAL_H

17
include/context.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef INIT_H
#define INIT_H
#include "def.h"
#include <SDL.h>
typedef struct Context {
int map[ROW][COL];
int mapcopy[ROW][COL];
SDL_Texture * imgs[10];
} Context;
void contextInit();
void imgInit();
#endif //INIT_H

24
include/def.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef DEF_H
#define DEF_Hs
// 行列数
#define ROW 10
#define COL 10
// 地雷个数
#define BOOM 15
// 窗口大小
#define WinWidth 400
#define WinHeight 400
// 矩形大小
#define rectWidth 40
#define rectHeight 40
// 颜色
#define OVER (Color){0X4E,0X4E,0X4E,255}
#define BACKGROUND (Color){0XE1,0XE2,0XE3,0XFF}
#define FLOW (Color){175,175,175,0}
#endif //DEF_H

25
include/window.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef WINDOW_H
#define WINDOW_H
#include <SDL_events.h>
#include <SDL_render.h>
// 颜色
typedef struct Color {
int r;
int g;
int b;
int a;
} Color;
// 窗口
typedef struct Window{
SDL_Window *Window;
SDL_Renderer *Renderer;
SDL_Event Event;
} Window;
void windowInit();
void windowLoop();
void windowShutdown();
#endif //WINDOW_H