/******************************************************/
#include "stdafx.h"
#include "Main.h"
/******************************************************/
GuiObjs gui_objs2;
Button *btnWorld;
Button *btnCreateChar1;
Button *btnDeleteChar;
Button *btnReLogin;
Image CharSelectionBg;
/******************************************************/
#include "data/enum/_enums.h"
/******************************************************/
Game::ObjMemx<Game::Static> Statics1; // container for static objects
Game::ObjMemx<Game::Item > Items1; // container for item objects
Game::ObjMemx<Game::Chr > Chrs1; // container for character objects
/******************************************************/
// custom function called when buttons are pressed
void btnWorldFunction(Ptr)
{
gui_objs2.del();
{
StateGame.set(2.0);
}
}
void btnCreateChar1Function(Ptr)
{
gui_objs2.del();
{
StateCharCreate.set(2.0);
}
}
void btnReLoginFunction(Ptr)
{
gui_objs2.del();
StateLoginScreen.set(2.0);
}
/******************************************************/
Bool InitCharSelection()
{
{
Gui.kb_lit.zero();
// load Gui
if(gui_objs2.load("gui/obj/CharacterSelection.gobj"))
{
// if loaded succesfully 'gui_objs' contains all objects
Gui+=gui_objs2;
// requesting Gui objects by name
btnWorld=&gui_objs2.getButton("btnWorld");
btnCreateChar1=&gui_objs2.getButton("btnCreateChar1");
btnReLogin=&gui_objs2.getButton("btnReLogin");
btnWorld->func(btnWorldFunction);
btnCreateChar1->func(btnCreateChar1Function);
btnReLogin->func(btnReLoginFunction);
Physics.create(CSS_NONE,true,"Installation/PhysX");
Sun.image=Images("gfx/sky/sun.gfx");
Sky.atmospheric();
// Initialize World
Game::World.init();
// Assigning memory containers to certain Object Types
Game::World.setObjType(Statics1,OBJ_STATIC) // set 'Statics' memory container for 'OBJ_STATIC' objects
.setObjType(Items1 ,OBJ_ITEM ) // set 'Items' memory container for 'OBJ_ITEM' objects
.setObjType(Chrs1 ,OBJ_PLAYER); // set 'Chrs' memory container for 'OBJ_PLAYER' objects
// Engine is set up create the world
Game::World.New("world/charsellect.world");
// Updates world to use only terrain and objects at given position
Game::World.update(Cam.at); // which updates world to use only terrain and objects at given position, here camera position is used
return true;
}
return false;
}
}
/******************************************************/
void ShutCharSelection()
{
}
/******************************************************/
bool UpdateCharSelection()
{
CamHandle(0.1f,100,CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));
Game::World.update(Cam.at); // update the world to given position
Gui.update();
return true;
}
/******************************************************/
void Render1()
{
Game::World.draw(); // Draw world, World automatically detects active rendering mode)
}
/******************************************************/
void DrawCharSelection()
{
// Draw character selection screen
Gui.draw ();
Renderer(Render1);
}
/******************************************************/
State StateCharSelection(UpdateCharSelection,DrawCharSelection,InitCharSelection,ShutCharSelection);
/******************************************************/