Merge remote branch 'scrawl/master'
commit
91f0eed9c4
@ -0,0 +1,78 @@
|
||||
#include "mainmenu.hpp"
|
||||
|
||||
#include <OgreRoot.h>
|
||||
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
MainMenu::MainMenu(int w, int h)
|
||||
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
||||
{
|
||||
setCoord(0,0,w,h);
|
||||
|
||||
int height = 64 * 3;
|
||||
|
||||
mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(w/2 - 64, h/2 - height/2, 128, height), MyGUI::Align::Default);
|
||||
int curH = 0;
|
||||
|
||||
mReturn = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mReturn->setImageResource ("Menu_Return");
|
||||
mReturn->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::returnToGame);
|
||||
curH += 64;
|
||||
|
||||
|
||||
/*
|
||||
mNewGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mNewGame->setImageResource ("Menu_NewGame");
|
||||
curH += 64;
|
||||
|
||||
mLoadGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mLoadGame->setImageResource ("Menu_LoadGame");
|
||||
curH += 64;
|
||||
|
||||
|
||||
mSaveGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mSaveGame->setImageResource ("Menu_SaveGame");
|
||||
curH += 64;
|
||||
*/
|
||||
|
||||
mOptions = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mOptions->setImageResource ("Menu_Options");
|
||||
mOptions->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::showOptions);
|
||||
curH += 64;
|
||||
|
||||
/*
|
||||
mCredits = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mCredits->setImageResource ("Menu_Credits");
|
||||
curH += 64;
|
||||
*/
|
||||
|
||||
mExitGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mExitGame->setImageResource ("Menu_ExitGame");
|
||||
mExitGame->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::exitGame);
|
||||
curH += 64;
|
||||
|
||||
}
|
||||
|
||||
void MainMenu::returnToGame(MyGUI::Widget* sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu);
|
||||
}
|
||||
|
||||
void MainMenu::showOptions(MyGUI::Widget* sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
|
||||
}
|
||||
|
||||
void MainMenu::exitGame(MyGUI::Widget* sender)
|
||||
{
|
||||
Ogre::Root::getSingleton ().queueEndRendering ();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
[settings]
|
||||
size_x = 512
|
||||
size_y = 512
|
||||
|
||||
|
||||
[menu_newgame.dds]
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
[menu_newgame_pressed.dds]
|
||||
x = 128
|
||||
y = 0
|
||||
|
||||
[menu_newgame_over.dds]
|
||||
x = 256
|
||||
y = 0
|
||||
|
||||
|
||||
[menu_loadgame.dds]
|
||||
x = 384
|
||||
y = 0
|
||||
|
||||
[menu_loadgame_pressed.dds]
|
||||
x = 0
|
||||
y = 64
|
||||
|
||||
[menu_loadgame_over.dds]
|
||||
x = 128
|
||||
y = 64
|
||||
|
||||
|
||||
[menu_options.dds]
|
||||
x = 256
|
||||
y = 64
|
||||
|
||||
[menu_options_pressed.dds]
|
||||
x = 384
|
||||
y = 64
|
||||
|
||||
[menu_options_over.dds]
|
||||
x = 0
|
||||
y = 128
|
||||
|
||||
|
||||
[menu_credits.dds]
|
||||
x = 128
|
||||
y = 128
|
||||
|
||||
[menu_credits_pressed.dds]
|
||||
x = 256
|
||||
y = 128
|
||||
|
||||
[menu_credits_over.dds]
|
||||
x = 384
|
||||
y = 128
|
||||
|
||||
|
||||
[menu_exitgame.dds]
|
||||
x = 0
|
||||
y = 192
|
||||
|
||||
[menu_exitgame_pressed.dds]
|
||||
x = 128
|
||||
y = 192
|
||||
|
||||
[menu_exitgame_over.dds]
|
||||
x = 256
|
||||
y = 192
|
||||
|
||||
|
||||
[menu_savegame.dds]
|
||||
x = 384
|
||||
y = 192
|
||||
|
||||
[menu_savegame_pressed.dds]
|
||||
x = 0
|
||||
y = 256
|
||||
|
||||
[menu_savegame_over.dds]
|
||||
x = 128
|
||||
y = 256
|
||||
|
||||
|
||||
[menu_return.dds]
|
||||
x = 256
|
||||
y = 256
|
||||
|
||||
[menu_return_pressed.dds]
|
||||
x = 384
|
||||
y = 256
|
||||
|
||||
[menu_return_over.dds]
|
||||
x = 0
|
||||
y = 320
|
||||
|
@ -1,37 +0,0 @@
|
||||
#ifndef OENGINE_OGRE_EXITLISTEN_H
|
||||
#define OENGINE_OGRE_EXITLISTEN_H
|
||||
|
||||
/*
|
||||
This FrameListener simply exits the rendering loop when the window
|
||||
is closed. You can also tell it to exit manually by setting the exit
|
||||
member to true;
|
||||
*/
|
||||
|
||||
#include <OgreFrameListener.h>
|
||||
#include <OgreRenderWindow.h>
|
||||
|
||||
namespace OEngine {
|
||||
namespace Render
|
||||
{
|
||||
struct ExitListener : Ogre::FrameListener
|
||||
{
|
||||
Ogre::RenderWindow *window;
|
||||
bool exit;
|
||||
|
||||
ExitListener(Ogre::RenderWindow *wnd)
|
||||
: window(wnd), exit(false) {}
|
||||
|
||||
bool frameStarted(const Ogre::FrameEvent &evt)
|
||||
{
|
||||
if(window->isClosed())
|
||||
exit = true;
|
||||
|
||||
return !exit;
|
||||
}
|
||||
|
||||
// Function equivalent of setting exit=true. Handy when you need a
|
||||
// delegate to bind to an event.
|
||||
void exitNow() { exit = true; }
|
||||
};
|
||||
}}
|
||||
#endif
|
Loading…
Reference in New Issue