From f54bd48a884e4e3c95818f042a4b2418a6e070a4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 7 Oct 2008 17:14:27 +0000 Subject: working button click --- src/client/client.cc | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'src/client/client.cc') diff --git a/src/client/client.cc b/src/client/client.cc index b218166..e9bfba8 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -168,9 +168,8 @@ void Client::run() if ((d > 0)) { if (d >= client_frame_lenght) { float elapsed = (float)(d) / 1000.f; - core::Application::frame(elapsed); - video::frame(elapsed); - input::frame(elapsed); + + frame(elapsed); client_previous_timestamp = client_current_timestamp; } else { @@ -183,6 +182,30 @@ void Client::run() } +void Client::frame(float seconds) +{ + core::Application::frame(seconds); + + if (!core::application()->connected()) { + // load the intro if nothing is running + if (core::application()->load("intro")) { + core::application()->connect(""); + } + // if all fails, show the console + if (!core::application()->connected() && !console()->visible()) { + console()->toggle(); + } + } else { + // show the main menu on non-interactive modules + if (!core::game()->interactive() && !ui::root()->active()) { + ui::root()->show_window("main"); + } + } + + video::frame(seconds); + input::frame(seconds); +} + void Client::shutdown() { con_print << "^BShutting down client..." << std::endl; @@ -258,8 +281,14 @@ void Client::notify_zoneclear(core::Zone *zone) void Client::notify_disconnect() { // FIXME unload sounds - render::unload(); + view::clear_zone(0); +} + +void Client::notify_connect() +{ + ui::root()->hide_window(); + view::clear_zone(0); } } // namespace client -- cgit v1.2.3