Magic_Game/ConsoleDemo/main.cpp

58 lines
1.2 KiB
C++
Raw Normal View History

2017-11-03 22:14:07 +08:00
#include <easy2d.h>
2017-10-14 01:07:34 +08:00
class Scene2 :
public EScene
{
public:
Scene2()
{
auto text = new EText(L"<EFBFBD><EFBFBD><EFBFBD>԰<EFBFBD>ť");
auto text2 = new EText(L"<EFBFBD><EFBFBD><EFBFBD>԰<EFBFBD>ť", L"", 22, EColor::BLUE);
auto button = new EButton(text, text2, text);
button->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2);
button->setCallback([]() {
EApp::backScene(new ETransitionScaleEmerge(1, ETransitionScaleEmerge::ENTER));
});
this->add(button);
}
};
class Scene :
public EScene
{
public:
Scene()
{
/*auto sprite = new ESprite(L"test2.png");
auto button = new EButton(sprite);
button->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2);
button->setCallback([]() {
EApp::enterScene(new Scene2(), new ETransitionScaleEmerge(1, ETransitionScaleEmerge::ENTER));
});
this->add(button);*/
auto sprite = new ESprite(L"test2.png");
sprite->setPivot(-1, 0);
sprite->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2);
this->add(sprite);
sprite->runAction(new EActionLoop(new EActionRotateBy(1, 60)));
}
};
2017-10-14 01:07:34 +08:00
int main()
{
EApp app;
if (app.init(L"Easy2D Demo", 640, 480))
2017-10-14 01:07:34 +08:00
{
ENode::setDefaultPiovt(0.5f, 0.5f);
2017-11-03 22:14:07 +08:00
auto scene = new Scene();
2017-10-14 01:07:34 +08:00
app.enterScene(scene);
app.run();
}
return 0;
}