diff options
author | Max Horn | 2004-09-28 20:19:37 +0000 |
---|---|---|
committer | Max Horn | 2004-09-28 20:19:37 +0000 |
commit | ce8c99bf62838099142aa79f2935e64639aa5571 (patch) | |
tree | 5a2ea91139133878cdffab8ed86033fbf5448ea9 /backends/sdl | |
parent | 6a50ba2308c6a9fc3eb733f310c87ed279b565ed (diff) | |
download | scummvm-rg350-ce8c99bf62838099142aa79f2935e64639aa5571.tar.gz scummvm-rg350-ce8c99bf62838099142aa79f2935e64639aa5571.tar.bz2 scummvm-rg350-ce8c99bf62838099142aa79f2935e64639aa5571.zip |
Rename remaining OSystem methods to match our coding guidelines
svn-id: r15332
Diffstat (limited to 'backends/sdl')
-rw-r--r-- | backends/sdl/events.cpp | 146 | ||||
-rw-r--r-- | backends/sdl/graphics.cpp | 2 | ||||
-rw-r--r-- | backends/sdl/sdl-common.h | 16 | ||||
-rw-r--r-- | backends/sdl/sdl.cpp | 12 |
4 files changed, 88 insertions, 88 deletions
diff --git a/backends/sdl/events.cpp b/backends/sdl/events.cpp index e017b2dc77..48686908a7 100644 --- a/backends/sdl/events.cpp +++ b/backends/sdl/events.cpp @@ -88,7 +88,7 @@ void OSystem_SDL::fillMouseEvent(Event &event, int x, int y) { } void OSystem_SDL::kbd_mouse() { - uint32 curTime = get_msecs(); + uint32 curTime = getMillis(); if (curTime >= km.last_time + km.delay_time) { km.last_time = curTime; if (km.x_down_count == 1) { @@ -156,7 +156,7 @@ void OSystem_SDL::kbd_mouse() { } } -bool OSystem_SDL::poll_event(Event *event) { +bool OSystem_SDL::pollEvent(Event &event) { SDL_Event ev; int axis; byte b = 0; @@ -166,7 +166,7 @@ bool OSystem_SDL::poll_event(Event *event) { // If the screen mode changed, send an EVENT_SCREEN_CHANGED if (_modeChanged) { _modeChanged = false; - event->event_code = EVENT_SCREEN_CHANGED; + event.event_code = EVENT_SCREEN_CHANGED; return true; } @@ -188,7 +188,7 @@ bool OSystem_SDL::poll_event(Event *event) { if (ev.key.keysym.mod & KMOD_ALT) b |= KBD_ALT; #endif - event->kbd.flags = b; + event.kbd.flags = b; // Alt-Return and Alt-Enter toggle full screen mode if (b == KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN @@ -233,19 +233,19 @@ bool OSystem_SDL::poll_event(Event *event) { #ifdef MACOSX // On Macintosh', Cmd-Q quits if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') { - event->event_code = EVENT_QUIT; + event.event_code = EVENT_QUIT; return true; } #elif defined(UNIX) // On other unices, Control-Q quits if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') { - event->event_code = EVENT_QUIT; + event.event_code = EVENT_QUIT; return true; } #else // Ctrl-z and Alt-X quit if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) { - event->event_code = EVENT_QUIT; + event.event_code = EVENT_QUIT; return true; } #endif @@ -351,28 +351,28 @@ bool OSystem_SDL::poll_event(Event *event) { #ifdef LINUPY // On Yopy map the End button to quit if ((ev.key.keysym.sym==293)) { - event->event_code = EVENT_QUIT; + event.event_code = EVENT_QUIT; return true; } // Map menu key to f5 (scumm menu) if (ev.key.keysym.sym==306) { - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = SDLK_F5; - event->kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = SDLK_F5; + event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); return true; } // Map action key to action if (ev.key.keysym.sym==291) { - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = SDLK_TAB; - event->kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = SDLK_TAB; + event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); return true; } // Map OK key to skip cinematic if (ev.key.keysym.sym==292) { - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = SDLK_ESCAPE; - event->kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = SDLK_ESCAPE; + event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); return true; } #endif @@ -380,41 +380,41 @@ bool OSystem_SDL::poll_event(Event *event) { #ifdef QTOPIA // quit on fn+backspace on zaurus if (ev.key.keysym.sym == 127) { - event->event_code = EVENT_QUIT; + event.event_code = EVENT_QUIT; return true; } // map menu key (f11) to f5 (scumm menu) if (ev.key.keysym.sym == SDLK_F11) { - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = SDLK_F5; - event->kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = SDLK_F5; + event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); } // map center (space) to tab (default action ) // I wanted to map the calendar button but the calendar comes up // else if (ev.key.keysym.sym == SDLK_SPACE) { - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = SDLK_TAB; - event->kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = SDLK_TAB; + event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); } // since we stole space (pause) above we'll rebind it to the tab key on the keyboard else if (ev.key.keysym.sym == SDLK_TAB) { - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = SDLK_SPACE; - event->kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = SDLK_SPACE; + event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); } else { // let the events fall through if we didn't change them, this may not be the best way to // set it up, but i'm not sure how sdl would like it if we let if fall through then redid it though. // and yes i have an huge terminal size so i dont wrap soon enough. - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = ev.key.keysym.sym; - event->kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = ev.key.keysym.sym; + event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); } #else - event->event_code = EVENT_KEYDOWN; - event->kbd.keycode = ev.key.keysym.sym; - event->kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); + event.event_code = EVENT_KEYDOWN; + event.kbd.keycode = ev.key.keysym.sym; + event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); #endif switch(ev.key.keysym.sym) { @@ -441,9 +441,9 @@ bool OSystem_SDL::poll_event(Event *event) { return true; case SDL_KEYUP: - event->event_code = EVENT_KEYUP; - event->kbd.keycode = ev.key.keysym.sym; - event->kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); + event.event_code = EVENT_KEYUP; + event.kbd.keycode = ev.key.keysym.sym; + event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); switch(ev.key.keysym.sym) { case SDLK_LEFT: @@ -476,64 +476,64 @@ bool OSystem_SDL::poll_event(Event *event) { return true; case SDL_MOUSEMOTION: - event->event_code = EVENT_MOUSEMOVE; - fillMouseEvent(*event, ev.motion.x, ev.motion.y); + event.event_code = EVENT_MOUSEMOVE; + fillMouseEvent(event, ev.motion.x, ev.motion.y); - set_mouse_pos(event->mouse.x, event->mouse.y); + set_mouse_pos(event.mouse.x, event.mouse.y); return true; case SDL_MOUSEBUTTONDOWN: if (ev.button.button == SDL_BUTTON_LEFT) - event->event_code = EVENT_LBUTTONDOWN; + event.event_code = EVENT_LBUTTONDOWN; else if (ev.button.button == SDL_BUTTON_RIGHT) - event->event_code = EVENT_RBUTTONDOWN; + event.event_code = EVENT_RBUTTONDOWN; #if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN) else if (ev.button.button == SDL_BUTTON_WHEELUP) - event->event_code = EVENT_WHEELUP; + event.event_code = EVENT_WHEELUP; else if (ev.button.button == SDL_BUTTON_WHEELDOWN) - event->event_code = EVENT_WHEELDOWN; + event.event_code = EVENT_WHEELDOWN; #endif else break; - fillMouseEvent(*event, ev.button.x, ev.button.y); + fillMouseEvent(event, ev.button.x, ev.button.y); return true; case SDL_MOUSEBUTTONUP: if (ev.button.button == SDL_BUTTON_LEFT) - event->event_code = EVENT_LBUTTONUP; + event.event_code = EVENT_LBUTTONUP; else if (ev.button.button == SDL_BUTTON_RIGHT) - event->event_code = EVENT_RBUTTONUP; + event.event_code = EVENT_RBUTTONUP; else break; - fillMouseEvent(*event, ev.button.x, ev.button.y); + fillMouseEvent(event, ev.button.x, ev.button.y); return true; case SDL_JOYBUTTONDOWN: if (ev.jbutton.button == JOY_BUT_LMOUSE) { - event->event_code = EVENT_LBUTTONDOWN; + event.event_code = EVENT_LBUTTONDOWN; } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { - event->event_code = EVENT_RBUTTONDOWN; + event.event_code = EVENT_RBUTTONDOWN; } else { - event->event_code = EVENT_KEYDOWN; + event.event_code = EVENT_KEYDOWN; switch (ev.jbutton.button) { case JOY_BUT_ESCAPE: - event->kbd.keycode = SDLK_ESCAPE; - event->kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_ESCAPE; + event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); break; case JOY_BUT_PERIOD: - event->kbd.keycode = SDLK_PERIOD; - event->kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_PERIOD; + event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); break; case JOY_BUT_SPACE: - event->kbd.keycode = SDLK_SPACE; - event->kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_SPACE; + event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); break; case JOY_BUT_F5: - event->kbd.keycode = SDLK_F5; - event->kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_F5; + event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); break; } } @@ -541,27 +541,27 @@ bool OSystem_SDL::poll_event(Event *event) { case SDL_JOYBUTTONUP: if (ev.jbutton.button == JOY_BUT_LMOUSE) { - event->event_code = EVENT_LBUTTONUP; + event.event_code = EVENT_LBUTTONUP; } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { - event->event_code = EVENT_RBUTTONUP; + event.event_code = EVENT_RBUTTONUP; } else { - event->event_code = EVENT_KEYUP; + event.event_code = EVENT_KEYUP; switch (ev.jbutton.button) { case JOY_BUT_ESCAPE: - event->kbd.keycode = SDLK_ESCAPE; - event->kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_ESCAPE; + event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); break; case JOY_BUT_PERIOD: - event->kbd.keycode = SDLK_PERIOD; - event->kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_PERIOD; + event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); break; case JOY_BUT_SPACE: - event->kbd.keycode = SDLK_SPACE; - event->kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_SPACE; + event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); break; case JOY_BUT_F5: - event->kbd.keycode = SDLK_F5; - event->kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.kbd.keycode = SDLK_F5; + event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); break; } } @@ -571,10 +571,10 @@ bool OSystem_SDL::poll_event(Event *event) { axis = ev.jaxis.value; if ( axis > JOY_DEADZONE) { axis -= JOY_DEADZONE; - event->event_code = EVENT_MOUSEMOVE; + event.event_code = EVENT_MOUSEMOVE; } else if ( axis < -JOY_DEADZONE ) { axis += JOY_DEADZONE; - event->event_code = EVENT_MOUSEMOVE; + event.event_code = EVENT_MOUSEMOVE; } else axis = 0; @@ -610,7 +610,7 @@ bool OSystem_SDL::poll_event(Event *event) { #endif } - fillMouseEvent(*event, km.x, km.y); + fillMouseEvent(event, km.x, km.y); return true; @@ -619,7 +619,7 @@ bool OSystem_SDL::poll_event(Event *event) { break; case SDL_QUIT: - event->event_code = EVENT_QUIT; + event.event_code = EVENT_QUIT; return true; } } diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp index 89958d6440..af817ddd78 100644 --- a/backends/sdl/graphics.cpp +++ b/backends/sdl/graphics.cpp @@ -720,7 +720,7 @@ void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) { _paletteDirtyEnd = start + num; } -void OSystem_SDL::set_shake_pos(int shake_pos) { +void OSystem_SDL::setShakePos(int shake_pos) { _newShakePos = shake_pos; } diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index 3c1e600eaa..6ccaf26a07 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -67,17 +67,17 @@ public: void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor); // Shaking is used in SCUMM. Set current shake position. - void set_shake_pos(int shake_pos); + void setShakePos(int shake_pos); // Get the number of milliseconds since the program was started. - uint32 get_msecs(); + uint32 getMillis(); // Delay for a specified amount of milliseconds - void delay_msecs(uint msecs); + void delayMillis(uint msecs); // Get the next event. // Returns true if an event was retrieved. - bool poll_event(Event *event); + bool pollEvent(Event &event); // Set function that generates samples bool setSoundCallback(SoundProc proc, void *param); @@ -86,16 +86,16 @@ public: // Poll CD status // Returns true if cd audio is playing - bool poll_cdrom(); + bool pollCD(); // Play CD audio track - void play_cdrom(int track, int num_loops, int start_frame, int duration); + void playCD(int track, int num_loops, int start_frame, int duration); // Stop CD audio track - void stop_cdrom(); + void stopCD(); // Update CD audio status - void update_cdrom(); + void updateCD(); // Quit void quit(); diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index c7292ad554..f6ad91b452 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -128,11 +128,11 @@ OSystem_SDL::~OSystem_SDL() { SDL_Quit(); } -uint32 OSystem_SDL::get_msecs() { +uint32 OSystem_SDL::getMillis() { return SDL_GetTicks(); } -void OSystem_SDL::delay_msecs(uint msecs) { +void OSystem_SDL::delayMillis(uint msecs) { SDL_Delay(msecs); } @@ -343,12 +343,12 @@ bool OSystem_SDL::openCD(int drive) { return (_cdrom != NULL); } -void OSystem_SDL::stop_cdrom() { /* Stop CD Audio in 1/10th of a second */ +void OSystem_SDL::stopCD() { /* Stop CD Audio in 1/10th of a second */ cd_stop_time = SDL_GetTicks() + 100; cd_num_loops = 0; } -void OSystem_SDL::play_cdrom(int track, int num_loops, int start_frame, int duration) { +void OSystem_SDL::playCD(int track, int num_loops, int start_frame, int duration) { if (!num_loops && !start_frame) return; @@ -372,14 +372,14 @@ void OSystem_SDL::play_cdrom(int track, int num_loops, int start_frame, int dura cd_end_time = SDL_GetTicks() + _cdrom->track[track].length * 1000 / CD_FPS; } -bool OSystem_SDL::poll_cdrom() { +bool OSystem_SDL::pollCD() { if (!_cdrom) return false; return (cd_num_loops != 0 && (SDL_GetTicks() < cd_end_time || SDL_CDStatus(_cdrom) != CD_STOPPED)); } -void OSystem_SDL::update_cdrom() { +void OSystem_SDL::updateCD() { if (!_cdrom) return; |