Skip to content

Commit bd86e54

Browse files
committed
You can now turn the status bar off completely
1 parent df208cb commit bd86e54

12 files changed

+68
-5
lines changed

gui.c

+18-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,10 @@ SDL_bool gimg_load( struct guiimg *gi )
421421
// Draw the statusbar at the bottom
422422
void draw_statusbar( struct machine *oric )
423423
{
424-
oric->render_gimg( GIMG_STATUSBAR, 0, GIMG_POS_SBARY );
424+
if (oric->statusbar_mode == STATUSBARMODE_NONE)
425+
oric->render_clear_area( 0, GIMG_POS_SBARY, 640, 480-GIMG_POS_SBARY );
426+
else
427+
oric->render_gimg( GIMG_STATUSBAR, 0, GIMG_POS_SBARY );
425428
}
426429

427430
void draw_keyboard( struct machine *oric ) {
@@ -447,6 +450,9 @@ void draw_disks( struct machine *oric )
447450
{
448451
Sint32 i, j;
449452

453+
if( oric->statusbar_mode == STATUSBARMODE_NONE )
454+
return;
455+
450456
if( oric->drivetype == DRV_NONE )
451457
{
452458
oric->render_gimgpart( GIMG_STATUSBAR, GIMG_POS_DISKX, GIMG_POS_SBARY, GIMG_POS_DISKX, 0, 18*4, 16 );
@@ -468,6 +474,9 @@ void draw_disks( struct machine *oric )
468474
// Overlay the AVI record icon onto the status bar
469475
void draw_avirec( struct machine *oric, SDL_bool recording )
470476
{
477+
if( oric->statusbar_mode == STATUSBARMODE_NONE)
478+
return;
479+
471480
if( recording )
472481
{
473482
oric->render_gimg( GIMG_AVI_RECORD, GIMG_POS_AVIRECX, GIMG_POS_SBARY );
@@ -480,6 +489,9 @@ void draw_avirec( struct machine *oric, SDL_bool recording )
480489
// Overlay the tape icon onto the status bar
481490
void draw_tape( struct machine *oric )
482491
{
492+
if( oric->statusbar_mode == STATUSBARMODE_NONE )
493+
return;
494+
483495
if( oric->tapecap )
484496
{
485497
oric->render_gimg( GIMG_TAPE_RECORD, GIMG_POS_TAPEX, GIMG_POS_SBARY );
@@ -567,7 +579,7 @@ void render( struct machine *oric )
567579
case EM_RUNNING:
568580
oric->render_video( oric, SDL_TRUE );
569581
render_status( oric );
570-
if( oric->showfps )
582+
if( oric->statusbar_mode == STATUSBARMODE_FULL )
571583
{
572584
fps = 100000/(frametimeave?frametimeave:1);
573585
if( oric->vid_freq )
@@ -1944,6 +1956,7 @@ void set_render_mode( struct machine *oric, int whichrendermode )
19441956
oric->render_textzone_alloc = render_textzone_alloc_sw8;
19451957
oric->render_textzone_free = render_textzone_free_sw8;
19461958
oric->render_textzone = render_textzone_sw8;
1959+
oric->render_clear_area = render_clear_area_sw8;
19471960
oric->render_gimg = render_gimg_sw8;
19481961
oric->render_gimgpart = render_gimgpart_sw8;
19491962
oric->render_video = render_video_sw8;
@@ -1962,6 +1975,7 @@ void set_render_mode( struct machine *oric, int whichrendermode )
19621975
oric->render_textzone_alloc = render_textzone_alloc_sw;
19631976
oric->render_textzone_free = render_textzone_free_sw;
19641977
oric->render_textzone = render_textzone_sw;
1978+
oric->render_clear_area = render_clear_area_sw;
19651979
oric->render_gimg = render_gimg_sw;
19661980
oric->render_gimgpart = render_gimgpart_sw;
19671981
switch(oric->sw_depth)
@@ -1994,6 +2008,7 @@ void set_render_mode( struct machine *oric, int whichrendermode )
19942008
oric->render_textzone_alloc = render_textzone_alloc_gl;
19952009
oric->render_textzone_free = render_textzone_free_gl;
19962010
oric->render_textzone = render_textzone_gl;
2011+
oric->render_clear_area = render_clear_area_gl;
19972012
oric->render_gimg = render_gimg_gl;
19982013
oric->render_gimgpart = render_gimgpart_gl;
19992014
oric->render_video = render_video_gl;
@@ -2014,6 +2029,7 @@ void set_render_mode( struct machine *oric, int whichrendermode )
20142029
oric->render_textzone_alloc = render_textzone_alloc_null;
20152030
oric->render_textzone_free = render_textzone_free_null;
20162031
oric->render_textzone = render_textzone_null;
2032+
oric->render_clear_area = render_clear_area_null;
20172033
oric->render_gimg = render_gimg_null;
20182034
oric->render_gimgpart = render_gimgpart_null;
20192035
oric->render_video = render_video_null;

gui.h

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ enum
4444
NUM_TZ
4545
};
4646

47+
enum
48+
{
49+
STATUSBARMODE_FULL = 0,
50+
STATUSBARMODE_NOFPS,
51+
STATUSBARMODE_NONE,
52+
STATUSBARMODE_LAST
53+
};
54+
4755
struct textzone
4856
{
4957
int x, y, w, h; // Dimensions

machine.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ void preinit_machine( struct machine *oric )
889889
oric->prclose = 0;
890890
oric->lasttapefile[0] = 0;
891891
oric->keymap = KMAP_QWERTY;
892-
oric->showfps = SDL_TRUE;
892+
oric->statusbar_mode = STATUSBARMODE_FULL;
893893
oric->popupstr[0] = 0;
894894
oric->newpopupstr = SDL_FALSE;
895895
oric->popuptime = 0;
@@ -1092,7 +1092,7 @@ SDL_bool emu_event( SDL_Event *ev, struct machine *oric, SDL_bool *needrender )
10921092
break;
10931093

10941094
case SDLK_F5:
1095-
oric->showfps = oric->showfps ? SDL_FALSE : SDL_TRUE;
1095+
oric->statusbar_mode = (oric->statusbar_mode+1) % STATUSBARMODE_LAST;
10961096
refreshstatus = SDL_TRUE;
10971097
oric->statusstr[0] = 0;
10981098
oric->newstatusstr = SDL_TRUE;

machine.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct machine
207207
void (*render_textzone_alloc)(struct machine *, int);
208208
void (*render_textzone_free)(struct machine *, int);
209209
void (*render_textzone)(struct machine *, int);
210+
void (*render_clear_area)( int, int, int, int );
210211
void (*render_gimg)(int, Sint32, Sint32);
211212
void (*render_gimgpart)(int, Sint32, Sint32, Sint32, Sint32, Sint32, Sint32);
212213
void (*render_alloc_textzone)(struct machine *, struct textzone *);
@@ -223,7 +224,7 @@ struct machine
223224
char statusstr[40];
224225
SDL_bool newstatusstr;
225226

226-
SDL_bool showfps;
227+
int statusbar_mode;
227228

228229
int rampattern;
229230

render_gl.c

+4
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ void render_textzone_gl( struct machine *oric, int i )
349349
glEnd();
350350
}
351351

352+
void render_clear_area_gl( int x, int y, int w, int h )
353+
{
354+
}
355+
352356
void render_gimg_gl( int i, Sint32 xp, Sint32 yp )
353357
{
354358
glBindTexture( GL_TEXTURE_2D, tex[i+TEX_GIMG] );

render_gl.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void render_end_gl( struct machine *oric );
2626
void render_textzone_alloc_gl( struct machine *oric, int i );
2727
void render_textzone_free_gl( struct machine *oric, int i );
2828
void render_textzone_gl( struct machine *oric, int i );
29+
void render_clear_area_gl( int x, int y, int w, int h );
2930
void render_gimg_gl( int i, Sint32 xp, Sint32 yp );
3031
void render_gimgpart_gl( int i, Sint32 xp, Sint32 yp, Sint32 ox, Sint32 oy, Sint32 w, Sint32 h );
3132
void render_video_gl( struct machine *oric, SDL_bool doublesize );

render_null.c

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ void render_textzone_null( struct machine *oric, int i )
5050
{
5151
}
5252

53+
void render_clear_area_null( int x, int y, int w, int h )
54+
{
55+
}
56+
5357
void render_gimg_null( int i, Sint32 xp, Sint32 yp )
5458
{
5559
}

render_null.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ void render_end_null( struct machine *oric );
2424
void render_textzone_alloc_null( struct machine *oric, int i );
2525
void render_textzone_free_null( struct machine *oric, int i );
2626
void render_textzone_null( struct machine *oric, int i );
27+
void render_clear_area_null( int x, int y, int w, int h );
2728
void render_gimg_null( int i, Sint32 xp, Sint32 yp );
2829
void render_gimgpart_null( int i, Sint32 xp, Sint32 yp, Sint32 ox, Sint32 oy, Sint32 w, Sint32 h );
2930
void render_video_null( struct machine *oric, SDL_bool doublesize );

render_sw.c

+13
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,19 @@ void render_textzone_sw( struct machine *oric, int i )
208208

209209
}
210210

211+
// Clear an area to background
212+
void render_clear_area_sw( int x, int y, int w, int h )
213+
{
214+
Uint8 *dst_scanline;
215+
Sint32 i;
216+
217+
dst_scanline = (Uint8 *)screen->pixels;
218+
dst_scanline += screen->pitch * y + pixel_size * x;
219+
220+
for( i=0; i<h; i++, dst_scanline+=screen->pitch )
221+
memset( dst_scanline, 0, pixel_size*w );
222+
}
223+
211224
// Draw a GUI image at X,Y
212225
void render_gimg_sw( int img_id, Sint32 xp, Sint32 yp )
213226
{

render_sw.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void render_gimg_sw( int i, Sint32 xp, Sint32 yp );
2828
void render_gimgpart_sw( int i, Sint32 xp, Sint32 yp, Sint32 ox, Sint32 oy, Sint32 w, Sint32 h );
2929
void render_video_sw_16bpp( struct machine *oric, SDL_bool doublesize );
3030
void render_video_sw_32bpp( struct machine *oric, SDL_bool doublesize );
31+
void render_clear_area_sw( int x, int y, int w, int h );
3132
SDL_bool render_togglefullscreen_sw( struct machine *oric );
3233
void preinit_render_sw( struct machine *oric );
3334
SDL_bool init_render_sw( struct machine *oric );

render_sw8.c

+13
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,19 @@ void render_textzone_sw8( struct machine *oric, int i )
179179
}
180180
}
181181

182+
// Clear an area to background
183+
void render_clear_area_sw8( int x, int y, int w, int h )
184+
{
185+
Uint8 *dst_scanline;
186+
Sint32 i;
187+
188+
dst_scanline = (Uint8 *)screen->pixels;
189+
dst_scanline += screen->pitch * y + x;
190+
191+
for( i=0; i<h; i++, dst_scanline+=screen->pitch )
192+
memset( dst_scanline, 0, w );
193+
}
194+
182195
// Draw a GUI image at X,Y
183196
void render_gimg_sw8( int img_id, Sint32 xp, Sint32 yp )
184197
{

render_sw8.h

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ void render_textzone_sw8( struct machine *oric, int i );
2727
void render_gimg_sw8( int i, Sint32 xp, Sint32 yp );
2828
void render_gimgpart_sw8( int i, Sint32 xp, Sint32 yp, Sint32 ox, Sint32 oy, Sint32 w, Sint32 h );
2929
void render_video_sw8( struct machine *oric, SDL_bool doublesize );
30+
void render_clear_area_sw8( int x, int y, int w, int h );
3031
SDL_bool render_togglefullscreen_sw8( struct machine *oric );
3132
void preinit_render_sw8( struct machine *oric );
3233
SDL_bool init_render_sw8( struct machine *oric );

0 commit comments

Comments
 (0)