From f794b9ee52293cefd6ac73fdf0d2a01c5388f057 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 31 Jan 2008 18:22:44 +0000 Subject: modular system works now --- src/core/Makefile.am | 12 ++++++------ src/core/core.cc | 26 +++++++++++++++++++++----- src/core/core.h | 4 ++++ 3 files changed, 31 insertions(+), 11 deletions(-) (limited to 'src/core') diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 0f0020f..1f1cc2e 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -1,12 +1,12 @@ METASOURCES = AUTO INCLUDES = -I$(top_srcdir)/src -libcore_la_SOURCES = core.cc -libcore_la_LDFLAGS = -avoid-version -no-undefined -libcore_la_LIBADD = $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/src/math/libmath.la \ - $(top_builddir)/src/filesystem/libfilesystem.la +libcore_la_SOURCES = core.cc game.cc +libcore_la_LDFLAGS = -avoid-version +libcore_la_LIBADD = $(top_builddir)/src/math/libmath.la \ + $(top_builddir)/src/common/libcommon.la \ + $(top_builddir)/src/filesystem/libfilesystem.la noinst_LTLIBRARIES = libcore.la -noinst_HEADERS = core.h +noinst_HEADERS = core.h game.h diff --git a/src/core/core.cc b/src/core/core.cc index b576ba5..0a4ed60 100644 --- a/src/core/core.cc +++ b/src/core/core.cc @@ -12,23 +12,39 @@ namespace core { -/// initialize the core -void init() { +void init() +{ + con_debug << "Initializing core..." << std::endl; + common::init(); filesystem::init(); + + if (::core::Game::instance()) + ::core::Game::instance()->init(); + else + con_warn << "No game module found!" << std::endl; - con_debug << "Initializing core..." << std::endl; } -/// shutdown the core -void shutdown() { +void shutdown() +{ con_debug << "Shutting down core..." << std::endl; + if (::core::Game::instance()) + ::core::Game::instance()->shutdown(); + else + con_warn << "No game module found!" << std::endl; + filesystem::shutdown(); common::shutdown(); } +void frame(float sec) +{ + if (::core::Game::instance()) + ::core::Game::instance()->frame(sec); } +} //namespace core diff --git a/src/core/core.h b/src/core/core.h index d5e4542..09c7209 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -16,7 +16,11 @@ namespace core /// shutdown the core void shutdown(); + /// run one frame + void frame(float sec); }; +#include "core/game.h" + #endif // __INCLUDED_CORE_H__ -- cgit v1.2.3