diff options
author | Stijn Buys <ingar@osirion.org> | 2007-10-22 17:40:39 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2007-10-22 17:40:39 +0000 |
commit | aa33bc22ec4cd14e200ba9e09c43e884a2101a74 (patch) | |
tree | 632021226cb8f0d5c05266b2bb84c607fbc27b80 /src | |
parent | f8e9eab39a5e96d478762d06e27ec38f80128435 (diff) |
basis system console
Diffstat (limited to 'src')
-rw-r--r-- | src/client/Makefile.am | 2 | ||||
-rw-r--r-- | src/client/video.cc | 7 | ||||
-rw-r--r-- | src/client/view.cc | 4 | ||||
-rw-r--r-- | src/common/Makefile.am | 2 | ||||
-rw-r--r-- | src/common/file.cc | 15 | ||||
-rw-r--r-- | src/game/Makefile.am | 1 | ||||
-rw-r--r-- | src/game/game.h | 3 | ||||
-rw-r--r-- | src/gl/Makefile.am | 1 | ||||
-rw-r--r-- | src/server/Makefile.am | 3 | ||||
-rw-r--r-- | src/server/main.cc | 16 |
10 files changed, 24 insertions, 30 deletions
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 <SDL/SDL.h> -#include <iostream> 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 <SDL/SDL.h> -#include <iostream> - 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 <iostream> +#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 <iostream> - -// project headers +#include "console.h" +#include "timer.h" +#include "game/game.h" #include "osirion.h" -#include "game/game.h" -#include "timer.h" +#include <iostream> 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 |