更名FINDBOOM为MineSweepe
正式初步完成了MineSweepe
This commit is contained in:
@ -1,14 +0,0 @@
|
||||
#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
|
||||
@ -1,17 +0,0 @@
|
||||
#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
|
||||
|
||||
|
||||
@ -9,7 +9,5 @@ typedef struct Data {
|
||||
|
||||
void initData(Data *data, int x, int y ,int boom);
|
||||
void getData(Data *data, int x, int y);
|
||||
|
||||
void showData(Data *data);
|
||||
|
||||
int checkData(Data *data);
|
||||
#endif //DATA_H
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
#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
|
||||
@ -18,12 +18,14 @@ typedef struct Color {
|
||||
int r,g,b,a;
|
||||
} Color;
|
||||
|
||||
#define RED (Color){150,40,40,255}
|
||||
#define GREEN (Color){40,150,40,255}
|
||||
#define BLUE (Color){40,40,150,255}
|
||||
#define SQUARE (Color){0xC0,0XC0,0XC0,255}
|
||||
#define BACKGROUND (Color){0x24,0x49,0X5E,255}
|
||||
#define BUTTON (Color){0X2c,0X3E,0X50,255}
|
||||
#define FLOW (Color){0xD9,0xD9,0xD9}
|
||||
|
||||
void initGame(const char* name, int width, int height);
|
||||
void gameLoop();
|
||||
void setColor(Color color);
|
||||
void windowClose();
|
||||
|
||||
#endif //RUNNING_H
|
||||
|
||||
22
include/over.h
Normal file
22
include/over.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef WIN_H
|
||||
#define WIN_H
|
||||
#include "game.h"
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
typedef struct Font {
|
||||
TTF_Font * fontKind;
|
||||
SDL_Texture* texture;
|
||||
int w, h;
|
||||
} Font;
|
||||
|
||||
typedef struct Button {
|
||||
int x,y,w,h;
|
||||
} Button;
|
||||
typedef struct Over {
|
||||
int nameH,buttonH,w;
|
||||
Button botton;
|
||||
} Over;
|
||||
|
||||
void initOver(Game * game, Over * over);
|
||||
void drawOver(int fontSizeName, int fontSizeButton,Font * font, const char * nameText, Color buttonColor, SDL_Renderer * renderer , Over* over);
|
||||
#endif //WIN_H
|
||||
@ -1,25 +0,0 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user