栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C++豌豆射手

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C++豌豆射手

嗨,我是Beluga,今天,我为大家带来代买:C++豌豆射手
代码如下

#include
#include
#include
using namespace std;
 
class p2 {
public:
	int size_x;
	int size_y;
	int init_x;
	int init_y;
 
	void _p2(int x1, int y1, int x2, int y2) {
		size_x = x1;
		size_y = y1;
		init_x = x2;
		init_y = y2;
	}
};
class p3 {
public:
	int size_x;
	int size_y;
	int init_x;
	int init_y;
 
	void _p3(int x1, int y1, int x2, int y2) {
		size_x = x1;
		size_y = y1;
		init_x = x2;
		init_y = y2;
	}
};
 
int main()
{
	p2 ptwo;
	p3 pthree;
	ptwo._p2(200, 200, 200, 200);
	pthree._p3(50, 50, 400, 250);
	IMAGE p2, p3;
	loadimage(&p2, "p2.png", ptwo.size_x, ptwo.size_y);
	loadimage(&p3, "p3.png", pthree.size_x, pthree.size_y);
	initgraph(800, 600);
	putimage(ptwo.init_x, ptwo.init_y, &p2);
	putimage(pthree.init_x, pthree.init_y, &p3);
	BeginBatchDraw();//开始批量绘制
	while (1)
	{
		cleardevice();
		putimage(ptwo.init_x, ptwo.init_y, &p2);
		pthree.init_x += 1;
		if (pthree.init_x == 750)
			pthree.init_x = 400;
		putimage(pthree.init_x, pthree.init_y, &p3);
		Sleep(10);
		FlushBatchDraw();//批量绘制
	}
	_getch();
	closegraph();
	return 0;
}

好了,别忘了点赞,关注,收藏

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/950178.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号