Ricky Curtice avatar Ricky Curtice committed f383765

Corrected a null-pointer bug by adding a rogue Entity.

Just a simple container to locate the HUD on the screen.

Comments (0)

Files changed (2)

src/ui_core/UIEngine.cpp

 
 namespace UICore {
 	UIEngine::UIEngine(GlobalProperties* gprops, MessageDispatcher* msghndlr) : CoreInterface(gprops,msghndlr) {
-		this->hud = new HUD(NULL, this); //*HACK: NULL here will cause a runtime crash in RenderEngine.
+		this->hudEntity = new Entity(); //*HACK: Entities should be delcared elsewhere, and passed in vie CreateComponent, but this might work.
+		this->hudEntity->location.x = 0.0f;
+		this->hudEntity->location.y = 0.0f;
+		this->hudEntity->location.z = 0.0f;
+		
+		this->hud = new HUD(this->hudEntity, this);
 		this->input = new Input(NULL, this);
 	}
 
 	UIEngine::~UIEngine() {
 		delete this->hud;
 		delete this->input;
+		delete this->hudEntity;
 	}
 
 

src/ui_core/UIEngine.h

 #include <boost/any.hpp>
 
 #include "../CoreInterface.h"
+#include "../Entity.h"
 #include "HUD.h"
 #include "HUDPart.h"
 #include "Input.h"
 		void hideAll();
 
 		//*TODO: shouldn't these be private?
+		Entity* hudEntity;
 		HUD* hud;
 		Input* input;
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.