now im trying to get the skills i have defined to display in a listbox.
here is the gui code i have so far:
Code: Select all
//window
IGUIWindow* mwin = pGUIEnv->addWindow(rect<s32>(10, 0, 408, 400), 0,L"UniComm");
//listbox
IGUIListBox* mwin2 = pGUIEnv->addListBox(rect<s32>(15, 100, 375, 325),0,-1,false);
mwin->addChild(mwin2);
//gui elements
gui::CGUIPanel* panel = new gui::CGUIPanel( pGUIEnv, pGUIEnv->getRootGUIElement(), -1,core::rect<s32>(10,0,408,400)
,false,
gui::ESBM_AUTOMATIC,
gui::ESBM_ALWAYS_INVISIBLE );
panel->setVisible(true);
//put elements together
//mwin->addChild(mwin2);
//panel->addChild(mwin2);
panel->fitChildrenToPanel();
panel->drop();
gui::CGUIExtendedText* text = new gui::CGUIExtendedText( pGUIEnv, panel, -1, core::rect<s32>(15,35,350,350) );
//text color
gui::CColorTextTag* color = new gui::CColorTextTag();
color->addDefaultColors();
text->addTextTag( color );
color->drop();
//gui images
gui::CImageTextTag* img = new gui::CImageTextTag();
img->addImage( L"warn", pDrv->getTexture("G:/ada1/ada1/debug/maps/blast1.jpg"), core::dimension2d<s32>(65,65) );
img->addImage( L"life", pDrv->getTexture("G:/ada1/ada1/debug/maps/arm1.jpg"), core::dimension2d<s32>(65,65) );
img->addImage( L"Psionic", pDrv->getTexture("G:/ada1/ada1/debug/maps/dbl4.jpg"), core::dimension2d<s32>(65,65) );
// img->addImage( L"armorbig", pDrv->getTexture("armor.png"), core::dimension2d<s32>(60,45) );
// img->addImage( L"star", pDrv->getTexture("star.png"), core::dimension2d<s32>(10,10) );
text->addTextTag( img );
img->drop();
gui::CTabTextTag* tab = new gui::CTabTextTag( L"tab", 40 );
text->addTextTag( tab );
tab->drop();
gui::CHLineTextTag* hline = new gui::CHLineTextTag();
text->addTextTag( hline );
hline->drop();
gui::CAlignTextTag* align = new gui::CAlignTextTag();
text->addTextTag( align );
align->drop();
text->setText( L"#img:armorbig:left#This will be the main user interface for Adabraxix, It can contain images: #img:warn# as well as #col:red#coloured text#col#."
// L"You can also change the #font:thick#font to something else#font# if you #col:yellow#would like to do so.#col#"
L"Here is an example of the tabulator:\n\n"
L"#tab##img:life# 140/350#tab##img:warn#Warning!\n"
L"#tab##img:warn# 170#tab##img:star# 25#hline#There are also horizontal lines.They can be coloured as well, and have variable width:"
L"#col:orange##hline:250##col#\n"
L"#img:warn:right##align:center#Text can be centered#align:right##img:Psionic#..or right-aligned #img:star##align#"
L"The two big images are \"anchored\" - they are anchored to either side and the text wraps around them."
L"#align:right#This text is right-aligned#align:center#And this is centered#align#" );
text->setText( L"#img:armorbig:left#The leather armor offers good protection for the upper torso and shoulders. Electrical and fire attacks "
L"are especially well fend off by its hard leathers.\n\n"
L"#align:center##col:blue#Stats:#col##align##hline#\n"
L"#tab##img:armor# 17#tab##img:life# 35/35\n"
L"#tab##img:star# 26#tab##img:warn# #col:red#Can't use#col#\n" );
now , i have my skillmanager initializing the skills i have defined:
skillmanager.cpp
Code: Select all
#include "skillmanager.h"
#include <iostream>
CSkillManager::CSkillManager(void)
{
}
CSkillManager::~CSkillManager(void)
{
}
bool CSkillManager::Init(CGameCore* sManager)
{
InitSkills();
return true;
}
void CSkillManager::InitSkills()
{
std::cout<<"Initializing Skills !!\n";
//skill types ,names, and definitions TODO: this is where we add skills for the game we wamt in it
CGameSkill* sk_openlock = new CGameSkill(0, "Lock Picking" , SKILLTYPE_ACTION, 10);
CGameSkill* sk_hacking = new CGameSkill(1, "Hacking" , SKILLTYPE_ACTION, 10);
CGameSkill* sk_pistols = new CGameSkill(2, "Pistols" , SKILLTYPE_COMBAT, 10);
CGameSkill* sk_rifles = new CGameSkill(3, "Riflery" , SKILLTYPE_COMBAT, 10);
CGameSkill* sk_marksman = new CGameSkill(4, "Marksmanship" , SKILLTYPE_COMBAT, 10);
CGameSkill* sk_heavyweapons = new CGameSkill(5, "Heavy Weapons" , SKILLTYPE_COMBAT, 10);
CGameSkill* sk_explosives = new CGameSkill(6, "Explosives" ,SKILLTYPE_COMBAT, 10);
//TODO : add more skills to basic skillset and others
std::cout<<"Skills Initialized!!\n";
}
now since i have CSkillManager::GetSkill();
defined in the skill manager class like so:
skillmanager.h
Code: Select all
//define the skillmanager class and set it up to work as part of the game management system
class CGameCore;
class CSkillManager
{
public:
CSkillManager(void);
~CSkillManager(void);
void InitSkills(); //<----initialization call to initialize the skills defined in skills.h
bool Init(CGameCore* sManager);
void GetSkill();//<-----------get my current skill level
// bool Init(CGameCore* sManager);
void Rise_Skill();//<----keeps track of skill training levels and what not
// bool Init(CGameCore* sManager);
void Use_Skill();//<----can I use the item with my skill lvl?
//bool Init(CGameCore* sManager);
//TODO : Add more management funtions to improve skill system managment like
// saving and loading current skill levels and what skills the player has/doesnt have
private:
CGameCore* sManager;
};
#endif
Code: Select all
#ifndef _SKILLS_H_
#define _SKILLS_H_
#include "core.h"
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace gui;
using namespace video;
using namespace scene;
class CGameCore;
//skill type definitions initialized at runtime and passed to the game management system
const int SKILLTYPE_PASSIVE = 0; //passive
const int SKILLTYPE_COMBAT = 1; //combat
const int SKILLTYPE_ACTION = 2; //action skills
//TODO : add more skill types
class CGameSkill
{
public:
CGameSkill(int sid, char* sname, int stype, int value); //initial declaration
virtual ~CGameSkill();
void SetSkillName(char* skillname); //set one name per skill
void SetSkillID(int skillid); //set skill id
void SetSkillType(int skilltype); //set skill type
void SetSkillValue(int skillvalue); //skill value
//get skill values
char* GetSkillName();
int GetSkillID();
int GetSkillType();
int GetSkillValue();
private:
//skill atributes
char* Skill_Name;
int Skill_ID;
int Skill_Type;
int Skill_Value;
CGameSkill* pSkill;
CGameCore* sManager;
};
#endif
anyone have any sugestions?