1. ldresbach
  2. GSP 420 Engine Design User Interface


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.

  • Participants
  • Parent commits d1e9585
  • Branches default

Comments (0)

Files changed (2)

File src/ui_core/UIEngine.cpp

View file
  • Ignore whitespace
 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;

File src/ui_core/UIEngine.h

View file
  • Ignore whitespace
 #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;