The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'! https://forums.lestoria.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdventuresInLestoria/Crawler/ClassSelectionWindow.cpp

71 lines
3.0 KiB

#pragma once
#include "Crawler.h"
#include "DEFINES.h"
#include "Menu.h"
#include "MenuLabel.h"
INCLUDE_game
typedef Attribute A;
void Menu::InitializeClassSelectionWindow(){
Menu*classSelectionWindow=CreateMenu(CLASS_SELECTION,CENTERED,game->GetScreenSize()-vi2d{24,24});
classSelectionWindow->S(A::CLASS_SELECTION)="Warrior"; //Default selected class.
vf2d outlineSize=classSelectionWindow->size-vf2d{13,13};
MenuLabel*outline=new MenuLabel(CLASS_SELECTION,{{4,4},outlineSize},"",1,true,false,true,false);
classSelectionWindow->AddComponent("Outline Border",outline);
vf2d buttonPadding={2,2};
vf2d buttonSize={outlineSize.y/3-buttonPadding.y*3,outlineSize.y/3-buttonPadding.y*3};
float buttonTotalWidth=(buttonSize.x+buttonPadding.x)*3;
vf2d buttonStartPos=outline->GetPos()+vf2d{outlineSize.x/2,outlineSize.y/3}-vf2d{buttonTotalWidth/2,0};
MenuComponent*warriorButton=new MenuComponent(CLASS_SELECTION,{buttonStartPos+(buttonSize+buttonPadding)*vf2d{0,0},buttonSize},Warrior::name,CLASS_INFO,
[](MenuFuncData data){
data.menu.S(A::CLASS_SELECTION)=Warrior::name;
delete Menu::menus[CLASS_INFO];
Menu::InitializeClassInfoWindow();
});
MenuComponent*rangerButton=new MenuComponent(CLASS_SELECTION,{buttonStartPos+(buttonSize+buttonPadding)*vf2d{1,0},buttonSize},Ranger::name,CLASS_INFO,
[](MenuFuncData data){
data.menu.S(A::CLASS_SELECTION)=Ranger::name;
delete Menu::menus[CLASS_INFO];
Menu::InitializeClassInfoWindow();
});
MenuComponent*wizardButton=new MenuComponent(CLASS_SELECTION,{buttonStartPos+(buttonSize+buttonPadding)*vf2d{2,0},buttonSize},Wizard::name,CLASS_INFO,
[](MenuFuncData data){
data.menu.S(A::CLASS_SELECTION)=Wizard::name;
delete Menu::menus[CLASS_INFO];
Menu::InitializeClassInfoWindow();
});
MenuComponent*thiefButton=new MenuComponent(CLASS_SELECTION,{buttonStartPos+(buttonSize+buttonPadding)*vf2d{0,1},buttonSize},Thief::name,CLASS_INFO,
[](MenuFuncData data){
data.menu.S(A::CLASS_SELECTION)=Thief::name;
delete Menu::menus[CLASS_INFO];
Menu::InitializeClassInfoWindow();
});
MenuComponent*trapperButton=new MenuComponent(CLASS_SELECTION,{buttonStartPos+(buttonSize+buttonPadding)*vf2d{1,1},buttonSize},Trapper::name,CLASS_INFO,
[](MenuFuncData data){
data.menu.S(A::CLASS_SELECTION)=Trapper::name;
delete Menu::menus[CLASS_INFO];
Menu::InitializeClassInfoWindow();
});
MenuComponent*witchButton=new MenuComponent(CLASS_SELECTION,{buttonStartPos+(buttonSize+buttonPadding)*vf2d{2,1},buttonSize},Witch::name,CLASS_INFO,
[](MenuFuncData data){
data.menu.S(A::CLASS_SELECTION)=Witch::name;
delete Menu::menus[CLASS_INFO];
Menu::InitializeClassInfoWindow();
});
classSelectionWindow->AddComponent("Warrior Button",warriorButton);
classSelectionWindow->AddComponent("Ranger Button",rangerButton);
classSelectionWindow->AddComponent("Wizard Button",wizardButton);
classSelectionWindow->AddComponent("Thief Button",thiefButton);
classSelectionWindow->AddComponent("Trapper Button",trapperButton);
classSelectionWindow->AddComponent("Witch Button",witchButton);
}