Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Commit

Permalink
Rerender frequently via extra ever-present event
Browse files Browse the repository at this point in the history
This method has a small, but definite, performance impact.
The performance should be evaluated before this gets merged.

Consideration: This could be #ifdef'd for steam, but some people
might run non-steam games via steam and expect the overlay work
well which would be a paint for making it the default, not an ifdef
  • Loading branch information
euank committed Mar 20, 2014
1 parent 6f3e618 commit 19c4b8e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/PonscripterLabel_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
#define ONS_WAVE_EVENT (SDL_USEREVENT + 4)
#define ONS_MUSIC_EVENT (SDL_USEREVENT + 5)

#define INTERNAL_REDRAW_EVENT (SDL_USEREVENT + 6)

// This sets up the fadeout event flag for use in mp3 fadeout. Recommend for integration. [Seung Park, 20060621]
#define ONS_FADE_EVENT (SDL_USEREVENT + 6)
#define ONS_FADE_EVENT (SDL_USEREVENT + 7)

#define EDIT_MODE_PREFIX "[EDIT MODE] "
#define EDIT_SELECT_STRING "MP3 vol (m) SE vol (s) Voice vol (v) Numeric variable (n)"
Expand Down Expand Up @@ -92,7 +94,6 @@ extern "C" Uint32 SDLCALL timerCallback(Uint32 interval, void* param)
return interval;
}


extern "C" Uint32 cdaudioCallback(Uint32 interval, void* param)
{
SDL_RemoveTimer(timer_cdaudio_id);
Expand Down Expand Up @@ -1150,6 +1151,10 @@ int PonscripterLabel::eventLoop()
{
SDL_Event event, tmp_event;

SDL_Event redraw_event;
redraw_event.type = INTERNAL_REDRAW_EVENT;
SDL_PushEvent(&redraw_event);

advancePhase();

while (SDL_WaitEvent(&event)) {
Expand Down Expand Up @@ -1235,6 +1240,13 @@ int PonscripterLabel::eventLoop()
flushEventSub(event);
break;

case INTERNAL_REDRAW_EVENT:
rerender();
SDL_Event event;
event.type = INTERNAL_REDRAW_EVENT;
SDL_PushEvent(&event);
break;

case ONS_WAVE_EVENT:
flushEventSub(event);
//printf("ONS_WAVE_EVENT %d: %x %d %x\n", event.user.code, wave_sample[0], automode_flag, event_mode);
Expand Down

0 comments on commit 19c4b8e

Please sign in to comment.