@ -35,11 +35,7 @@ bool FiestaOnlineEditor::OnUserCreate(){
selectedPath . push_back ( " " ) ;
utils : : datafile : : Read ( config , " assets/program.txt " ) ;
if ( config . HasProperty ( " DefaultPath " ) ) {
manager . Open ( & menu ) ;
} else {
manager . Open ( & dialog . GetMenu ( ) ) ;
}
InitializePathSelection ( ) ;
return true ;
}
@ -105,12 +101,15 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
} break ;
case SELECTED_FOLDER : {
std : : cout < < selectedPath . back ( ) < < std : : endl ;
config [ " DefaultPath " ] . SetString ( selectedPath . back ( ) ) ;
if ( pickFileState = = SHINEDIR ) {
config [ " DefaultPath " ] . SetString ( selectedPath . back ( ) ) ;
} else
if ( pickFileState = = CLIENTDIR ) {
config [ " ClientPath " ] . SetString ( selectedPath . back ( ) ) ;
}
utils : : datafile : : Write ( config , " assets/program.txt " ) ;
ItemEditor * itemEditor = new ItemEditor ( this , " Item Editor: " + selectedPath . back ( ) , { 32 , 32 } , GetScreenSize ( ) - vi2d { 64 , 64 } ) ;
CreateWindow ( itemEditor ) ;
itemEditor - > Load ( selectedPath . back ( ) ) ;
manager . Close ( ) ;
InitializePathSelection ( ) ;
} break ;
case LOAD_ITEM_EDITOR : {
ItemEditor * itemEditor = new ItemEditor ( this , " Item Editor: " + config [ " DefaultPath " ] . GetString ( ) , { 32 , 32 } , GetScreenSize ( ) - vi2d { 64 , 64 } ) ;
@ -140,6 +139,17 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
SetDrawTarget ( 1 ) ;
//BACKGROUND DRAWING
if ( appState = = LOADFOLDER ) {
switch ( pickFileState ) {
case SHINEDIR : {
DrawString ( { 2 , 2 } , " Choose the Shine file directory: " ) ;
} break ;
case CLIENTDIR : {
DrawString ( { 2 , 2 } , " Choose the Client file directory: " ) ;
} break ;
}
}
bool internalMouseFocus = false ;
for ( Window * w : windows ) {
if ( ! w - > IsFocusedWindow ( ) ) {
@ -219,6 +229,21 @@ void FiestaOnlineEditor::CreateWindow(Window*window){
windows . reserve ( windows . size ( ) + 1 ) ; //HACK ALERT! Whenever we are iterating through the windows list we could potentially add an item to the end of it whenever it becomes focused to keep layering. Because of this we don't want to reallocate during another push_back. This ensures that will never occur.
}
void FiestaOnlineEditor : : InitializePathSelection ( ) {
if ( config . HasProperty ( " DefaultPath " ) & & config . HasProperty ( " ClientPath " ) ) {
appState = MENUSELECT ;
manager . Open ( & menu ) ;
} else
if ( ! config . HasProperty ( " DefaultPath " ) ) {
pickFileState = SHINEDIR ;
manager . Open ( & dialog . GetMenu ( ) ) ;
} else
if ( ! config . HasProperty ( " ClientPath " ) ) {
pickFileState = CLIENTDIR ;
manager . Open ( & dialog . GetMenu ( ) ) ;
}
}
int main ( )
{
FiestaOnlineEditor demo ;