Commit a3b4af57 authored by Gerhard Stein's avatar Gerhard Stein

Some drastical cleanups of old menu code

parent af356769
This diff is collapsed.
......@@ -158,7 +158,7 @@ bool CGameLauncher::setupMenu()
0.75f,
0.75f ),
GsRect<float>(0.0f, 0.0f, 0.069f, 0.069f) );
/*
mLauncherDialog.addControl(new GsButton( "|", new OpenSettingsMenuEvent(),
GsControl::Style::NONE,
0.75f,
......@@ -166,7 +166,7 @@ bool CGameLauncher::setupMenu()
1.0f ),
GsRect<float>(0.93f, 0.0f, 0.069f, 0.069f) );
*/
mLauncherDialog.addControl(mpGameSelectionList,
GsRect<float>(0.01f, 0.07f, 0.49f, 0.79f));
......
......@@ -32,8 +32,7 @@ target_link_libraries(engine
engine_keen_galaxy
engine_keen_vorticon
engine_keen_dreams
engine_core
GsKit
engine_core
cg_dialog
unzip)
......@@ -22,7 +22,6 @@
#include "Playerdefines.h"
#include "engine/core/spritedefines.h"
#include "graphics/GsSprite.h"
#include "sdl/extensions.h"
#include <graphics/GsSurface.h>
......
......@@ -10,6 +10,8 @@ target_link_libraries(engine_core sdl_extensions_audio sdl_extensions_sys)
target_link_libraries(engine_core sdl_extensions_audio sdl_extensions_sys)
# TODO: Not sure why Windows requires this yet.
if(WIN32)
Target_link_libraries(engine_core SDL2)
endif(WIN32)
#if(WIN32)
# Target_link_libraries(engine_core SDL2)
#endif(WIN32)
Target_link_libraries(engine_core GsKit)
......@@ -12,6 +12,8 @@
#include <widgets/GsMenuController.h>
#include "fileio/KeenFiles.h"
#include "base/CInput.h"
#include "base/video/GsEffectController.h"
CPassive::CPassive()
......
......@@ -11,6 +11,7 @@
#include <base/video/CVideoDriver.h>
#include <base/GsTimer.h>
#include <base/utils/StringUtils.h>
#include <base/video/GsEffectController.h>
#include <cassert>
CResourceLoader::CResourceLoader() :
......
......@@ -74,10 +74,6 @@ bool VirtualKeenControl::init()
return true;
}
// Status Button
if( !loadButtonTexture("4.png", mStatusButtonTexture) )
return false;
bool VirtualKeenControl::ponder()
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
......
......@@ -13,18 +13,14 @@
#include "sdl/audio/music/CMusic.h"
#include "sdl/audio/Audio.h"
#include "../GalaxyEngine.h"
namespace galaxy
{
CAudioSettings::CAudioSettings() :
GalaxyMenu(GsRect<float>(0.075f, 0.24f, 0.85f, 0.4f) )
CAudioSettings::CAudioSettings(const GsControl::Style &style) :
GameMenu(GsRect<float>(0.075f, 0.24f, 0.85f, 0.4f), style )
{
#if !defined(EMBEDDED)
mpRate = new ComboSelection( "Rate", gSound.getAvailableRateList());
mpRate = new ComboSelection( "Rate", gSound.getAvailableRateList(), style);
mpMenuDialog->addControl( mpRate );
#endif
......@@ -35,19 +31,21 @@ GalaxyMenu(GsRect<float>(0.075f, 0.24f, 0.85f, 0.4f) )
#if !defined(EMBEDDED)
mpDepth = new ComboSelection( "Depth", filledStrList( 2, "8-bit", "16-bit" ) );
mpDepth = new ComboSelection( "Depth", filledStrList( 2, "8-bit", "16-bit" ), style );
mpMenuDialog->addControl( mpDepth );
#endif
mpSBToggle = new ComboSelection( "Card", filledStrList( 2, "PC Speaker", "Soundblaster" ) );
mpSBToggle = new ComboSelection( "Card", filledStrList( 2, "PC Speaker", "Soundblaster" ), style );
mpMenuDialog->addControl( mpSBToggle );
mpSoundVolume = new NumberControl( "Sound Vol", 0, 100, 4, gSound.getSoundVolume() );
mpSoundVolume = new NumberControl( "Sound Vol", 0, 100, 4, false,
gSound.getSoundVolume(), style );
mpMenuDialog->addControl( mpSoundVolume );
mpMusicVolume = new NumberControl( "Music Vol", 0, 100, 4, gSound.getMusicVolume() );
mpMusicVolume = new NumberControl( "Music Vol", 0, 100, 4, false,
gSound.getMusicVolume(), style );
mpMenuDialog->addControl( mpMusicVolume );
setMenuLabel("SNDEFFMENULABEL");
......@@ -79,7 +77,7 @@ void CAudioSettings::refresh()
void CAudioSettings::ponder(const float deltaT)
{
GalaxyMenu::ponder(0);
GameMenu::ponder(0);
if( mSoundVolume != mpSoundVolume->getSelection() )
{
......@@ -112,11 +110,8 @@ void CAudioSettings::release()
gSound.setSettings(mAudioSpec, mSoundblaster);
gSound.init();
setupAudio();
gMusicPlayer.reload();
gSettings.saveDrvCfg();
}
}
......@@ -8,7 +8,7 @@
#ifndef CAUDIOSETTINGS_H_
#define CAUDIOSETTINGS_H_
#include "GalaxyMenu.h"
#include "engine/core/menu/GameMenu.h"
#include "widgets/Switch.h"
#include "widgets/Button.h"
......@@ -20,14 +20,11 @@
#include <string>
namespace galaxy
{
class CAudioSettings : public GalaxyMenu
class CAudioSettings : public GameMenu
{
public:
CAudioSettings();
CAudioSettings(const GsControl::Style &style);
void init();
......@@ -54,6 +51,4 @@ private:
};
}
#endif /* CAUDIOSETTINGS_H_ */
......@@ -16,8 +16,6 @@
#include <string>
namespace galaxy
{
/**
* \brief This sets the default settings for a classic gameplay
......@@ -74,17 +72,18 @@ public:
}
};
CProfilesMenu::CProfilesMenu() :
GalaxyMenu( GsRect<float>(0.25f, 0.4f, 0.5f, 0.2f) )
CProfilesMenu::CProfilesMenu(const GsControl::Style style) :
GameMenu( GsRect<float>(0.25f, 0.4f, 0.5f, 0.2f), style )
{
mpMenuDialog->addControl(new GalaxyButton( "Classic mode",
new SetDefaultClassic() ) );
mpMenuDialog->addControl(new GameButton( "Classic mode",
new SetDefaultClassic(),
style) );
mpMenuDialog->addControl(new GalaxyButton( "Enhanced mode",
new SetDefaultEnhanced() ) );
mpMenuDialog->addControl(new GameButton( "Enhanced mode",
new SetDefaultEnhanced(),
style) );
setMenuLabel("OPTIONSMENULABEL");
}
}
......@@ -8,16 +8,13 @@
#ifndef CPROFILESMENU_H_
#define CPROFILESMENU_H_
#include "GalaxyMenu.h"
#include "engine/core/menu/GameMenu.h"
namespace galaxy
{
class CProfilesMenu : public GalaxyMenu
class CProfilesMenu : public GameMenu
{
public:
CProfilesMenu();
CProfilesMenu(const GsControl::Style style);
};
}
#endif /* CPROFILESMENU_H_ */
......@@ -13,7 +13,7 @@
#include <widgets/GsMenuController.h>
#include "engine/core/CBehaviorEngine.h"
#include "CameraSettings.h"
//#include "CameraSettings.h"
#include "CVideoSettings.h"
#include <base/utils/Utils.h>
......
......@@ -7,7 +7,7 @@
#include <base/utils/StringUtils.h>
#include "GalaxyMenu.h"
#include "SelectionMenu.h"
#include "ControlSettings.h"
#include "engine/core/CBehaviorEngine.h"
......@@ -16,9 +16,6 @@
namespace galaxy
{
/**
* \brief This sets the default settings for a classic gameplay
*/
......@@ -76,16 +73,17 @@ public:
CControlsettings::CControlsettings( const int selectedPlayer ) :
GalaxyMenu( GsRect<float>(0.1f, 0.25f, 0.8f, 0.5f) ),
CControlsettings::CControlsettings(const int selectedPlayer ,
const GsControl::Style style) :
GameMenu( GsRect<float>(0.1f, 0.25f, 0.8f, 0.5f), style ),
mSelectedPlayer(selectedPlayer)
{
GsButton *button;
GameButton *button;
button = new GalaxyButton( "Movement", new OpenMovementControlMenuEvent(mSelectedPlayer) );
button = new GameButton( "Movement", new OpenMovementControlMenuEvent(mSelectedPlayer), style );
mpMenuDialog->addControl( button );
button = new GalaxyButton( "Buttons", new OpenButtonsControlMenuEvent(mSelectedPlayer) );
button = new GameButton( "Buttons", new OpenButtonsControlMenuEvent(mSelectedPlayer), style );
mpMenuDialog->addControl( button );
mpTwoButtonSwitch = new Switch( "Two Button Fire" );
......@@ -108,7 +106,7 @@ mSelectedPlayer(selectedPlayer)
mpMenuDialog->addControl( mpSuperPogoSwitch );
mpMenuDialog->addControl( mpImpPogoSwitch );
mpMenuDialog->addControl( mpAutoGunSwitch );
mpMenuDialog->addControl( new GalaxyButton( "Reset Controls", new ResetInputEvent(mSelectedPlayer-1) ) );
mpMenuDialog->addControl( new GameButton( "Reset Controls", new ResetInputEvent(mSelectedPlayer-1), style ) );
setMenuLabel("KEYBMENULABEL");
......@@ -131,8 +129,8 @@ void CControlsettings::release()
// Movements Parts of the Control Settings
CControlSettingsBase::CControlSettingsBase(const int selectedPlayer) :
GalaxyMenu( GsRect<float>(0.01f, (1.0f-((MAX_COMMANDS/2.0f)+2)*0.06f)*0.5f, 0.98f,(MAX_COMMANDS/2.0f+2)*0.06f) ),
CControlSettingsBase::CControlSettingsBase(const int selectedPlayer, const GsControl::Style style) :
GameMenu( GsRect<float>(0.01f, (1.0f-((MAX_COMMANDS/2.0f)+2)*0.06f)*0.5f, 0.98f,(MAX_COMMANDS/2.0f+2)*0.06f), style ),
mSelectedPlayer(selectedPlayer)
{}
......@@ -159,7 +157,7 @@ void CControlSettingsBase::ponder(const float deltaT)
mpButtonList[pos]->setText(mCommandName[com] + evName);
}
GalaxyMenu::ponder(0);
//GameButton::ponder(0);
}
}
......@@ -195,7 +193,7 @@ void CControlSettingsMovement::refresh()
const std::string buf2 = gInput.getEventShortName( it->first, mSelectedPlayer-1 );
ReadInputEvent *rie = new ReadInputEvent(mSelectedPlayer, it->first, it->second);
GalaxyButton *guiButton = new GalaxyButton( buf+buf2, rie );
auto *guiButton = new GameButton( buf+buf2, rie, Style() );
rie->setButtonPtr(guiButton);
mpButtonList.push_back( guiButton );
......@@ -230,7 +228,7 @@ void CControlSettingsButtons::refresh()
const std::string buf2 = gInput.getEventShortName( it->first, mSelectedPlayer-1 );
ReadInputEvent *rie = new ReadInputEvent(mSelectedPlayer, it->first, it->second);
GalaxyButton *guiButton = new GalaxyButton( buf+buf2, rie );
auto *guiButton = new GameButton( buf+buf2, rie, Style() );
rie->setButtonPtr(guiButton);
......@@ -242,5 +240,3 @@ void CControlSettingsButtons::refresh()
setMenuLabel("BUTTONMENULABEL");
}
}
......@@ -10,6 +10,9 @@
#include <widgets/GsBaseMenu.h>
#include "engine/core/menu/GameMenu.h"
#include "SelectionMenu.h"
#include <base/utils/StringUtils.h>
#include <base/GsEvent.h>
#include "widgets/Button.h"
......@@ -20,14 +23,13 @@
#include "SelectionMenu.h"
namespace galaxy
{
// Main Class for Controller Config
class CControlsettings : public GalaxyMenu
class CControlsettings : public GameMenu
{
public:
CControlsettings(const int selectedPlayer);
CControlsettings(const int selectedPlayer,
const GsControl::Style style);
void refresh();
......@@ -45,10 +47,11 @@ private:
};
class CControlSettingsBase : public GalaxyMenu
class CControlSettingsBase : public GameMenu
{
public:
CControlSettingsBase(const int selectedPlayer);
CControlSettingsBase(const int selectedPlayer,
const GsControl::Style style);
virtual void ponder(const float deltaT);
virtual void release();
......@@ -56,13 +59,8 @@ public:
protected:
int mSelectedPlayer;
<<<<<<< HEAD:src/engine/keen/galaxy/menu/ControlSettings.h
std::vector<GalaxyButton*> mpButtonList;
std::map<InputCommands, std::string> mCommandName;
=======
std::vector<GameButton*> mpButtonList;
std::map<InputCommand, std::string> mCommandName;
>>>>>>> ce7f64a6... Cleanups, fixes:src/engine/core/menu/ControlSettings.h
bool mapping;
};
......@@ -72,8 +70,9 @@ protected:
class CControlSettingsMovement : public CControlSettingsBase
{
public:
CControlSettingsMovement(const int selectedPlayer) :
CControlSettingsBase(selectedPlayer) {}
CControlSettingsMovement(const int selectedPlayer,
const GsControl::Style &style) :
CControlSettingsBase(selectedPlayer, style) {}
void refresh();
};
......@@ -84,8 +83,9 @@ public:
class CControlSettingsButtons : public CControlSettingsBase
{
public:
CControlSettingsButtons(const int selectedPlayer) :
CControlSettingsBase(selectedPlayer) {}
CControlSettingsButtons(const int selectedPlayer,
const GsControl::Style &style) :
CControlSettingsBase(selectedPlayer, style) {}
void refresh();
};
......@@ -113,6 +113,5 @@ struct OpenMovementControlMenuEvent : OpenControlMenuEvent
OpenControlMenuEvent(option) {}
};
}
#endif /* CCONTROLSETTINGS_H_ */
......@@ -14,7 +14,7 @@
#include <widgets/GsMenuController.h>
#include "engine/core/CBehaviorEngine.h"
#include "CameraSettings.h"
//#include "CameraSettings.h"
#include "CVideoSettings.h"
#include <base/utils/Utils.h>
......
......@@ -68,7 +68,7 @@ void GameMenu::initBackgroundNoStyle()
mBackground.create(0, sdlRect.w, sdlRect.h, RES_BPP, 0, 0, 0, 0);
// Now lets draw the text of the list control
GsFont &Font = gGraphics.getFont(0);
//GsFont &Font = gGraphics.getFont(0);
GsColor backColor(0xFF, 0xFF, 0xFF);
GsColor borderColor(0x7F, 0x7F, 0x7F);
......
......@@ -19,8 +19,6 @@
#include "widgets/BorderedButton.h"
namespace galaxy
{
struct LoadGameSlotFunctorEvent : public InvokeFunctorEvent
......@@ -38,13 +36,15 @@ struct LoadGameSlotFunctorEvent : public InvokeFunctorEvent
};
CLoadMenu::CLoadMenu() :
GalaxyMenu( GsRect<float>(0.1f, 0.0f, 0.8f, 1.0f) )
CLoadMenu::CLoadMenu(const GsControl::Style &style) :
GameMenu( GsRect<float>(0.1f, 0.0f, 0.8f, 1.0f),
style)
{
for( int j = 0 ; j<8 ; j++ )
{
GsButton *button = new BorderedButton( "Empty",
new LoadGameSlotFunctorEvent(j));
new LoadGameSlotFunctorEvent(j),
style);
mpMenuDialog->addControl( button,
GsRect<float>(
0.0f, 0.1f+(j*0.1f), 0.8f, 0.1f) );
......@@ -99,7 +99,3 @@ void CLoadMenu::refresh()
}
}
}
......@@ -8,20 +8,15 @@
#ifndef CLOADMENU_H_
#define CLOADMENU_H_
#include "GalaxyMenu.h"
#include "GameMenu.h"
namespace galaxy
{
class CLoadMenu : public GalaxyMenu
class CLoadMenu : public GameMenu
{
public:
CLoadMenu();
CLoadMenu(const GsControl::Style &style);
void refresh();
};
}
#endif /* CLOADMENU_H_ */
......@@ -40,14 +40,14 @@ void MainMenu::createGameMenu( const bool openedGamePlay,
// TODO: Some items are still disabled, because those are not yet implemented in Galaxy
GsButton *loadButton = new GameButton( "Load",
new OpenMenuEvent( new CLoadMenu(style) ),
new OpenMenuEvent( new CLoadMenu(style) ),
style );
mpMenuDialog->addControl( loadButton );
loadButton->enable(true);
GsButton *saveButton = new GameButton( "Save",
new OpenMenuEvent( new CSaveMenu(style) ),
style);
style );
mpMenuDialog->addControl( saveButton );
saveButton->enable(openedGamePlay);
......
......@@ -9,11 +9,11 @@
#include <base/CInput.h>
#include "engine/core/CSettings.h"
namespace galaxy
{
COptions::COptions() :
GalaxyMenu( GsRect<float>(0.1f, 0.14f, 0.8f, gBehaviorEngine.mOptions.size()*0.07f) )
COptions::COptions(const GsControl::Style style) :
GameMenu( GsRect<float>(0.1f, 0.14f, 0.8f,
gBehaviorEngine.mOptions.size()*0.07f),
style)
{
for( const auto &option : gBehaviorEngine.mOptions )
{
......@@ -38,7 +38,7 @@ void COptions::refresh()
void COptions::ponder(const float deltaT)
{
GalaxyMenu::ponder(0);
GameMenu::ponder(0);
auto it = mpOptionList.begin();
......@@ -54,4 +54,3 @@ void COptions::release()
gSettings.saveGameOptions();
}
}
......@@ -8,19 +8,17 @@
#ifndef COPTIONS_H_
#define COPTIONS_H_
#include "GalaxyMenu.h"
#include "engine/core/menu/GameMenu.h"
#include "widgets/Switch.h"
#include <list>
#include "engine/core/CBehaviorEngine.h"
namespace galaxy
{
class COptions : public GalaxyMenu
class COptions : public GameMenu
{
public:
COptions();
COptions(const GsControl::Style style);
void refresh();
......@@ -32,6 +30,4 @@ private:
std::list<Switch*> mpOptionList;
};
}
#endif /* COPTIONS_H_ */
......@@ -21,11 +21,9 @@
const std::string EMPTY_TEXT = "EMPTY";
namespace galaxy
{
CSaveMenu::CSaveMenu() :
GalaxyMenu(GsRect<float>(0.1f, 0.0f, 0.8f, 1.0f) ),
CSaveMenu::CSaveMenu(const GsControl::Style &style) :
GameMenu(GsRect<float>(0.1f, 0.0f, 0.8f, 1.0f), style ),
m_overwrite(false)
{
// Load the state-file list
......@@ -38,7 +36,7 @@ m_overwrite(false)
if(i < StateFileList.size())
text = StateFileList.at(i);
mpMenuDialog->addControl( new InputText( text ),
mpMenuDialog->addControl( new InputText( text, style ),
GsRect<float>(
0.0f, 0.1f+(i*0.1f), 0.8f, 0.1f) );
......@@ -54,7 +52,8 @@ void CSaveMenu::refresh()
std::vector<std::string> StateFileList;
gSaveGameController.readSlotList(StateFileList);
std::list< std::shared_ptr<GsControl> > &list = mpMenuDialog->getControlList();
std::list< std::shared_ptr<GsControl> > &list =
mpMenuDialog->getControlList();
auto itCtrl = list.begin();
itCtrl++;
......@@ -159,5 +158,3 @@ void CSaveMenu::release()
pInput->setTypeMode(false);
}
}
}
......@@ -8,15 +8,13 @@
#ifndef CSAVEMENU_H_
#define CSAVEMENU_H_
#include "CConfirmMenu.h"
//#include "CConfirmMenu.h"
#include "GameMenu.h"
namespace galaxy
{
class CSaveMenu : public GalaxyMenu
class CSaveMenu : public GameMenu
{
public:
CSaveMenu();
CSaveMenu(const GsControl::Style &style);
void refresh();
void processSpecific(){}
void ponder(const float deltaT);
......@@ -28,6 +26,4 @@ private:
bool m_overwrite = false;
};
}
#endif /* CSAVEMENU_H_ */
......@@ -19,10 +19,13 @@
#include "engine/core/menu/GameMenu.h"
#include "fileio/KeenFiles.h"
#include "fileio/ResourceMgmt.h"
#include "engine/keen/KeenEngine.h"
#include <base/utils/StringUtils.h>
#include <base/utils/FindFile.h>
struct SelectionEvent : CEvent
{
SelectionEvent(const int option) :
......
......@@ -15,7 +15,7 @@
#include "CVideoSettings.h"
#include "DisplaySettings.h"
#include "CameraSettings.h"
//#include "CameraSettings.h"
#include "AudioSettings.h"
#include "Options.h"
#include "ControlSettings.h"
......
......@@ -2,11 +2,9 @@
#include "engine/core/CBehaviorEngine.h"
namespace galaxy
{
CheatsMenu::CheatsMenu() :
GalaxyMenu(GsRect<float>(0.075f, 0.24f, 0.85f, 0.4f) )
CheatsMenu::CheatsMenu(const GsControl::Style style) :
GameMenu(GsRect<float>(0.075f, 0.24f, 0.85f, 0.4f), style )
{
mpJumpSwitch = new Switch( "Fly Mode" );
mpMenuDialog->addControl( mpJumpSwitch );
......@@ -40,5 +38,3 @@ void CheatsMenu::release()
gBehaviorEngine.mCheatmode.items = mpItemsSwitch->isEnabled();
}
}