![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
EasyX实践
文章平均质量分 58
111
冷眼观world
社畜
展开
-
前置学习——EasyX部分函数了解
快速导航绘图设备initgraph()cleardevice()图形颜色及样式setbkcolor()setfillcolor()setbkmode()setlinecolor()setlinestyle()样例图形绘制circle()fillcircle()fillrectangle()line()文字输出outtextxy()样例settextcolor()settextstyle()样例鼠标相关MOUSEMSGGetMouseMsg()MouseHit()其他BeginBatchDraw()Flush原创 2021-03-08 22:35:03 · 1761 阅读 · 0 评论 -
EasyX小练习——用类封装的可视化时钟
//头文件#define CLOCK_H#include <graphics.h>#include <cmath>#define HEIGHT 800#define WIDTH 600#define PI 3.14159class Clock{private: int x; int y; int radius; float hour; float minutes; float seconds; float angle;public: Clock()原创 2021-05-04 22:44:43 · 637 阅读 · 0 评论 -
简单小游戏——Flappy Bird
软件使用:EasyX、VS2013效果图:源代码:#include <stdint.h>#include <graphics.h>#include <conio.h>int main(){ int score = 0; float width = 600.0, height = 400.0, gravity = 0.25; float rect_width = 40.0, rect_height = 125.0; float rect_vx = -1原创 2021-02-14 18:50:59 · 241 阅读 · 0 评论 -
简单小游戏——“旋转蛇”错觉
软件使用EasyX、VS2013效果图具体实现人脑处理高对比度颜色(比如黑和白)的时间要比处理低对比度颜色短很多,而这之间的时间差会让图片产生相对运动的效果,这就是旋转蛇错觉。图上黑色和白色角度都是PI / 60,红色和青色都是PI / 30,而一组角(即黑+白+红+青)一共是PI / 10,所以一共要20组来组成一个圆。如图所示,一个成型的圆是由4个半径不同的圆组成的(先显示半径大的,再逐个显示半径小的),并且这些圆两两之间相差PI / 20。最后循环输出6个成型的圆即可先看会用到的easy原创 2021-02-15 21:57:55 · 407 阅读 · 0 评论 -
简单小游戏——见缝插针
#include <graphics.h>#include <conio.h>#include <stdio.h>#include <math.h>int main(){ const float PI = 3.14159; int lineNum = 0; int width = 800, height = 600, score = 0; initgraph(width, height); setbkcolor(WHITE); //设置针原创 2021-02-17 22:32:18 · 972 阅读 · 2 评论 -
简单小游戏——见缝插圆
软件使用EasyX、VS2013效果图具体实现用代码实现将圆填充整个画面,并且圆要尽可能的大,然后按空格会出现不同类型的圆源代码#include <time.h>#include <graphics.h>#include <conio.h>#include <stdio.h>#include <math.h>//计算两点间的距离float Dist2Points(float x1, float y1, float x2原创 2021-02-18 21:54:10 · 269 阅读 · 0 评论 -
简单小游戏——贪吃蛇
软件使用EasyX、VS2013效果图具体实现修复了食物会出现在蛇身上的bug,以及往反方向运动时导致游戏失败的bug源代码#include <graphics.h>#include <conio.h>#include <stdio.h>#define HEIGHT 30#define WIDTH 40#define BLOCK_SIZE 20char moveDirection;int snakeLen = 5, velocity = 35原创 2021-02-25 22:26:52 · 177 阅读 · 0 评论 -
简单小游戏——十步万度
#include <conio.h>#include <stdio.h>#include <graphics.h>#include <math.h>#define PI 3.14159struct Round{ float x, y; float r; int angleNum;};int index[2] = {};int step, total_angle;Round rounds[5][5];void start();voi原创 2021-03-01 21:10:34 · 506 阅读 · 0 评论