| @@ -9,13 +9,14 @@ libcommon_a_SOURCES = \ | |||||
| joystick.cpp joystick.h asset.cpp asset.h ticker.cpp ticker.h \ | joystick.cpp joystick.h asset.cpp asset.h ticker.cpp ticker.h \ | ||||
| forge.cpp forge.h video.cpp video.h timer.cpp timer.h \ | forge.cpp forge.h video.cpp video.h timer.cpp timer.h \ | ||||
| profiler.cpp profiler.h \ | profiler.cpp profiler.h \ | ||||
| debugfps.cpp debugfps.h debugsprite.cpp debugsprite.h | |||||
| debugfps.cpp debugfps.h debugsprite.cpp debugsprite.h \ | |||||
| debugrecord.cpp debugrecord.h | |||||
| libcommon_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` | libcommon_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` | ||||
| test_map_SOURCES = test-map.cpp sdlinput.cpp sdlinput.h | test_map_SOURCES = test-map.cpp sdlinput.cpp sdlinput.h | ||||
| test_map_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` | test_map_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` | ||||
| test_map_LDADD = libcommon.a | test_map_LDADD = libcommon.a | ||||
| test_map_LDFLAGS = `pkg-config --libs sdl gl SDL_image` | |||||
| test_map_LDFLAGS = `pkg-config --libs sdl gl SDL_image` -lpipi | |||||
| editor_SOURCES = gtk/editor.cpp | editor_SOURCES = gtk/editor.cpp | ||||
| editor_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image gtk+-2.0 gtkgl-2.0` | editor_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image gtk+-2.0 gtkgl-2.0` | ||||
| @@ -0,0 +1,86 @@ | |||||
| // | |||||
| // Deus Hax (working title) | |||||
| // Copyright (c) 2010 Sam Hocevar <sam@hocevar.net> | |||||
| // | |||||
| #if defined HAVE_CONFIG_H | |||||
| # include "config.h" | |||||
| #endif | |||||
| #include <cstdio> | |||||
| #include <cstring> | |||||
| #include <pipi.h> | |||||
| #include "debugrecord.h" | |||||
| #include "video.h" | |||||
| /* | |||||
| * DebugRecord implementation class | |||||
| */ | |||||
| class DebugRecordData | |||||
| { | |||||
| friend class DebugRecord; | |||||
| private: | |||||
| char const *path; | |||||
| int width, height; | |||||
| pipi_sequence_t *sequence; | |||||
| }; | |||||
| /* | |||||
| * Public DebugRecord class | |||||
| */ | |||||
| DebugRecord::DebugRecord(char const *path) | |||||
| { | |||||
| data = new DebugRecordData(); | |||||
| data->path = strdup(path); | |||||
| data->width = 0; | |||||
| data->height = 0; | |||||
| data->sequence = NULL; | |||||
| } | |||||
| Asset::Group DebugRecord::GetGroup() | |||||
| { | |||||
| return GROUP_RENDER_CAPTURE; | |||||
| } | |||||
| void DebugRecord::TickGame(float delta_time) | |||||
| { | |||||
| Asset::TickGame(delta_time); | |||||
| } | |||||
| void DebugRecord::TickRender(float delta_time) | |||||
| { | |||||
| Asset::TickRender(delta_time); | |||||
| int width = Video::GetWidth(); | |||||
| int height = Video::GetHeight(); | |||||
| if (data->width != width || data->height != height) | |||||
| { | |||||
| data->width = width; | |||||
| data->height = height; | |||||
| if (data->sequence) | |||||
| pipi_close_sequence(data->sequence); | |||||
| data->sequence = pipi_open_sequence(data->path, width, height, 30); | |||||
| } | |||||
| if (data->sequence) | |||||
| { | |||||
| uint32_t *buffer = new uint32_t[width * height]; | |||||
| Video::Capture(buffer); | |||||
| pipi_feed_sequence(data->sequence, (uint8_t *)buffer, width, height); | |||||
| delete[] buffer; | |||||
| } | |||||
| } | |||||
| DebugRecord::~DebugRecord() | |||||
| { | |||||
| delete data; | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| // | |||||
| // Deus Hax (working title) | |||||
| // Copyright (c) 2010 Sam Hocevar <sam@hocevar.net> | |||||
| // | |||||
| // | |||||
| // The DebugRecord class | |||||
| // --------------------- | |||||
| // | |||||
| #if !defined __DH_DEBUGRECORD_H__ | |||||
| #define __DH_DEBUGRECORD_H__ | |||||
| #include "asset.h" | |||||
| class DebugRecordData; | |||||
| class DebugRecord : public Asset | |||||
| { | |||||
| public: | |||||
| DebugRecord(char const *path); | |||||
| virtual ~DebugRecord(); | |||||
| protected: | |||||
| virtual Group GetGroup(); | |||||
| virtual void TickGame(float delta_time); | |||||
| virtual void TickRender(float delta_time); | |||||
| private: | |||||
| DebugRecordData *data; | |||||
| }; | |||||
| #endif // __DH_DEBUGRECORD_H__ | |||||
| @@ -90,8 +90,8 @@ void Scene::Render() // XXX: rename to Blit() | |||||
| static float f = 0.0f; | static float f = 0.0f; | ||||
| f += 0.05f; | f += 0.05f; | ||||
| glTranslatef(320.0f, 240.0f, 0.0f); | glTranslatef(320.0f, 240.0f, 0.0f); | ||||
| glRotatef(45.0f, 1.0f, 0.0f, 0.0f); | |||||
| glRotatef(30.0f * sinf(f), 0.0f, 0.0f, 1.0f); | |||||
| glRotatef(50.0f + 3.0f * sinf(f), 1.0f, 0.0f, 0.0f); | |||||
| glRotatef(20.0f * cosf(f), 0.0f, 0.0f, 1.0f); | |||||
| //glRotatef(30.0f, 0.0f, 0.0f, 1.0f); | //glRotatef(30.0f, 0.0f, 0.0f, 1.0f); | ||||
| glTranslatef(-320.0f, -240.0f, 0.0f); | glTranslatef(-320.0f, -240.0f, 0.0f); | ||||
| @@ -15,6 +15,7 @@ | |||||
| #include "sdlinput.h" | #include "sdlinput.h" | ||||
| #include "debugfps.h" | #include "debugfps.h" | ||||
| #include "debugsprite.h" | #include "debugsprite.h" | ||||
| #include "debugrecord.h" | |||||
| #include "game.h" | #include "game.h" | ||||
| #include "ticker.h" | #include "ticker.h" | ||||
| #include "profiler.h" | #include "profiler.h" | ||||
| @@ -39,7 +40,7 @@ int main(int argc, char **argv) | |||||
| return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
| } | } | ||||
| SDL_WM_SetCaption("Deus Hax (SDL)", NULL); | |||||
| SDL_WM_SetCaption("Map Test (SDL)", NULL); | |||||
| SDL_ShowCursor(0); | SDL_ShowCursor(0); | ||||
| SDL_WM_GrabInput(SDL_GRAB_ON); | SDL_WM_GrabInput(SDL_GRAB_ON); | ||||
| @@ -53,6 +54,7 @@ int main(int argc, char **argv) | |||||
| new SdlInput(game); | new SdlInput(game); | ||||
| new DebugFps(); | new DebugFps(); | ||||
| new DebugSprite(game); | new DebugSprite(game); | ||||
| //new DebugRecord("movie.ogg"); | |||||
| while (!game->Finished()) | while (!game->Finished()) | ||||
| { | { | ||||