快速开发高质量的 2D 小游戏
简易的安装和使用方式
安装程序可以自动识别你的 Visual Studio 版本并提供安装建议,只需要短短几分钟进行下载和安装,你就可以在项目中引入头文件并开始使用 Easy2D 了。
面向 C++ 初学者
Easy2D 是为 C++ 初学者设计的 Windows 桌面游戏的开发框架,你只需说明场景中的每个元素应该做什么,Easy2D 就可以自动处理它们,让一切变得井然有序。
使用简易安装器
在 下载 页面下载安装包,打开后跟随提示安装即可。
安装程序会检测您已经安装的 Visual Studio 版本,并根据您的选择将对应库文件解压至 VS 库目录下。
#include <easy2d/easy2d.h>
using namespace easy2d;
int main()
{
if (Game::init())
{
// 设置窗口标题和窗口大小
Window::setTitle("Rotating Text");
Window::setSize(300, 300);
// 创建场景
auto scene = gcnew Scene;
// 进入该场景
SceneManager::enter(scene);
// 创建一个 Text 对象
auto text = gcnew Text("我的游戏!");
// 将 Text 添加到场景中
scene->addChild(text);
// 居中显示在屏幕上
text->setAnchor(0.5f, 0.5f);
text->setPos(Window::getWidth() / 2, Window::getHeight() / 2);
Game::start();
}
Game::destroy();
return 0;
}
#include <easy2d/easy2d.h>
using namespace easy2d;
int main()
{
if (Game::init())
{
// 设置窗口标题和窗口大小
Window::setTitle("Rotating Text");
Window::setSize(300, 300);
// 创建场景
auto scene = gcnew Scene;
// 进入该场景
SceneManager::enter(scene);
// 创建一个 Text 对象
auto text = gcnew Text("Hello Easy2D!");
// 将 Text 添加到场景中
scene->addChild(text);
// 居中显示在屏幕上
text->setAnchor(0.5f, 0.5f);
text->setPos(Window::getWidth() / 2, Window::getHeight() / 2);
// 创建一个旋转动画,1 秒内顺时针旋转 60 度
auto rotate = gcnew RotateBy(1, 60);
// 创建一个循环动画
auto action = gcnew Loop(rotate);
// 让 Text 执行这个动作
text->runAction(action);
Game::start();
}
Game::destroy();
return 0;
}