diff --git a/Video.cc b/AV.cc similarity index 91% rename from Video.cc rename to AV.cc index daadce7..20b0129 100644 --- a/Video.cc +++ b/AV.cc @@ -1,5 +1,5 @@ -#include "Video.h" +#include "AV.h" #include #include #include @@ -8,7 +8,7 @@ #include using namespace std; -static void Video_sound_callback(void * userdata, Uint8 * stream, int len) +static void AV_sound_callback(void * userdata, Uint8 * stream, int len) { static int pos = 0; Sint16 * str = (Sint16 *) stream; @@ -20,7 +20,7 @@ static void Video_sound_callback(void * userdata, Uint8 * stream, int len) } } -Video::Video() +AV::AV() { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) { @@ -51,7 +51,7 @@ Video::Video() desired.format = AUDIO_S16SYS; desired.channels = 2; desired.samples = 4096; - desired.callback = Video_sound_callback; + desired.callback = AV_sound_callback; desired.userdata = this; if (SDL_OpenAudio(&desired, NULL) < 0) { @@ -60,13 +60,13 @@ Video::Video() } } -Video::~Video() +AV::~AV() { Sound_Quit(); SDL_Quit(); } -void Video::start(int width, int height, bool fullscreen, bool grab_input, +void AV::start(int width, int height, bool fullscreen, bool grab_input, int samples) { if (m_surface == NULL) @@ -111,7 +111,7 @@ void Video::start(int width, int height, bool fullscreen, bool grab_input, } } -void Video::stop() +void AV::stop() { if (m_surface != NULL) { diff --git a/Video.h b/AV.h similarity index 96% rename from Video.h rename to AV.h index 35172cf..a1ab2c3 100644 --- a/Video.h +++ b/AV.h @@ -4,11 +4,11 @@ #include -class Video +class AV { public: - Video(); - ~Video(); + AV(); + ~AV(); void start(int width = 0, int height = 0, bool fullscreen = true, bool grab_input = true, int samples = 4); diff --git a/Engine.cc b/Engine.cc index 0117ac4..058c588 100644 --- a/Engine.cc +++ b/Engine.cc @@ -2,7 +2,7 @@ #include "ag.h" #include "anaglym.h" #include "Engine.h" -#include "Video.h" +#include "AV.h" #include "PhyObj/PhyObj.h" #include "sdl_keymap.h" #include @@ -85,8 +85,8 @@ static void checkGLErrorLine(const char * function, int line) /******** Engine functions ********/ -Engine::Engine(const string & path, Video & video) - : m_video(video) +Engine::Engine(const string & path, AV & av) + : m_av(av) { m_next_object_index = 1; m_next_joint_index = 1; @@ -108,10 +108,10 @@ Engine::Engine(const string & path, Video & video) m_fileLoader = new EngineFileLoader(this); m_event_time = 0; m_font = NULL; - m_engine_cursor_visible = m_video.getCursorVisible(); + m_engine_cursor_visible = m_av.getCursorVisible(); m_script_cursor_visible = false; - m_input_grabbed = m_video.getInputGrabbed(); - m_screen_dist = (m_video.getHeight() / 2.0) / tan(30.0 * M_PI / 180.0); + m_input_grabbed = m_av.getInputGrabbed(); + m_screen_dist = (m_av.getHeight() / 2.0) / tan(30.0 * M_PI / 180.0); size_t pos = path.find_last_of("\\/"); m_engine_path = (pos != string::npos) ? string(path, 0, pos) : "."; @@ -652,9 +652,9 @@ refptr< vector > Engine::pickObjects(int x, int y) cross_product(right, forward, up); dRFrom2Axes(r, right[0], right[1], right[2], forward[0], forward[1], forward[2]); - initial_direction[0] = x - m_video.getWidth() / 2; + initial_direction[0] = x - m_av.getWidth() / 2; initial_direction[1] = m_screen_dist; - initial_direction[2] = m_video.getHeight() / 2 - y; + initial_direction[2] = m_av.getHeight() / 2 - y; dMultiply0(rotated_direction, r, initial_direction, 3, 3, 1); normalize(rotated_direction); @@ -684,8 +684,8 @@ void Engine::debug_hook(lua_Debug * debug) void Engine::getScreenSize(int * width, int * height) { - *width = m_video.getWidth(); - *height = m_video.getHeight(); + *width = m_av.getWidth(); + *height = m_av.getHeight(); } void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b, @@ -877,13 +877,13 @@ void Engine::run() case SDLK_ESCAPE: goto RET; case SDLK_F1: - m_video.toggleFullScreen(); + m_av.toggleFullScreen(); break; case SDLK_F2: m_engine_cursor_visible = !m_engine_cursor_visible; m_input_grabbed = !m_input_grabbed; updateCursorVisibility(); - m_video.setInputGrabbed(m_input_grabbed); + m_av.setInputGrabbed(m_input_grabbed); break; case SDLK_F5: reloadProgram(); @@ -961,8 +961,8 @@ void Engine::update_overlay_event() glPushAttrib(GL_ENABLE_BIT); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); - int width = m_video.getWidth(); - int height = m_video.getHeight(); + int width = m_av.getWidth(); + int height = m_av.getHeight(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); diff --git a/Engine.h b/Engine.h index 3884074..2401346 100644 --- a/Engine.h +++ b/Engine.h @@ -10,7 +10,7 @@ #include "OdeWorld/OdeWorld.h" #include "TextureCache/TextureCache.h" #include "wfobj/WFObj.h" -#include "Video.h" +#include "AV.h" #include "refptr/refptr.h" #include "ftgl.h" #include "PhyObj/PhyObj.h" @@ -134,7 +134,7 @@ class Engine Engine * m_engine; }; - Engine(const std::string & path, Video & video); + Engine(const std::string & path, AV & av); ~Engine(); std::string locateResource(const std::string & shortname); @@ -245,11 +245,11 @@ class Engine void checkForAllHandlerFunctions(); void updateCursorVisibility() { - m_video.setCursorVisible( + m_av.setCursorVisible( m_engine_cursor_visible || m_script_cursor_visible); } - Video & m_video; + AV & m_av; bool m_engine_cursor_visible; bool m_script_cursor_visible; bool m_input_grabbed; diff --git a/ag.cc b/ag.cc index a6a57ba..a1d4359 100644 --- a/ag.cc +++ b/ag.cc @@ -3,7 +3,6 @@ #include "ag_lua.h" #include "anaglym.h" #include "Engine.h" -#include "Video.h" #include #include "wfobj/WFObj.h" #include /* usleep() */ diff --git a/anaglym.cc b/anaglym.cc index 620631b..febeb99 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -1,5 +1,5 @@ -#include "Video.h" +#include "AV.h" #include "anaglym.h" #include "Engine.h" #include "SDL.h" @@ -71,15 +71,15 @@ int main(int argc, char * argv[]) srand(time(NULL)); - Video video; - video.start(width, height, fullscreen, grab_input); + AV av; + av.start(width, height, fullscreen, grab_input); dInitODE(); - g_engine = new Engine(argv[0], video); + g_engine = new Engine(argv[0], av); if (g_engine->load(program)) g_engine->run(); delete g_engine; - video.stop(); + av.stop(); dCloseODE(); return 0;