Added an empty navigation shell to the client
This commit is contained in:
+21
-5
@@ -26,7 +26,21 @@
|
||||
//-------------------------
|
||||
|
||||
LobbyMenu::LobbyMenu() {
|
||||
//
|
||||
//setup the utility objects
|
||||
image.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
image.SetClipH(image.GetClipH()/3);
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
|
||||
//pass the utility objects
|
||||
backButton.SetImage(&image);
|
||||
backButton.SetFont(&font);
|
||||
|
||||
//set the button positions
|
||||
backButton.SetX(50);
|
||||
backButton.SetY(50 + image.GetClipH() * 0);
|
||||
|
||||
//set the button texts
|
||||
backButton.SetText("Back");
|
||||
}
|
||||
|
||||
LobbyMenu::~LobbyMenu() {
|
||||
@@ -50,7 +64,7 @@ void LobbyMenu::FrameEnd() {
|
||||
}
|
||||
|
||||
void LobbyMenu::Render(SDL_Surface* const screen) {
|
||||
//
|
||||
backButton.DrawTo(screen);
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
@@ -58,15 +72,17 @@ void LobbyMenu::Render(SDL_Surface* const screen) {
|
||||
//-------------------------
|
||||
|
||||
void LobbyMenu::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||
//
|
||||
backButton.MouseMotion(motion);
|
||||
}
|
||||
|
||||
void LobbyMenu::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
backButton.MouseButtonDown(button);
|
||||
}
|
||||
|
||||
void LobbyMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
if (backButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||
SetNextScene(SceneList::MAINMENU);
|
||||
}
|
||||
}
|
||||
|
||||
void LobbyMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "button.hpp"
|
||||
|
||||
class LobbyMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
@@ -43,6 +47,11 @@ protected:
|
||||
void MouseButtonUp(SDL_MouseButtonEvent const&);
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//members
|
||||
Image image;
|
||||
RasterFont font;
|
||||
Button backButton;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+43
-5
@@ -26,7 +26,31 @@
|
||||
//-------------------------
|
||||
|
||||
MainMenu::MainMenu() {
|
||||
//
|
||||
//setup the utility objects
|
||||
image.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
image.SetClipH(image.GetClipH()/3);
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
|
||||
//pass the utility objects
|
||||
startButton.SetImage(&image);
|
||||
startButton.SetFont(&font);
|
||||
optionsButton.SetImage(&image);
|
||||
optionsButton.SetFont(&font);
|
||||
quitButton.SetImage(&image);
|
||||
quitButton.SetFont(&font);
|
||||
|
||||
//set the button positions
|
||||
startButton.SetX(50);
|
||||
startButton.SetY(50 + image.GetClipH() * 0);
|
||||
optionsButton.SetX(50);
|
||||
optionsButton.SetY(50 + image.GetClipH() * 1);
|
||||
quitButton.SetX(50);
|
||||
quitButton.SetY(50 + image.GetClipH() * 2);
|
||||
|
||||
//set the button texts
|
||||
startButton.SetText("Start");
|
||||
optionsButton.SetText("Options");
|
||||
quitButton.SetText("Quit");
|
||||
}
|
||||
|
||||
MainMenu::~MainMenu() {
|
||||
@@ -50,7 +74,9 @@ void MainMenu::FrameEnd() {
|
||||
}
|
||||
|
||||
void MainMenu::Render(SDL_Surface* const screen) {
|
||||
//
|
||||
startButton.DrawTo(screen);
|
||||
optionsButton.DrawTo(screen);
|
||||
quitButton.DrawTo(screen);
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
@@ -58,15 +84,27 @@ void MainMenu::Render(SDL_Surface* const screen) {
|
||||
//-------------------------
|
||||
|
||||
void MainMenu::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||
//
|
||||
startButton.MouseMotion(motion);
|
||||
optionsButton.MouseMotion(motion);
|
||||
quitButton.MouseMotion(motion);
|
||||
}
|
||||
|
||||
void MainMenu::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
startButton.MouseButtonDown(button);
|
||||
optionsButton.MouseButtonDown(button);
|
||||
quitButton.MouseButtonDown(button);
|
||||
}
|
||||
|
||||
void MainMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
if (startButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||
SetNextScene(SceneList::LOBBYMENU);
|
||||
}
|
||||
if (optionsButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||
SetNextScene(SceneList::OPTIONSMENU);
|
||||
}
|
||||
if (quitButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||
QuitEvent();
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "button.hpp"
|
||||
|
||||
class MainMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
@@ -43,6 +47,13 @@ protected:
|
||||
void MouseButtonUp(SDL_MouseButtonEvent const&);
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//members
|
||||
Image image;
|
||||
RasterFont font;
|
||||
Button startButton;
|
||||
Button optionsButton;
|
||||
Button quitButton;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+23
-5
@@ -26,7 +26,21 @@
|
||||
//-------------------------
|
||||
|
||||
OptionsMenu::OptionsMenu() {
|
||||
//
|
||||
//setup the utility objects
|
||||
image.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
image.SetClipH(image.GetClipH()/3);
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
|
||||
//pass the utility objects
|
||||
backButton.SetImage(&image);
|
||||
backButton.SetFont(&font);
|
||||
|
||||
//set the button positions
|
||||
backButton.SetX(50);
|
||||
backButton.SetY(50 + image.GetClipH() * 0);
|
||||
|
||||
//set the button texts
|
||||
backButton.SetText("Back");
|
||||
}
|
||||
|
||||
OptionsMenu::~OptionsMenu() {
|
||||
@@ -50,7 +64,9 @@ void OptionsMenu::FrameEnd() {
|
||||
}
|
||||
|
||||
void OptionsMenu::Render(SDL_Surface* const screen) {
|
||||
//
|
||||
backButton.DrawTo(screen);
|
||||
|
||||
font.DrawStringTo("Oh, were you looking for the options screen?", screen, 50, 30);
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
@@ -58,15 +74,17 @@ void OptionsMenu::Render(SDL_Surface* const screen) {
|
||||
//-------------------------
|
||||
|
||||
void OptionsMenu::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||
//
|
||||
backButton.MouseMotion(motion);
|
||||
}
|
||||
|
||||
void OptionsMenu::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
backButton.MouseButtonDown(button);
|
||||
}
|
||||
|
||||
void OptionsMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
if (backButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||
SetNextScene(SceneList::MAINMENU);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "button.hpp"
|
||||
|
||||
class OptionsMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
@@ -43,6 +47,11 @@ protected:
|
||||
void MouseButtonUp(SDL_MouseButtonEvent const&);
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//members
|
||||
Image image;
|
||||
RasterFont font;
|
||||
Button backButton;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
//-------------------------
|
||||
|
||||
SplashScreen::SplashScreen() {
|
||||
//
|
||||
logo.LoadSurface("rsc\\graphics\\logos\\krstudios.bmp");
|
||||
startTick = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
SplashScreen::~SplashScreen() {
|
||||
@@ -37,46 +38,12 @@ SplashScreen::~SplashScreen() {
|
||||
//Frame loop
|
||||
//-------------------------
|
||||
|
||||
void SplashScreen::FrameStart() {
|
||||
//
|
||||
}
|
||||
|
||||
void SplashScreen::Update(double delta) {
|
||||
//
|
||||
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(1)) {
|
||||
SetNextScene(SceneList::MAINMENU);
|
||||
}
|
||||
|
||||
void SplashScreen::FrameEnd() {
|
||||
//
|
||||
}
|
||||
|
||||
void SplashScreen::Render(SDL_Surface* const screen) {
|
||||
//
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//Event handlers
|
||||
//-------------------------
|
||||
|
||||
void SplashScreen::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||
//
|
||||
}
|
||||
|
||||
void SplashScreen::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
}
|
||||
|
||||
void SplashScreen::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
||||
//
|
||||
}
|
||||
|
||||
void SplashScreen::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
switch(key.keysym.sym) {
|
||||
case SDLK_ESCAPE:
|
||||
QuitEvent();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SplashScreen::KeyUp(SDL_KeyboardEvent const& key) {
|
||||
//
|
||||
logo.DrawTo(screen, (screen->w - logo.GetClipW()) / 2, (screen->h - logo.GetClipH()) / 2);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "image.hpp"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
class SplashScreen : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
@@ -32,17 +36,12 @@ public:
|
||||
|
||||
protected:
|
||||
//Frame loop
|
||||
void FrameStart();
|
||||
void Update(double delta);
|
||||
void FrameEnd();
|
||||
void Render(SDL_Surface* const);
|
||||
|
||||
//Event handlers
|
||||
void MouseMotion(SDL_MouseMotionEvent const&);
|
||||
void MouseButtonDown(SDL_MouseButtonEvent const&);
|
||||
void MouseButtonUp(SDL_MouseButtonEvent const&);
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
//members
|
||||
std::chrono::steady_clock::time_point startTick;
|
||||
Image logo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user