Просмотр исходного кода

Fixed play button in the IDE behaving strangely

Ivan Safrin 13 лет назад
Родитель
Сommit
86070be06b
2 измененных файлов с 11 добавлено и 2 удалено
  1. 3 1
      IDE/Contents/Include/PolycodeIDEApp.h
  2. 8 1
      IDE/Contents/Source/PolycodeIDEApp.cpp

+ 3 - 1
IDE/Contents/Include/PolycodeIDEApp.h

@@ -79,7 +79,9 @@ public:
 	const static int EVENT_SHOW_MENU = 1;
 	
 	CocoaCore *core;	
-protected:	
+protected:
+
+	bool willRunProject;
 	PolycodeFrame *frame;
 	
 	PolycodeEditorManager *editorManager;

+ 8 - 1
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -49,6 +49,8 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	
 //	CoreServices::getInstance()->getRenderer()->setTextureFilteringMode(Renderer::TEX_FILTERING_LINEAR);
 	CoreServices::getInstance()->getRenderer()->setTextureFilteringMode(Renderer::TEX_FILTERING_NEAREST);
+	
+	willRunProject = false;
 
 		
 	printf("creating font editor\n"); 
@@ -324,7 +326,7 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 	
 	if(event->getDispatcher() == frame->playButton) {	
 		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
-			runProject();
+			willRunProject = true;
 		}
 	}
 
@@ -431,6 +433,11 @@ PolycodeIDEApp::~PolycodeIDEApp() {
 
 bool PolycodeIDEApp::Update() {
 
+	if(willRunProject) {
+		willRunProject = false;
+		runProject();
+	}
+
 	if(debugger->isConnected()) {
 			frame->stopButton->visible = true;
 			frame->stopButton->enabled = true;