#include "DebugObject.h"
#include "WorldManager.h"
//#include "DebugMessage.h"
#include <curses.h>

DebugObject::DebugObject(){
	for(int i=0;i<256;i++){
		this->messages[i]=NULL;
	}
}
DebugObject::~DebugObject(){}
void DebugObject::move(int dx,int dy){
	this->setPos(Position(this->getPos().getX()+dx,this->getPos().getY()+dy));
}
void DebugObject::step(){}
int DebugObject::eventHandler(Event *e){
	if (e->getType() == "step") {
		//step();
		draw();
		for(int i=0;i<256;i++){
			if(messages[i]!=NULL){
				DebugMessage* dbg=this->messages[i];
				mvaddstr(dbg->_y,dbg->_x,dbg->_str);
			}
		}
		return 1;
	}
	return 0;
}

void DebugObject::addMessage(DebugMessage* dbg,int index){
	//for(int i=0;i<256;i++){
		//if(this->messages[index]==NULL){
			this->messages[index]=dbg;
		//}
	//}
}

void DebugObject::writeString(int y, int x, char* str){
	mvaddstr(y,x,str);
}
