| 
									
										
										
										
											2017-11-03 22:14:07 +08:00
										 |  |  |  | #include <easy2d.h>
 | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +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->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); | 
					
						
							|  |  |  |  | 		this->add(sprite); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		sprite->runAction(new EActionLoop(new EActionRotateBy(1, 60))); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | }; | 
					
						
							| 
									
										
										
										
											2017-11-09 21:04:39 +08:00
										 |  |  |  | #include <iostream>
 | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | int main() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EApp app; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-07 22:20:46 +08:00
										 |  |  |  | 	if (app.init(L"Easy2D Demo", 640, 480)) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-11-09 21:04:39 +08:00
										 |  |  |  | 		app.showConsole(); | 
					
						
							|  |  |  |  | 		for (int i = 0; i < 20; i++) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			std::cout << ERandom::between(1, 3) << std::endl; | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		ENode::setDefaultPiovt(0.5f, 0.5f); | 
					
						
							| 
									
										
										
										
											2017-11-03 22:14:07 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		auto scene = new Scene(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		app.enterScene(scene); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		app.run(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	return 0; | 
					
						
							|  |  |  |  | } |