c++ raylib.h 扫雷
随便用 raylib.h 做了个扫雷
软件是小熊猫c++1.4
编译器是 MinGW GCC 11.2.0 64-bit Release
下载小熊猫c++
代码:
#include<raylib.h>
#include<thread>
#include<cmath>
#include<iostream>
#define width 480
#define height 580
#define size_block width/(level*4)
#define key(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
int level=1,stop,gameover=0,gamewon=0,open=0,boom=0,time_open=100;//变量定义
char getkey;
//其实也可以用struct的
Vector2 pop_xy;
int game_map[100][100]={
},game_map_open[100][100]={
},game_map_boom[100][100]={
};//数组定义
void draw_block(int a,bool b,int x,int y,bool c,int x_,int y_){
//绘制方块
if(a>=10&&c){
DrawRectangle(x,y,size_block,size_block,DARKPURPLE);
DrawRectangleLines(x,y,size_block,size_block,BLACK);
}
else if(b&&game_map[x_][y_]!=0){
DrawRectangle(x,y,size_block,size_block,DARKGRAY);
DrawRectangleLines(x,y,size_block,size_block,BLACK);
if(a==1)
DrawText(TextFormat("%i",a),x+size_block/2,y,size_block,SKYBLUE);
else if(a==2)
DrawText(TextFormat("%i",a),x+size_block/2-15,y,size_block,BLUE);
else if(a==3)
DrawText(TextFormat("%i",a),x+size_block/2-15,y,size_block,ORANGE);
else if(a==4)
DrawText(TextFormat("%i",a)