From aa33bc22ec4cd14e200ba9e09c43e884a2101a74 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 22 Oct 2007 17:40:39 +0000 Subject: basis system console --- osirion.kdevelop | 17 +++++++++-------- osirion.kdevelop.pcs | Bin 144608 -> 158297 bytes osirion.kdevses | 27 +++------------------------ src/client/Makefile.am | 2 +- src/client/video.cc | 7 +++---- src/client/view.cc | 4 ---- src/common/Makefile.am | 2 +- src/common/file.cc | 15 +++++++-------- src/game/Makefile.am | 1 - src/game/game.h | 3 ++- src/gl/Makefile.am | 1 - src/server/Makefile.am | 3 +-- src/server/main.cc | 16 +++++++++------- 13 files changed, 36 insertions(+), 62 deletions(-) diff --git a/osirion.kdevelop b/osirion.kdevelop index 8457017..36d0544 100644 --- a/osirion.kdevelop +++ b/osirion.kdevelop @@ -1,8 +1,8 @@ - Stijn Buys - stijn.buys@telenet.be + Ingar + ingar@telenet.be 0.0.1 KDevAutoProject C++ @@ -13,7 +13,7 @@ osirion - . + ./ false @@ -29,12 +29,12 @@ true executable - - + + - - + + /home/ingar/projects/osirion/debug/./src/game @@ -115,6 +115,7 @@ + @@ -124,7 +125,7 @@ Doxygen documentatieverzameling osirion.tag - + diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs index fe4d4c3..a805a83 100644 Binary files a/osirion.kdevelop.pcs and b/osirion.kdevelop.pcs differ diff --git a/osirion.kdevses b/osirion.kdevses index 2b5486f..537606e 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,31 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - + + - + diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 37bafcf..a86d8f0 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -5,7 +5,7 @@ osirion_LDADD = $(top_builddir)/src/game/libgame.la \ $(top_builddir)/src/gl/libosiriongl.la -lSDL osirion_SOURCES = camera.cc camera.h client.cc client.h input.cc input.h \ main.cc shipdrawer.cc shipdrawer.h stardrawer.cc stardrawer.h video.cc video.h \ - view.cc view.h + view.cc view.h console.cc console.h diff --git a/src/client/video.cc b/src/client/video.cc index 1dc596e..a76b4b9 100644 --- a/src/client/video.cc +++ b/src/client/video.cc @@ -8,7 +8,6 @@ #include "gl/osiriongl.h" #include -#include namespace client { @@ -62,13 +61,13 @@ void Video::init() int flags = 0; if( SDL_Init(SDL_INIT_VIDEO) < 0 ) { - std::cerr << "SDL_Init() failed: " << SDL_GetError() << std::endl; + conwarn << "SDL_Init() failed: " << SDL_GetError() << std::endl; return; } const SDL_VideoInfo* sdl_videoinfo = SDL_GetVideoInfo(); if( !sdl_videoinfo) { - std::cerr << "SDL_GetVideoInfo() failed: " << SDL_GetError() << std::endl; + conwarn << "SDL_GetVideoInfo() failed: " << SDL_GetError() << std::endl; return; } @@ -86,7 +85,7 @@ void Video::init() flags = SDL_OPENGL | SDL_FULLSCREEN; if(!SDL_SetVideoMode(width, height, bpp, flags )) { - std::cerr << "SDL_SetVideoMode() failed: " << SDL_GetError() << std::endl; + conwarn << "SDL_SetVideoMode() failed: " << SDL_GetError() << std::endl; return; } diff --git a/src/client/view.cc b/src/client/view.cc index c9a7b8a..ca41831 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -14,8 +14,6 @@ #include -#include - namespace client { @@ -118,13 +116,11 @@ void View::draw_world(float elapsed) // draw the world gl::push(); - //std::cerr << "ship at " << game::ship.location << " translate " << game::ship.location - target->location << std::endl; gl::translate(game::ship.location - target->location); gl::scale(0.2f, 0.2f, 0.2f); shipdrawer->draw(elapsed); gl::pop(); - //std::cerr << "star at " << game::star.location << " translate " << game::star.location - game::ship.location << std::endl; gl::push(); gl::translate(game::star.location - target->location); stardrawer->draw(elapsed); diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 86bb4e1..dbed1fb 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -3,6 +3,6 @@ METASOURCES = AUTO libcommon_la_LDFLAGS = -avoid-version -no-undefined noinst_LTLIBRARIES = libcommon.la libcommon_la_SOURCES = color.cc color.h file.cc file.h functions.cc functions.h \ - vector3f.cc vector3f.h + vector3f.cc vector3f.h console.cc console.h diff --git a/src/common/file.cc b/src/common/file.cc index 2ebd457..d7603c3 100644 --- a/src/common/file.cc +++ b/src/common/file.cc @@ -6,9 +6,7 @@ // project headers #include "file.h" - -// C++ headers -#include +#include "console.h" namespace common { @@ -29,7 +27,7 @@ void File::open(const char * filename, ios_base::openmode mode) fn.append(filename); std::ifstream::open(fn.c_str(), mode); if (this->is_open()) { - std::cerr << "File opened " << fn << std::endl; + condebug << "File opened " << fn << std::endl; return; } @@ -38,7 +36,7 @@ void File::open(const char * filename, ios_base::openmode mode) fn.append(moddir); std::ifstream::open(fn.c_str(), mode); if (this->is_open()) { - std::cerr << "File opened " << fn << std::endl; + condebug << "File opened " << fn << std::endl; return; } } @@ -49,7 +47,7 @@ void File::open(const char * filename, ios_base::openmode mode) fn.append(filename); std::ifstream::open(fn.c_str(), mode); if (this->is_open()) { - std::cerr << "File opened " << fn << std::endl; + condebug << "File opened " << fn << std::endl; return; } @@ -61,10 +59,11 @@ void File::open(const char * filename, ios_base::openmode mode) // FIXME console if (!this->is_open()) { - std::cerr << "File could not open " << filename << std::endl; + condebug << "File could not open " << filename << std::endl; } else { - std::cerr << "File opened " << fn << std::endl; + conmesg << "File opened " << fn << std::endl; } } } // namespace common + diff --git a/src/game/Makefile.am b/src/game/Makefile.am index 537bb3a..ff46654 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -6,5 +6,4 @@ noinst_LTLIBRARIES = libgame.la libgame_la_SOURCES = game.cc game.h player.h sector.h ship.cc ship.h star.cc \ star.h world.h INCLUDES = -I$(top_srcdir)/src -noinst_HEADERS = sector.h world.h libgame_la_LIBADD = $(top_builddir)/src/common/libcommon.la diff --git a/src/game/game.h b/src/game/game.h index a2c4156..ed49135 100644 --- a/src/game/game.h +++ b/src/game/game.h @@ -7,9 +7,9 @@ #ifndef __INCLUDED_GAME_H__ #define __INCLUDED_GAME_H__ -// project headers #include "ship.h" #include "star.h" +#include "common/console.h" /// The game engine namespace game @@ -34,3 +34,4 @@ namespace game }; #endif // __INCLUDED_GAME_H__ + diff --git a/src/gl/Makefile.am b/src/gl/Makefile.am index 3fcd178..671ff5f 100644 --- a/src/gl/Makefile.am +++ b/src/gl/Makefile.am @@ -7,4 +7,3 @@ noinst_LTLIBRARIES = libosiriongl.la INCLUDES = -I$(top_srcdir)/src libosiriongl_la_SOURCES = box.h box.cc sphere.cc sphere.h osiriongl.cc \ osiriongl.h -noinst_HEADERS = box.h box.h diff --git a/src/server/Makefile.am b/src/server/Makefile.am index 0859838..c167667 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -1,6 +1,5 @@ INCLUDES = -I$(top_srcdir)/src METASOURCES = AUTO bin_PROGRAMS = osiriond -osiriond_SOURCES = main.cc timer.cc timer.h -noinst_HEADERS = timer.h +osiriond_SOURCES = console.cc console.h main.cc timer.cc timer.h osiriond_LDADD = $(top_builddir)/src/game/libgame.la diff --git a/src/server/main.cc b/src/server/main.cc index 6f71468..92b2dce 100644 --- a/src/server/main.cc +++ b/src/server/main.cc @@ -4,14 +4,12 @@ the terms and conditions of the GNU General Public License version 2 */ -// C++ headers -#include - -// project headers +#include "console.h" +#include "timer.h" +#include "game/game.h" #include "osirion.h" -#include "game/game.h" -#include "timer.h" +#include void quit(int status) { @@ -20,8 +18,12 @@ void quit(int status) int main( int argc, char *argv[] ) { + // initialize system console; + server::Console serverconsole; + common::Console::instance = &serverconsole; + const float server_framerate = 1.0f / 20.0f; - std::cout << "The Osirion project " << OSIRION_VERSION << std::endl; + conmesg << "The Osirion project " << OSIRION_VERSION << std::endl; server::Timer timer; // initialize game -- cgit v1.2.3