Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Makefile.am4
-rw-r--r--src/core/application.cc (renamed from src/core/applicationinterface.cc)57
-rw-r--r--src/core/application.h (renamed from src/core/applicationinterface.h)22
-rw-r--r--src/core/core.h6
4 files changed, 45 insertions, 44 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 8afa759..75a2f6c 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -1,13 +1,13 @@
METASOURCES = AUTO
INCLUDES = -I$(top_srcdir)/src
-libcore_la_SOURCES = applicationinterface.cc commandbuffer.cc cvar.cc func.cc \
+libcore_la_SOURCES = application.cc commandbuffer.cc cvar.cc func.cc \
gameinterface.cc
libcore_la_LDFLAGS = -avoid-version -no-undefined
libcore_la_LIBADD = $(top_builddir)/src/math/libmath.la \
$(top_builddir)/src/sys/libsys.la $(top_builddir)/src/filesystem/libfilesystem.la
noinst_LTLIBRARIES = libcore.la
-noinst_HEADERS = applicationinterface.h commandbuffer.h core.h cvar.h func.h \
+noinst_HEADERS = application.h commandbuffer.h core.h cvar.h func.h \
gameinterface.h
diff --git a/src/core/applicationinterface.cc b/src/core/application.cc
index 6add2e0..810bacb 100644
--- a/src/core/applicationinterface.cc
+++ b/src/core/application.cc
@@ -1,5 +1,5 @@
/*
- core/applicationinterface.cc
+ core/application.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
@@ -31,25 +31,26 @@ extern "C" void func_help(std::stringstream &args)
extern "C" void func_quit(std::stringstream &args)
{
- if (ApplicationInterface::instance()) {
- ApplicationInterface::instance()->shutdown();
- ApplicationInterface::instance()->quit(0);
+ if (Application::instance()) {
+ Application::instance()->shutdown();
+ Application::instance()->quit(0);
}
}
extern "C" void func_connect(std::stringstream &args)
{
- if (ApplicationInterface::instance())
- ApplicationInterface::instance()->connect();
+ if (Application::instance())
+ Application::instance()->connect();
}
extern "C" void func_disconnect(std::stringstream &args)
{
- if (ApplicationInterface::instance())
- ApplicationInterface::instance()->disconnect();
+ if (Application::instance())
+ Application::instance()->disconnect();
}
// --------------- signal_handler -----------------------------------
+
extern "C" void signal_handler(int signum)
{
switch (signum) {
@@ -57,12 +58,12 @@ extern "C" void signal_handler(int signum)
case SIGINT:
case SIGQUIT:
case SIGTERM:
- if (ApplicationInterface::instance()) {
+ if (Application::instance()) {
con_warn << "received signal " << signum << ", shutting down..." << std::endl;
- ApplicationInterface::instance()->shutdown();
- ApplicationInterface::instance()->quit(0);
+ Application::instance()->shutdown();
+ Application::instance()->quit(0);
} else {
- std::cerr << "received signal " << signum << ", no application found, terminated..." << std::endl;
+ std::cerr << "received signal " << signum << ", terminated..." << std::endl;
sys::quit(1);
}
break;
@@ -73,17 +74,17 @@ extern "C" void signal_handler(int signum)
}
}
-// --------------- ApplicationInterface -----------------------------
+// --------------- Application -----------------------------
-ApplicationInterface *ApplicationInterface::applicationinterface_instance = 0;
+Application *Application::application_instance = 0;
-ApplicationInterface::ApplicationInterface()
+Application::Application()
{
- if (applicationinterface_instance) {
- std::cerr << "multiple singleton instances: core::ApplicationInterface" << std::endl;
+ if (application_instance) {
+ std::cerr << "multiple core::Application instances!" << std::endl;
sys::quit(2);
}
- applicationinterface_instance = this;
+ application_instance = this;
sys::signal(SIGHUP, signal_handler);
sys::signal(SIGINT, signal_handler);
@@ -91,17 +92,17 @@ ApplicationInterface::ApplicationInterface()
sys::signal(SIGTERM, signal_handler);
}
-ApplicationInterface::~ApplicationInterface()
+Application::~Application()
{
- applicationinterface_instance = 0;
+ application_instance = 0;
}
-ApplicationInterface *ApplicationInterface::instance()
+Application *Application::instance()
{
- return applicationinterface_instance;
+ return application_instance;
}
-void ApplicationInterface::init()
+void Application::init()
{
con_print << "Initializing core..." << std::endl;
con_debug << "Debug messages enabled" << std::endl;
@@ -124,7 +125,7 @@ void ApplicationInterface::init()
current_time = 0;
}
-void ApplicationInterface::shutdown()
+void Application::shutdown()
{
con_print << "Shutting down core..." << std::endl;
@@ -137,12 +138,12 @@ void ApplicationInterface::shutdown()
filesystem::shutdown();
}
-void ApplicationInterface::quit(int status)
+void Application::quit(int status)
{
sys::quit(status);
}
-void ApplicationInterface::connect()
+void Application::connect()
{
if (!game()) {
con_warn << "No game module loaded!" << std::endl;
@@ -161,7 +162,7 @@ void ApplicationInterface::connect()
}
}
-void ApplicationInterface::disconnect()
+void Application::disconnect()
{
if (!game()) {
con_warn << "No game module loaded!" << std::endl;
@@ -181,7 +182,7 @@ void ApplicationInterface::disconnect()
con_print << "Disconnected." << std::endl;
}
-void ApplicationInterface::frame(float seconds)
+void Application::frame(float seconds)
{
current_time += seconds;
diff --git a/src/core/applicationinterface.h b/src/core/application.h
index 76dfe01..985c823 100644
--- a/src/core/applicationinterface.h
+++ b/src/core/application.h
@@ -1,22 +1,22 @@
/*
- core/applicationinterface.h
+ core/application.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2.
*/
-#ifndef __INCLUDED_CORE_APPLICATIONINTERFACE_H__
-#define __INCLUDED_CORE_APPLICATIONINTERFACE_H__
+#ifndef __INCLUDED_CORE_APPLICATION_H__
+#define __INCLUDED_CORE_APPLICATION_H__
namespace core {
/// core interface for the client and server Application classes
-class ApplicationInterface {
+class Application {
public:
/// default constructor
- ApplicationInterface();
+ Application();
/// default destructor
- virtual ~ApplicationInterface();
+ virtual ~Application();
/// initialize the application
virtual void init();
@@ -28,7 +28,7 @@ public:
virtual void frame(float seconds);
/// a pointer to the current console instance
- static ApplicationInterface *instance();
+ static Application *instance();
/// quit the application
virtual void quit(int status);
@@ -41,13 +41,13 @@ public:
/// time the core has been running, in seconds
float current_time;
-private:
- /// console singleton
- static ApplicationInterface *applicationinterface_instance;
+
+ /// global application object
+ static Application *application_instance;
};
} // namespace core
-#endif // __INCLUDED_CORE_APPLICATIONINTERFACE_H__
+#endif // __INCLUDED_CORE_APPLICATION_H__
diff --git a/src/core/core.h b/src/core/core.h
index eb8e067..3802cca 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -8,7 +8,7 @@
#define __INCLUDED_CORE_H__
#include "core/gameinterface.h"
-#include "core/applicationinterface.h"
+#include "core/application.h"
/// core contains the basic functionality of the engine
namespace core
@@ -17,13 +17,13 @@ namespace core
inline GameInterface *game() { return GameInterface::instance(); }
/// pointer to the current ApplicationInterface
- inline ApplicationInterface *application() { return ApplicationInterface::instance(); }
+ inline Application *application() { return Application::instance(); }
/// true if the core is connected to a game module
inline bool connected() { return (GameInterface::instance() && GameInterface::instance()->connected); }
/// return the time the core has been running, in seconds
- inline float time() { return ApplicationInterface::instance()->current_time; }
+ inline float time() { return Application::instance()->current_time; }
};
#include "core/commandbuffer.h"