mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
Timer implemented.
svn-id: r6667
This commit is contained in:
parent
738be5adeb
commit
a29fb89e53
@ -104,6 +104,10 @@ class OSystem_Dreamcast : public OSystem {
|
||||
int _screen_buffer, _overlay_buffer, _mouse_buffer;
|
||||
float _overlay_fade;
|
||||
|
||||
uint32 _timer_duration, _timer_next_expiry;
|
||||
bool _timer_active;
|
||||
int (*_timer_callback) (int);
|
||||
|
||||
unsigned char *screen;
|
||||
unsigned short *mouse;
|
||||
unsigned short *overlay;
|
||||
|
@ -122,10 +122,6 @@ void *OSystem_Dreamcast::create_thread(ThreadProc *proc, void *param) {
|
||||
warning("Creating a thread! (not supported.)\n");
|
||||
}
|
||||
|
||||
void OSystem_Dreamcast::set_timer(int timer, int (*callback)(int))
|
||||
{
|
||||
warning("Setting a timer! (not supported.)\n");
|
||||
}
|
||||
|
||||
/* Mutex handling */
|
||||
void *OSystem_Dreamcast::create_mutex(void)
|
||||
|
@ -140,6 +140,12 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
|
||||
bool OSystem_Dreamcast::poll_event(Event *event)
|
||||
{
|
||||
unsigned int t = Timer();
|
||||
|
||||
if(_timer_active && ((int)(t-_timer_next_expiry))>=0) {
|
||||
_timer_duration = _timer_callback(_timer_duration);
|
||||
_timer_next_expiry = t+USEC_TO_TIMER(1000*_timer_duration);
|
||||
}
|
||||
|
||||
if(((int)(t-_devpoll))<0)
|
||||
return false;
|
||||
_devpoll += USEC_TO_TIMER(17000);
|
||||
|
@ -53,6 +53,18 @@ void OSystem_Dreamcast::delay_msecs(uint msecs)
|
||||
get_msecs();
|
||||
}
|
||||
|
||||
void OSystem_Dreamcast::set_timer(int timer, int (*callback)(int))
|
||||
{
|
||||
if (callback != NULL) {
|
||||
_timer_duration = timer;
|
||||
_timer_next_expiry = Timer() + USEC_TO_TIMER(1000*timer);
|
||||
_timer_callback = callback;
|
||||
_timer_active = true;
|
||||
} else {
|
||||
_timer_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void waitForTimer(Scumm *s, int time)
|
||||
|
Loading…
Reference in New Issue
Block a user