break up Client::run() into multiple methods
This commit is contained in:
parent
a4df9488a9
commit
893cac5d9a
@ -74,7 +74,6 @@ bool Client::create_window(bool fullscreen, int width, int height)
|
|||||||
sf::ContextSettings cs = sf::ContextSettings(0, 0, 0,
|
sf::ContextSettings cs = sf::ContextSettings(0, 0, 0,
|
||||||
OPENGL_CONTEXT_MAJOR, OPENGL_CONTEXT_MINOR);
|
OPENGL_CONTEXT_MAJOR, OPENGL_CONTEXT_MINOR);
|
||||||
m_window = new sf::RenderWindow(mode, "Treacherous Terrain", style, cs);
|
m_window = new sf::RenderWindow(mode, "Treacherous Terrain", style, cs);
|
||||||
m_window->setMouseCursorVisible(false);
|
|
||||||
grab_mouse(true);
|
grab_mouse(true);
|
||||||
if (!initgl())
|
if (!initgl())
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,6 +94,12 @@ void Client::run(bool fullscreen, int width, int height, std::string pname)
|
|||||||
m_clock.restart();
|
m_clock.restart();
|
||||||
recenter_cursor();
|
recenter_cursor();
|
||||||
|
|
||||||
|
run_main_menu();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::run_main_menu()
|
||||||
|
{
|
||||||
|
m_window->setMouseCursorVisible(true);
|
||||||
sfg::SFGUI sfgui;
|
sfg::SFGUI sfgui;
|
||||||
sfg::Label::Ptr label = sfg::Label::Create("Label Test");
|
sfg::Label::Ptr label = sfg::Label::Create("Label Test");
|
||||||
sfg::Window::Ptr window(sfg::Window::Create());
|
sfg::Window::Ptr window(sfg::Window::Create());
|
||||||
@ -139,6 +145,12 @@ void Client::run(bool fullscreen, int width, int height, std::string pname)
|
|||||||
m_window->display();
|
m_window->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_client();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::run_client()
|
||||||
|
{
|
||||||
|
m_window->setMouseCursorVisible(false);
|
||||||
double last_time = 0.0;
|
double last_time = 0.0;
|
||||||
while (m_window->isOpen())
|
while (m_window->isOpen())
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,8 @@ class Client
|
|||||||
~Client();
|
~Client();
|
||||||
void run(bool fullscreen, int width, int height, std::string pname);
|
void run(bool fullscreen, int width, int height, std::string pname);
|
||||||
protected:
|
protected:
|
||||||
|
void run_main_menu();
|
||||||
|
void run_client();
|
||||||
void connect(int port, const char *host);
|
void connect(int port, const char *host);
|
||||||
void disconnect();
|
void disconnect();
|
||||||
bool create_window(bool fullscreen, int width, int height);
|
bool create_window(bool fullscreen, int width, int height);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user