Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in5
-rw-r--r--osirion.kdevelop6
-rw-r--r--osirion.kdevelop.pcsbin265729 -> 273656 bytes
-rw-r--r--osirion.kdevses4
-rw-r--r--src/Makefile.am4
-rw-r--r--src/client/application.cc8
-rw-r--r--src/client/client.h2
-rw-r--r--src/client/console.cc127
-rw-r--r--src/client/console.h14
-rw-r--r--src/client/input.cc11
-rw-r--r--src/client/view.cc25
-rw-r--r--src/client/view.h9
-rw-r--r--src/core/applicationinterface.cc15
-rw-r--r--src/core/commandbuffer.cc2
-rw-r--r--src/core/func.cc27
-rw-r--r--src/core/func.h16
-rw-r--r--src/core/gameinterface.cc13
-rw-r--r--src/core/gameinterface.h13
-rw-r--r--src/filesystem/Makefile.am4
-rw-r--r--src/filesystem/file.cc6
-rw-r--r--src/filesystem/file.h6
-rw-r--r--src/filesystem/filesystem.cc4
-rw-r--r--src/filesystem/vfile.cc24
-rw-r--r--src/filesystem/vfile.h31
-rw-r--r--src/game/game.cc8
-rw-r--r--src/game/game.h2
-rw-r--r--src/render/Makefile.am4
-rw-r--r--src/render/render.cc17
-rw-r--r--src/render/render.h5
29 files changed, 315 insertions, 97 deletions
diff --git a/configure.in b/configure.in
index d94f05e..900cd92 100644
--- a/configure.in
+++ b/configure.in
@@ -99,9 +99,10 @@ AC_CHECK_HEADER(GL/glext.h,
)
AC_CHECK_LIB(GL, glVertex3f,
- GL_LIBS="$GL_LIBS -lGL"
+ GL_LIBS="$GL_LIBS -lGL -lGLU"
)
+
AC_SUBST(GL_LIBS)
AC_SUBST(GL_CFLAGS)
@@ -146,7 +147,7 @@ The Osirion Project $VERSION
Configuration summary:
platform ........... $host
flags .............. $CXXFLAGS
- debug messages ..... $debug_messages
+ debug messages ..... $have_debug_messages
Installation directories:
prefix ............. $PREFIX
diff --git a/osirion.kdevelop b/osirion.kdevelop
index 0a41004..bc6bf04 100644
--- a/osirion.kdevelop
+++ b/osirion.kdevelop
@@ -21,7 +21,7 @@
</general>
<kdevautoproject>
<general>
- <activetarget>src/render/librender.la</activetarget>
+ <activetarget>src/osirion</activetarget>
<useconfiguration>debug</useconfiguration>
</general>
<run>
@@ -29,12 +29,12 @@
<terminal>true</terminal>
<directoryradio>executable</directoryradio>
<runarguments>
- <osirion/>
+ <osirion></osirion>
<osiriond/>
</runarguments>
<debugarguments>
<osiriond/>
- <osirion/>
+ <osirion></osirion>
</debugarguments>
<cwd>
<osiriond>/home/ingar/projects/osirion/osirion-work/debug/src/</osiriond>
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs
index 6b83196..8f468cc 100644
--- a/osirion.kdevelop.pcs
+++ b/osirion.kdevelop.pcs
Binary files differ
diff --git a/osirion.kdevses b/osirion.kdevses
index 520a288..ba26c45 100644
--- a/osirion.kdevses
+++ b/osirion.kdevses
@@ -2,8 +2,8 @@
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
<DocsAndViews NumberOfDocuments="1" >
- <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/gl.cc" >
- <View0 Encoding="" line="30" Type="Source" />
+ <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/configure.in" >
+ <View0 Encoding="" line="105" Type="Source" />
</Doc0>
</DocsAndViews>
<pluginList>
diff --git a/src/Makefile.am b/src/Makefile.am
index eae6f48..fbadbd7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,6 @@ osiriond_LDADD = $(top_builddir)/src/server/libserver.la
# client
osirion_SOURCES = osirion.cc
-osirion_CFLAGS = $(LIBSDL_CFLAGS) $(GL_CFLAGS)
+osirion_CFLAGS = $(LIBSDL_CFLAGS) $(GL_CFLAGS) $(GLUT_CFLAGS)
osirion_LDADD = $(top_builddir)/src/client/libclient.la
-osirion_LDFLAGS = $(LIBSDL_LIBS) $(GL_LIBS)
+osirion_LDFLAGS = $(GL_LIBS) $(LIBSDL_LIBS)
diff --git a/src/client/application.cc b/src/client/application.cc
index d3e7f4e..5822600 100644
--- a/src/client/application.cc
+++ b/src/client/application.cc
@@ -17,6 +17,11 @@
namespace client {
+extern "C" void func_con_toggle(std::stringstream &args)
+{
+ console.toggle();
+}
+
void Application::quit(int status)
{
SDL_Quit();
@@ -38,6 +43,9 @@ void Application::init()
// initialize input
input.init();
+
+ // register our engine functions
+ core::func_register("con_toggle", func_con_toggle);
}
void Application::run()
diff --git a/src/client/client.h b/src/client/client.h
index af3e53b..64f1aab 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -18,6 +18,8 @@
#include "core/core.h"
#include "game/game.h"
+#include <SDL/SDL.h>
+
/// client-side functions to render and control the gameworld
/** The client namespace contains the necessary functions to
* accept input, send it to the game and renders the result
diff --git a/src/client/console.cc b/src/client/console.cc
index 50093f9..a0cc7c5 100644
--- a/src/client/console.cc
+++ b/src/client/console.cc
@@ -40,31 +40,87 @@ std::ostream & Console::debugstream()
void Console::draw()
{
using namespace render;
-
+
+ // flush console messages in the buffer
flush();
float height;
+ bool showloader = false;
if (core::game()) {
- if (!core::game()->ready())
+ if (!core::game()->ready()) {
height = 0.6f;
- else if (visible)
+ showloader = true;
+ } else if (visible)
height = 0.6f;
else
- return;
- } else
+ height = 0.0f;
+ } else {
+ showloader = true;
height = 1.0f;
+ }
+
+ if (showloader) {
+ // draw the loader background
+ gl::color(0.5f, 0.5f, 0.5f, 1.0f);
+
+ gl::begin(gl::Quads);
+ gl::vertex(0,0, 0);
+ gl::vertex(video.width,0,0);
+ gl::vertex(video.width,video.height,0);
+ gl::vertex(0,video.height,0);
+ gl::end();
+ }
+
+ if (height > 0) {
+ // draw version below the bottom of the console
+ gl::color(0.0f, 1.0f, 0.0f, 1.0f);
+ std:: string version = std::string("The Osirion Project ");
+ version.append(PACKAGE_VERSION);
+ draw_text(video.width-CHARSIZE*(version.size()+1), video.height*height-CHARSIZE-4, version);
+
+ // draw the transparent console background
+ gl::color(1, 1, 1, .5);
+
+ gl::enable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, render::textures[0]); // bitmaps/loader.tga
+
+ gl::begin(gl::Quads);
+ glTexCoord2f(0.0f, 0.0f);
+ gl::vertex(0,0, 0);
+
+ glTexCoord2f(1.0f, 0.0f);
+ gl::vertex(video.width,0,0);
+
+ glTexCoord2f(1.0f, 1.0f);
+ gl::vertex(video.width,video.height*height,0);
+
+ glTexCoord2f(0.0f, 1.0f);
+ gl::vertex(0,video.height*height,0);
+
+ gl::end();
+
+ glBindTexture(GL_TEXTURE_2D, render::textures[1]); // bitmaps/conchars.tga
+ gl::enable(GL_BLEND);
+
+ // draw the console text
+ gl::color(1,1,1,1);
+ std::deque<std::string>::reverse_iterator rit = console.text.rbegin();
+ float y = video.height*height-2*CHARSIZE-8;
+ while (y > 0 && rit < console.text.rend()) {
+ draw_text(0, y, *rit);
+ y -= CHARSIZE;
+ ++rit;
+ }
+
+ // draw the console input
+ gl::color(0.0f, 1.0f, 0.0f, 1.0f);
+ draw_text(0, video.height*height - CHARSIZE - 4, input);
+
+ gl::disable(GL_TEXTURE_2D);
+ gl::disable(GL_BLEND);
+ }
- // console background rectangle
- gl::enable(GL_BLEND);
- gl::begin(gl::Quads);
- gl::color(1, 1, 1, .1);
- gl::vertex(-0.5f*video.ratio , 0.5, -1.0f);
- gl::vertex(0.5f*video.ratio ,0.5, -1.0f);
- gl::vertex(0.5f*video.ratio , 0.5-height, -1.0f);
- gl::vertex(-0.5f*video.ratio , 0.5-height, -1.0f);
- gl::end();
- gl::disable(GL_BLEND);
}
void Console::flush()
@@ -72,16 +128,10 @@ void Console::flush()
char line[MAXCMDSIZE];
while(this->buffer.getline(line, MAXCMDSIZE-1)) {
- while (text.size() >= 32765 - MAXCMDSIZE) {
- size_t i = 0;
- while (i+1 < text.size() && text[i] != '\n')
- i++;
- text.erase(0, i+1);
+ while (text.size() >= MAXCONLINES) {
+ text.pop_front();
}
-
- text.append(line);
- text.append("\n");
-
+ text.push_back(std::string(line));
std::cout << line << std::endl;
}
@@ -93,4 +143,33 @@ void Console::toggle()
visible = !visible;
}
+void Console::handle_keyreleased(SDL_keysym* keysym)
+{
+ switch( keysym->sym ) {
+ case '`':
+ case '~':
+ toggle();
+ return;
+ break;
+
+ case SDLK_RETURN:
+ if (input.size()) {
+ core::cmd << input << std::endl;
+ input.clear();
+ }
+ break;
+ case SDLK_BACKSPACE:
+ if (input.size()) {
+ input.erase(input.size()-1, 1);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (keysym->sym >= 32 && keysym->sym <= 175) {
+ input += (char) keysym->sym;
+ }
+}
+
} // namespace client
diff --git a/src/client/console.h b/src/client/console.h
index ee3b85e..7f98666 100644
--- a/src/client/console.h
+++ b/src/client/console.h
@@ -8,7 +8,13 @@
#define __INCLUDED_CLIENT_CONSOLE_H__
#include "sys/consoleinterface.h"
+
+#include <SDL/SDL.h>
+
#include <sstream>
+#include <deque>
+
+#define MAXCONLINES 2048
namespace client {
@@ -40,12 +46,18 @@ public:
bool visible;
+ /// toggle handle keyboard input
+ void handle_keyreleased(SDL_keysym* keysym);
+
protected:
/// console text buffer
std::stringstream buffer;
/// console text data
- std::string text;
+ std::deque<std::string> text;
+
+private:
+ std::string input;
};
}
diff --git a/src/client/input.cc b/src/client/input.cc
index d30a97e..96cd032 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -34,7 +34,8 @@ void Input::handle_keyreleased(SDL_keysym* keysym)
switch( keysym->sym ) {
case '`':
case '~':
- console.toggle();
+ //console.toggle();
+ core::cmd << "con_toggle" << std::endl;
break;
case SDLK_SPACE:
camera.nextmode();
@@ -88,10 +89,14 @@ void Input::process()
while( SDL_PollEvent( &event ) ) {
switch( event.type ) {
case SDL_KEYDOWN:
- handle_keypressed( &event.key.keysym );
+ if (!console.visible)
+ handle_keypressed( &event.key.keysym );
break;
case SDL_KEYUP:
- handle_keyreleased( &event.key.keysym );
+ if (console.visible)
+ console.handle_keyreleased( &event.key.keysym );
+ else
+ handle_keyreleased( &event.key.keysym );
break;
case SDL_QUIT:
client::application.shutdown();
diff --git a/src/client/view.cc b/src/client/view.cc
index 8881ac2..3b5f785 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -12,8 +12,6 @@
#include "sys/sys.h"
#include "math/mathlib.h"
-#include <SDL/SDL.h>
-
using namespace render;
namespace client
@@ -49,7 +47,8 @@ void View::reset() {
// Culling
gl::cullface( GL_BACK );
gl::frontface(GL_CCW );
-}
+
+}
void View::draw_world(float elapsed)
@@ -135,18 +134,22 @@ void View::draw(float elapsed)
{
// Clear the color and depth buffers.
gl::clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
+
// Change to the projection matrix and set our viewing volume.
gl::matrixmode( GL_PROJECTION );
gl::loadidentity();
//glu::perspective( 64.0, video::ratio, 1.0, 1024.0 );
const float frustumsize = 0.5f;
- gl::frustum( -frustumsize * video.ratio, frustumsize * video.ratio, -frustumsize, frustumsize, 1.0f, 1024.0f);
-
+ x = -frustumsize * video.ratio;
+ width = video.ratio;
+ y = -frustumsize;
+ height = 1;
- gl::matrixmode( GL_MODELVIEW );
+ //gl::frustum( -frustumsize * video.ratio, frustumsize * video.ratio, -frustumsize, frustumsize, 1.0f, 1024.0f);
+ gl::frustum(x, x+width, y, y +height, 1.0f, 1024.0f);
+ gl::matrixmode( GL_MODELVIEW );
gl::loadidentity();
gl::rotate(90.0f, 0, 1.0, 0);
@@ -159,13 +162,15 @@ void View::draw(float elapsed)
// draw the semi-static background
draw_background(elapsed);
- // draw the console
- //gl::matrixmode( GL_PROJECTION );
- //gl::loadidentity();
+ // switch to ortographic projection to draw the GUI
+ gl::matrixmode( GL_PROJECTION );
+ gl::loadidentity();
+ glOrtho(0, video.width, video.height, 0, -1000.0f, 1000.0f);
gl::matrixmode( GL_MODELVIEW );
gl::loadidentity();
+ // draw the console
console.draw();
}
diff --git a/src/client/view.h b/src/client/view.h
index e0a613f..92965ce 100644
--- a/src/client/view.h
+++ b/src/client/view.h
@@ -24,9 +24,18 @@ public:
/// reset the projection matrix
void reset();
+ /// width of the console (in OpenGL units)
float width;
+
+ /// height of the console (in OpenGL units)
float height;
+ /// bottom left x value
+ float x;
+
+ /// bottom left y value
+ float y;
+
protected:
/// draw the world
void draw_world(float elapsed);
diff --git a/src/core/applicationinterface.cc b/src/core/applicationinterface.cc
index 9a2cce2..d195881 100644
--- a/src/core/applicationinterface.cc
+++ b/src/core/applicationinterface.cc
@@ -25,6 +25,11 @@ extern "C" void func_help(std::stringstream &args) {
con_print << "This is the help function" << std::endl;
}
+extern "C" void func_quit(std::stringstream &args) {
+ ApplicationInterface::instance()->shutdown();
+ ApplicationInterface::instance()->quit(0);
+}
+
// --------------- signal_handler -----------------------------------
extern "C" void signal_handler(int signum)
{
@@ -80,11 +85,13 @@ void ApplicationInterface::init()
{
filesystem::init();
- con_debug << "Initializing core..." << std::endl;
+ con_print << "Initializing core..." << std::endl;
+ con_debug << "Debug messages enabled" << std::endl;
// register our functions
- func::add("print", func_print);
- func::add("help", func_help);
+ func_register("print", func_print);
+ func_register("help", func_help);
+ func_register("quit", func_quit);
if (game())
game()->init();
@@ -95,7 +102,7 @@ void ApplicationInterface::init()
void ApplicationInterface::shutdown()
{
- con_debug << "Shutting down core..." << std::endl;
+ con_print << "Shutting down core..." << std::endl;
if (game())
game()->shutdown();
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 23e8a8d..fbeba7b 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -23,7 +23,7 @@ void exec(const char *text) {
cmdstream >> cmdname;
- func::Func f = func::find(cmdname);
+ Func f = func_find(cmdname);
if (f) {
f(cmdstream);
diff --git a/src/core/func.cc b/src/core/func.cc
index 6ffc20e..c4f14db 100644
--- a/src/core/func.cc
+++ b/src/core/func.cc
@@ -9,24 +9,21 @@
namespace core {
-namespace func {
+std::map<std::string, Func> functionmap;
- std::map<std::string, Func> functionmap;
-
- void add(const char * functionname, Func functionptr)
- {
- functionmap[std::string(functionname)] = functionptr;
- }
+void func_register(const char * functionname, Func functionptr)
+{
+ functionmap[std::string(functionname)] = functionptr;
+}
- void remove(std:: string functionname)
- {
- functionmap.erase(std::string(functionname));
- }
+void func_unregister(std:: string functionname)
+{
+ functionmap.erase(std::string(functionname));
+}
- Func find(std::string functionname)
- {
- return functionmap[functionname];
- }
+Func func_find(std::string functionname)
+{
+ return functionmap[functionname];
}
}
diff --git a/src/core/func.h b/src/core/func.h
index 9d9f352..901490e 100644
--- a/src/core/func.h
+++ b/src/core/func.h
@@ -10,21 +10,19 @@
#include <sstream>
namespace core {
-
-/// engine functions registry
-namespace func {
+ /// function pointer type
typedef void (* Func)(std::stringstream &args);
/// register a function pointer
- void add(const char *functionname, Func functionptr);
+ void func_register(const char *functionname, Func functionptr);
/// unregister a function pointer
- void remove(std:: string functionname);
-
- /// find a fuction
- Func find(std::string functionname);
-}
+ void func_unregister(std:: string functionname);
+ /// find a fuction pointer
+ /** Returns 0 if the function pointer could not be found
+ */
+ Func func_find(std::string functionname);
}
#endif // __INCLUDED_CORE_FUNC_H__
diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc
index d9d8f0c..ac5209b 100644
--- a/src/core/gameinterface.cc
+++ b/src/core/gameinterface.cc
@@ -44,8 +44,19 @@ void GameInterface::shutdown()
game_ready = false;
}
-bool GameInterface::ready()
+bool GameInterface::ready() const
{
return game_ready;
}
+
+float GameInterface::time() const
+{
+ return current_time;
+}
+
+void GameInterface::frame (float seconds)
+{
+ current_time += seconds;
+}
+
}
diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h
index 622aaf5..1986939 100644
--- a/src/core/gameinterface.h
+++ b/src/core/gameinterface.h
@@ -29,18 +29,23 @@ public:
/// run one frame of the game
/** @param sec time since the previous frame, in seconds
*/
- virtual void frame (float sec) = 0;
+ virtual void frame (float seconds);
/// a pointer to the current game instance
static GameInterface * instance();
- /// state of the game
- bool ready();
+ /// return true if the game is ready and running
+ bool ready() const;
+
+ /// return the current game time, in seconds
+ float time() const;
private:
- /// game singleton
static GameInterface *gameinterface_instance;
+
bool game_ready;
+
+ float current_time;
};
}
diff --git a/src/filesystem/Makefile.am b/src/filesystem/Makefile.am
index a490cd3..65540f1 100644
--- a/src/filesystem/Makefile.am
+++ b/src/filesystem/Makefile.am
@@ -1,9 +1,9 @@
METASOURCES = AUTO
-libfilesystem_la_SOURCES = file.cc filesystem.cc inifile.cc path.cc
+libfilesystem_la_SOURCES = file.cc filesystem.cc inifile.cc path.cc vfile.cc
libfilesystem_la_LDFLAGS = -avoid-version -no-undefined
libfilesystem_la_LIBADD = $(top_builddir)/src/sys/libsys.la
noinst_LTLIBRARIES = libfilesystem.la
-noinst_HEADERS = file.h filesystem.h inifile.h path.h
+noinst_HEADERS = file.h filesystem.h inifile.h path.h vfile.h
INCLUDES = -I$(top_srcdir)/src
diff --git a/src/filesystem/file.cc b/src/filesystem/file.cc
index cd6ae1b..1203d5a 100644
--- a/src/filesystem/file.cc
+++ b/src/filesystem/file.cc
@@ -17,6 +17,8 @@ File::~File() {}
void File::open(const char * filename, ios_base::openmode mode) {
file_name.assign(filename);
std::string fn;
+
+ real_name.clear();
// if moddir is set, try the mods subdir first
if (moddir.size()) {
@@ -26,6 +28,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()) {
+ real_name = fn;
con_debug << "File opened " << fn << std::endl;
return;
}
@@ -36,6 +39,7 @@ void File::open(const char * filename, ios_base::openmode mode) {
std::ifstream::open(fn.c_str(), mode);
if (this->is_open()) {
con_debug << "File opened " << fn << std::endl;
+ real_name = fn;
return;
}
}
@@ -47,6 +51,7 @@ void File::open(const char * filename, ios_base::openmode mode) {
std::ifstream::open(fn.c_str(), mode);
if (this->is_open()) {
con_debug << "File opened " << fn << std::endl;
+ real_name = fn;
return;
}
@@ -60,6 +65,7 @@ void File::open(const char * filename, ios_base::openmode mode) {
con_warn << "Could not open " << filename << std::endl;
} else {
con_debug << "File opened " << fn << std::endl;
+ real_name = fn;
}
}
diff --git a/src/filesystem/file.h b/src/filesystem/file.h
index aaafd01..ba392de 100644
--- a/src/filesystem/file.h
+++ b/src/filesystem/file.h
@@ -26,9 +26,15 @@ public:
inline std::string name() {
return file_name;
}
+
+ /// current full path
+ inline std::string path() {
+ return real_name;
+ }
private:
std::string file_name;
+ std::string real_name;
}
; // class File
diff --git a/src/filesystem/filesystem.cc b/src/filesystem/filesystem.cc
index b720198..5d3ed40 100644
--- a/src/filesystem/filesystem.cc
+++ b/src/filesystem/filesystem.cc
@@ -14,7 +14,7 @@ std::string filesystem::basedir = "";
std::string filesystem::moddir = "";
void filesystem::init() {
- con_debug << "Initializing filesystem..." << std::endl;
+ con_print << "Initializing filesystem..." << std::endl;
// FIXME datadir should by set by ./configure and read from config.h
@@ -33,6 +33,6 @@ void filesystem::init() {
}
void filesystem::shutdown() {
- con_debug << "Shutting down filesystem..." << std::endl;
+ con_print << "Shutting down filesystem..." << std::endl;
}
diff --git a/src/filesystem/vfile.cc b/src/filesystem/vfile.cc
new file mode 100644
index 0000000..9fcb2b3
--- /dev/null
+++ b/src/filesystem/vfile.cc
@@ -0,0 +1,24 @@
+/*
+ filesystem/vfile.cc
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+// project headers
+#include "filesystem/vfile.h"
+
+namespace filesystem
+{
+
+std::string VFile::find(const char *filename)
+{
+ return std::string();
+}
+
+
+bool VFile::exists(const char *filename)
+{
+ return (find(filename).size() == 0);
+}
+
+}
diff --git a/src/filesystem/vfile.h b/src/filesystem/vfile.h
new file mode 100644
index 0000000..a64dbc6
--- /dev/null
+++ b/src/filesystem/vfile.h
@@ -0,0 +1,31 @@
+/*
+ filesystem/vfile.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_FILESYSTEM_VFILE_H__
+#define __INCLUDED_FILESYSTEM_VFILE_H__
+
+// project headers
+#include "filesystem/filesystem.h"
+
+namespace filesystem {
+
+/// a file in the virtual file system
+class VFile {
+
+public:
+ /// search the path for a file in the virtual
+ /** If the file can not be found in any of the data directories,
+ * an empty string will be returned
+ */
+ static std::string find(const char *filename);
+
+ /// returns true if a file exists in the virtual filesystem
+ static bool exists(const char *filename);
+};
+
+}
+
+#endif //__INCLUDED_FILESYSTEM_VFILE_H__
diff --git a/src/game/game.cc b/src/game/game.cc
index 2945657..0d79195 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -23,8 +23,6 @@ void Game::init()
using math::Vector3f;
using filesystem::IniFile;
- con_debug << "Debug messages enabled" << std::endl;
-
// read game.ini
IniFile f;
f.open("ini/game.ini");
@@ -119,9 +117,11 @@ void Game::shutdown()
core::GameInterface::shutdown();
}
-void Game::frame(float elapsed)
+void Game::frame(float seconds)
{
- ship.update(elapsed);
+ GameInterface::frame(seconds);
+
+ ship.update(seconds);
}
}; // namespace game
diff --git a/src/game/game.h b/src/game/game.h
index bd9cebb..29f3e1b 100644
--- a/src/game/game.h
+++ b/src/game/game.h
@@ -31,7 +31,7 @@ public:
/// shutdown the game
void shutdown();
/// execute one game grame
- void frame(float sec);
+ void frame(float seconds);
/// sectors in space
std::vector<Sector*> sectors;
diff --git a/src/render/Makefile.am b/src/render/Makefile.am
index a993703..183ab41 100644
--- a/src/render/Makefile.am
+++ b/src/render/Makefile.am
@@ -3,5 +3,5 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = librender.la
librender_la_LDFLAGS = -avoid-version -no-undefined @GL_LIBS@
librender_la_LIBADD = $(top_builddir)/src/math/libmath.la
-librender_la_SOURCES = box.cc gl.cc render.cc sphere.cc
-noinst_HEADERS = box.h gl.h render.h sphere.h
+librender_la_SOURCES = box.cc gl.cc render.cc sphere.cc text.cc tga.cc
+noinst_HEADERS = box.h gl.h render.h sphere.h text.h tga.h
diff --git a/src/render/render.cc b/src/render/render.cc
index 2440b25..4f959dc 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -10,18 +10,25 @@
namespace render {
+GLuint textures[32];
+
void init()
{
- con_debug << "Initializing render..." << std::endl;
+ con_print << "Initializing render..." << std::endl;
+
+ con_print << " Renderer: " << gl::renderer() << std::endl;
+ con_print << " Vendor: " << gl::vendor() << std::endl;
+ con_print << " Version: " << gl::version() << std::endl;
+
+ con_print << "Loading textures..." << std::endl;
- con_print << "Renderer: " << gl::renderer() << std::endl;
- con_print << "Vendor: " << gl::vendor() << std::endl;
- con_print << "Version: " << gl::version() << std::endl;
+ TGA::texture(textures, "bitmaps/loader.tga", 0);
+ TGA::texture(textures, "bitmaps/conchars.tga", 1);
}
void shutdown()
{
- con_debug << "Shutting down render..." << std::endl;
+ con_print << "Shutting down render..." << std::endl;
}
}
diff --git a/src/render/render.h b/src/render/render.h
index eaaef73..4faa7d5 100644
--- a/src/render/render.h
+++ b/src/render/render.h
@@ -7,6 +7,7 @@
#ifndef __INCLUDED_RENDER_H__
#define __INCLUDED_RENDER_H__
+#include "GL/gl.h"
namespace render {
@@ -15,8 +16,12 @@ namespace render {
/// shutdown the render subsystem
void shutdown();
+
+ extern GLuint textures[32];
}
#include "render/gl.h"
+#include "render/text.h"
+#include "render/tga.h"
#endif // __INCLUDED_RENDER_H__