Magic_Game/ConsoleDemo/main.cpp

37 lines
719 B
C++
Raw Normal View History

2017-11-03 22:14:07 +08:00
#include <easy2d.h>
2017-10-14 01:07:34 +08:00
int main()
{
EApp app;
2017-11-03 12:51:01 +08:00
if (app.init(L"Easy2D Demo", 320, 320))
2017-10-14 01:07:34 +08:00
{
2017-11-03 22:14:07 +08:00
app.showConsole();
2017-10-14 01:07:34 +08:00
auto scene = new EScene();
2017-11-03 12:51:01 +08:00
auto sprite = new ESprite(L"elyse.png");
sprite->setScale(0.3f);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>
float width = EApp::getWidth();
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ڸ߶<DAB8>
float height = EApp::getHeight();
// <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
sprite->setPos(width / 2, height / 2);
//sprite->setAnchor(0, 0);
2017-11-03 22:14:07 +08:00
//scene->add(sprite);
2017-11-03 12:51:01 +08:00
auto text = new EText(L"balabalabalabalabala", L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 80, EColor::BLUE);
scene->add(text, -1);
2017-11-03 22:14:07 +08:00
sprite->setName(L"test");
auto button = new EButton(sprite, [=] {
EApp::enterScene(new EScene);
});
scene->add(button);
2017-10-14 01:07:34 +08:00
app.enterScene(scene);
app.run();
}
return 0;
}