diff --git a/src/Makefile.am b/src/Makefile.am index 7ca925af..0f7b9a83 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,17 +4,17 @@ noinst_PROGRAMS = test-map editor noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = \ - game.cpp tiler.cpp tileset.cpp scene.cpp \ - font.cpp layer.cpp map.cpp joystick.cpp \ - asset.h asset.cpp ticker.h ticker.cpp + game.cpp game.h tiler.cpp tiler.h tileset.cpp tileset.h \ + scene.cpp scene.h font.cpp font.h layer.cpp layer.h map.cpp map.h \ + joystick.cpp joystick.h asset.cpp asset.h ticker.cpp ticker.h libcommon_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` -test_map_SOURCES = test-map.cpp sdlvideo.cpp +test_map_SOURCES = test-map.cpp sdlvideo.cpp sdlvideo.h test_map_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` test_map_LDADD = libcommon.a test_map_LDFLAGS = `pkg-config --libs sdl gl SDL_image` -editor_SOURCES = gtk/editor.cpp gtk/gtkvideo.cpp +editor_SOURCES = gtk/editor.cpp gtk/gtkvideo.cpp gtk/gtkvideo.h editor_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image gtk+-2.0 gtkgl-2.0` editor_LDADD = libcommon.a editor_LDFLAGS = `pkg-config --libs sdl gl gtk+-2.0 gtkgl-2.0 SDL_image` diff --git a/src/asset.cpp b/src/asset.cpp index 3bee580c..4d8e416f 100644 --- a/src/asset.cpp +++ b/src/asset.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include diff --git a/src/asset.h b/src/asset.h index 329b93bd..c3487b52 100644 --- a/src/asset.h +++ b/src/asset.h @@ -1,7 +1,15 @@ - -/* - * The asset object - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Asset class +// --------------- +// Assets are objects that can be ticked by the game loop and/or the render +// loop. Assets are implemented as one or several linked lists. See the +// Ticker class for the ticking logic and the linked list implementation. +// #if !defined __DH_ASSET_H__ #define __DH_ASSET_H__ diff --git a/src/font.cpp b/src/font.cpp index ade2eef9..8ef64ca6 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #ifdef WIN32 # define WIN32_LEAN_AND_MEAN diff --git a/src/font.h b/src/font.h index 81eb1a43..d4777c94 100644 --- a/src/font.h +++ b/src/font.h @@ -1,7 +1,12 @@ - -/* - * The font object - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Font class +// -------------- +// #if !defined __DH_FONT_H__ #define __DH_FONT_H__ diff --git a/src/game.cpp b/src/game.cpp index e5027b36..ab009274 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include diff --git a/src/game.h b/src/game.h index 820b4ba0..e01f9853 100644 --- a/src/game.h +++ b/src/game.h @@ -1,7 +1,12 @@ - -/* - * The game object - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Game class +// -------------- +// #if !defined __DH_GAME_H__ #define __DH_GAME_H__ diff --git a/src/gtk/editor.cpp b/src/gtk/editor.cpp index b3115be6..c4e7cf95 100644 --- a/src/gtk/editor.cpp +++ b/src/gtk/editor.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include #include diff --git a/src/gtk/gtkvideo.cpp b/src/gtk/gtkvideo.cpp index 47783e31..cf23e4b9 100644 --- a/src/gtk/gtkvideo.cpp +++ b/src/gtk/gtkvideo.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include diff --git a/src/gtk/gtkvideo.h b/src/gtk/gtkvideo.h index c34e0ae4..dd2d8da2 100644 --- a/src/gtk/gtkvideo.h +++ b/src/gtk/gtkvideo.h @@ -1,7 +1,12 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// -/* - * The video driver - */ +// +// The GtkVideo class +// ------------------ +// #if !defined __DH_GTKVIDEO_H__ #define __DH_GTKVIDEO_H__ @@ -16,9 +21,6 @@ public: GtkVideo(char const *title, int width, int height); virtual ~GtkVideo(); - // New - void *GetWidget(); - // Inherited virtual int GetWidth() const; virtual int GetHeight() const; @@ -26,6 +28,9 @@ public: virtual void PostRender(float milliseconds); virtual void FullScreen(); + // New + void *GetWidget(); + private: GtkVideoData *data; }; diff --git a/src/joystick.cpp b/src/joystick.cpp new file mode 100644 index 00000000..51837f32 --- /dev/null +++ b/src/joystick.cpp @@ -0,0 +1,40 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "joystick.h" + +/* + * Joystick implementation class + */ + +class JoystickData +{ + friend class Joystick; + +private: + int dummy; +}; + +/* + * Public Joystick class + */ + +Joystick::Joystick() +{ + data = new JoystickData(); + + SDL_WM_GrabInput(SDL_GRAB_ON); +} + +Joystick::~Joystick() +{ +} + diff --git a/src/joystick.h b/src/joystick.h new file mode 100644 index 00000000..a634ccd8 --- /dev/null +++ b/src/joystick.h @@ -0,0 +1,34 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Joystick class +// ------------------ +// + +#if !defined __DH_JOYSTICK_H__ +#define __DH_JOYSTICK_H__ + +class JoystickData; + +class Joystick +{ +public: + Joystick(); + ~Joystick(); + + int GetState(); + + static int const NORTH = (1<<0); + static int const EAST = (1<<1); + static int const SOUTH = (1<<2); + static int const WEST = (1<<3); + +private: + JoystickData *data; +}; + +#endif // __DH_JOYSTICK_H__ + diff --git a/src/layer.cpp b/src/layer.cpp index 6656f364..800dc1ee 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include diff --git a/src/layer.h b/src/layer.h index f4943ffd..7e24d2bd 100644 --- a/src/layer.h +++ b/src/layer.h @@ -1,7 +1,13 @@ - -/* - * The layer object - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Layer class +// --------------- +// A Layer object is a subset of a Map. +// #if !defined __DH_LAYER_H__ #define __DH_LAYER_H__ diff --git a/src/map.cpp b/src/map.cpp index f40c8142..719d161f 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include #include diff --git a/src/map.h b/src/map.h index 2a1d7a7f..f0a47b51 100644 --- a/src/map.h +++ b/src/map.h @@ -1,7 +1,14 @@ - -/* - * The map object - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Map class +// ------------- +// A Map object is a collection of Layers and other information (to be +// determined later). +// #if !defined __DH_MAP_H__ #define __DH_MAP_H__ diff --git a/src/scene.cpp b/src/scene.cpp index 9bcbe18c..50a646a7 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include diff --git a/src/scene.h b/src/scene.h index 092eb83a..f187c9c8 100644 --- a/src/scene.h +++ b/src/scene.h @@ -1,7 +1,12 @@ - -/* - * The scene object - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Scene class +// --------------- +// #if !defined __DH_SCENE_H__ #define __DH_SCENE_H__ diff --git a/src/sdlvideo.cpp b/src/sdlvideo.cpp index 7024489b..23ccae5a 100644 --- a/src/sdlvideo.cpp +++ b/src/sdlvideo.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #ifdef WIN32 # define WIN32_LEAN_AND_MEAN diff --git a/src/sdlvideo.h b/src/sdlvideo.h index 00454d87..393437f3 100644 --- a/src/sdlvideo.h +++ b/src/sdlvideo.h @@ -1,7 +1,12 @@ - -/* - * The video driver - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The SdlVideo class +// ------------------ +// #if !defined __DH_SDLVIDEO_H__ #define __DH_SDLVIDEO_H__ diff --git a/src/test-map.cpp b/src/test-map.cpp index 0458b5b7..e30e660c 100644 --- a/src/test-map.cpp +++ b/src/test-map.cpp @@ -1,4 +1,11 @@ -// Test stuff +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include #include diff --git a/src/ticker.cpp b/src/ticker.cpp index 97dd8094..d1c43fae 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -1,7 +1,11 @@ - -/* - * The ticker - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include #include diff --git a/src/ticker.h b/src/ticker.h index 8854e53d..a0e93509 100644 --- a/src/ticker.h +++ b/src/ticker.h @@ -1,7 +1,13 @@ - -/* - * The tick manager - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The Ticker class +// ---------------- +// The Ticker is a static class that registers assets and ticks them. +// #if !defined __DH_TICKER_H__ #define __DH_TICKER_H__ diff --git a/src/tiler.cpp b/src/tiler.cpp index 496067d1..3ee1e709 100644 --- a/src/tiler.cpp +++ b/src/tiler.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include #include diff --git a/src/tiler.h b/src/tiler.h index 6e232777..cad90df0 100644 --- a/src/tiler.h +++ b/src/tiler.h @@ -1,7 +1,13 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// -/* - * The tile manager - */ +// +// The Tiler class +// --------------- +// The Tiler is a static class that manages tilesets. +// #if !defined __DH_TILER_H__ #define __DH_TILER_H__ diff --git a/src/tileset.cpp b/src/tileset.cpp index 12550cb2..6db3aac0 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -1,3 +1,11 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include diff --git a/src/tileset.h b/src/tileset.h index d81d48e1..d15a5437 100644 --- a/src/tileset.h +++ b/src/tileset.h @@ -1,7 +1,14 @@ - -/* - * The tile manager - */ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// + +// +// The TileSet class +// ----------------- +// A TileSet contains the information necesary to blit tiles to the game +// screen. +// #if !defined __DH_TILESET_H__ #define __DH_TILESET_H__ diff --git a/src/video.h b/src/video.h index 7eb4c9e8..88897417 100644 --- a/src/video.h +++ b/src/video.h @@ -1,7 +1,13 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// -/* - * The video interface - */ +// +// The Video interface +// ------------------- +// Not sure yet whether this should exist. +// #if !defined __DH_VIDEO_H__ #define __DH_VIDEO_H__ @@ -9,9 +15,6 @@ class Video { public: - //Video(char const *title, int width, int height); - //virtual ~Video(); - virtual int GetWidth() const = 0; virtual int GetHeight() const = 0; virtual void PreRender() = 0; diff --git a/tools/make-font.cpp b/tools/make-font.cpp index 331dff49..bd0760f4 100644 --- a/tools/make-font.cpp +++ b/tools/make-font.cpp @@ -1,9 +1,17 @@ +// +// Deus Hax (working title) +// Copyright (c) 2010 Sam Hocevar +// -#include +#if defined HAVE_CONFIG_H +# include "config.h" +#endif #include #include +#include + int main(void) { caca_canvas_t *cv = caca_create_canvas(16, 16); @@ -17,7 +25,6 @@ int main(void) fwrite(buffer, len, 1, stdout); free(buffer); - /* Free everything */ caca_free_canvas(cv); return 0;