forked from Cpasjuste/uae4all2
-
Notifications
You must be signed in to change notification settings - Fork 10
/
menu.cpp
executable file
·751 lines (653 loc) · 16.3 KB
/
menu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "sysconfig.h"
#include "sysdeps.h"
#include "config.h"
#include "menu.h"
#include <SDL.h>
#include <SDL_image.h>
#include "uae.h"
#include "options.h"
#include "zfile.h"
#include "sound.h"
#include <png.h>
#include "fade.h"
#include "xwin.h"
#include <SDL_gp2x.h>
extern int bReloadKickstart;
#ifdef USE_GUICHAN
extern int mainMenu_displayHires;
extern int visibleAreaWidth;
extern int mainMenu_displayedLines;
#endif
SDL_Surface *current_screenshot = NULL;
#define VIDEO_FLAGS_INIT SDL_SWSURFACE|SDL_FULLSCREEN
#ifdef ANDROIDSDL
#define VIDEO_FLAGS VIDEO_FLAGS_INIT
#else
#define VIDEO_FLAGS VIDEO_FLAGS_INIT | SDL_DOUBLEBUF
#endif
SDL_Surface *text_screen=NULL, *text_image, *text_background, *text_window_background, *window_screen;
static Uint32 menu_inv_color=0, menu_win0_color=0, menu_win1_color=0;
static Uint32 menu_barra0_color=0, menu_barra1_color=0;
static Uint32 menu_win0_color_base=0, menu_win1_color_base=0;
void write_text_pos(int x, int y, char * str);
void write_num(int x, int y, int v);
int menu_msg_pos=330;
int menu_moving=1;
Uint32 menu_msg_time=0x12345678;
int skipintro=1;
int kickstart_warning=0;
static void obten_colores(void)
{
FILE *f=fopen(DATA_PREFIX "colors.txt", "rt");
if (f)
{
Uint32 r,g,b;
fscanf(f,"menu_inv_color=0x%X,0x%X,0x%X\n",&r,&g,&b);
menu_inv_color=SDL_MapRGB(text_screen->format,r,g,b);
fscanf(f,"menu_win0_color=0x%X,0x%X,0x%X\n",&r,&g,&b);
menu_win0_color=SDL_MapRGB(text_screen->format,r,g,b);
fscanf(f,"menu_win1_color=0x%X,0x%X,0x%X\n",&r,&g,&b);
menu_win1_color=SDL_MapRGB(text_screen->format,r,g,b);
fscanf(f,"menu_barra0_color=0x%X,0x%X,0x%X\n",&r,&g,&b);
menu_barra0_color=SDL_MapRGB(text_screen->format,r,g,b);
fscanf(f,"menu_barra1_color=0x%X,0x%X,0x%X\n",&r,&g,&b);
menu_barra1_color=SDL_MapRGB(text_screen->format,r,g,b);
fclose(f);
}
else
{
menu_inv_color=SDL_MapRGB(text_screen->format, 0x20, 0x20, 0x40);
menu_win0_color=SDL_MapRGB(text_screen->format, 0x10, 0x08, 0x08);
menu_win1_color=SDL_MapRGB(text_screen->format, 0x20, 0x10, 0x10);
menu_barra0_color=SDL_MapRGB(text_screen->format, 0x30, 0x20, 0x20);
menu_barra1_color=SDL_MapRGB(text_screen->format, 0x50, 0x40, 0x40);
}
menu_win0_color_base=menu_win0_color;
menu_win1_color_base=menu_win1_color;
}
#define systemRedShift (prSDLScreen->format->Rshift)
#define systemGreenShift (prSDLScreen->format->Gshift)
#define systemBlueShift (prSDLScreen->format->Bshift)
#define systemRedMask (prSDLScreen->format->Rmask)
#define systemGreenMask (prSDLScreen->format->Gmask)
#define systemBlueMask (prSDLScreen->format->Bmask)
int save_png(SDL_Surface* surface,char *path)
{
int w = surface->w;
int h = surface->h;
unsigned char * pix = (unsigned char *)surface->pixels;
unsigned char writeBuffer[1024 * 3];
FILE *f = fopen(path,"wb");
if(!f) return 0;
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
NULL,
NULL,
NULL);
if(!png_ptr) {
fclose(f);
return 0;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if(!info_ptr) {
png_destroy_write_struct(&png_ptr,NULL);
fclose(f);
return 0;
}
png_init_io(png_ptr,f);
png_set_IHDR(png_ptr,
info_ptr,
w,
h,
8,
PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
png_write_info(png_ptr,info_ptr);
unsigned char *b = writeBuffer;
int sizeX = w;
int sizeY = h;
int y;
int x;
unsigned short *p = (unsigned short *)pix;
for(y = 0; y < sizeY; y++)
{
for(x = 0; x < sizeX; x++)
{
unsigned short v = p[x];
*b++ = ((v & systemRedMask ) >> systemRedShift ) << 3; // R
*b++ = ((v & systemGreenMask) >> systemGreenShift) << 2; // G
*b++ = ((v & systemBlueMask ) >> systemBlueShift ) << 3; // B
}
p += surface->pitch / 2;
png_write_row(png_ptr,writeBuffer);
b = writeBuffer;
}
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(f);
return 1;
}
void CreateScreenshot(int code)
{
int w, h;
if(current_screenshot != NULL)
{
SDL_FreeSurface(current_screenshot);
current_screenshot = NULL;
}
if (code == SCREENSHOT)
{
w=prSDLScreen->w;
h=prSDLScreen->h;
}
else
{
w=32;
h=32;
}
current_screenshot = SDL_CreateRGBSurface(prSDLScreen->flags,w,h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
SDL_BlitSurface(prSDLScreen, NULL, current_screenshot, NULL);
}
int save_thumb(int code,char *path)
{
// CreateScreenshot(code);
int ret = 0;
if(current_screenshot != NULL)
ret = save_png(current_screenshot, path);
return ret;
}
void menu_raise(void)
{
int i;
for(i=80;i>=0;i-=16)
{
#if !defined(NO_SOUND) && defined(MENU_MUSIC)
Mix_VolumeMusic(MUSIC_VOLUME-(i<<1));
#endif
text_draw_background();
fade16(text_screen,i);
text_flip();
SDL_Delay(10);
}
}
void menu_unraise(void)
{
int i;
for(i=0;i<=80;i+=16)
{
#if !defined(NO_SOUND) && defined(MENU_MUSIC)
Mix_VolumeMusic(MUSIC_VOLUME-(i<<1));
#endif
text_draw_background();
fade16(text_screen,i);
text_flip();
SDL_Delay(10);
}
}
static void update_window_color(void)
{
static int cambio=0;
static int spin=0;
Uint8 r,g,b;
int cambio2=cambio>>3;
SDL_GetRGB(menu_win0_color_base,text_screen->format,&r,&g,&b);
if (((int)r)-cambio2>0) r-=cambio2;
else r=0;
if (((int)g)-cambio2>0) g-=cambio2;
else g=0;
if (((int)b)-cambio2>0) b-=cambio2;
else b=0;
menu_win0_color=SDL_MapRGB(text_screen->format,r,g,b);
SDL_GetRGB(menu_win1_color_base,text_screen->format,&r,&g,&b);
if (((int)r)-cambio>0) r-=cambio;
else r=0;
if (((int)g)-cambio>0) g-=cambio;
else g=0;
if (((int)b)-cambio>0) b-=cambio;
else b=0;
menu_win1_color=SDL_MapRGB(text_screen->format,r,g,b);
if (spin)
{
if (cambio<=0) spin=0;
else cambio-=2;
}
else
{
if (cambio>=24) spin=1;
else cambio+=2;
}
}
void text_draw_background()
{
static int pos_x=12345678;
static int pos_y=12345678;
SDL_Rect r;
int i,j;
int w=text_screen->w+text_background->w-1;
int h=text_screen->h+text_background->h-1;
if (menu_moving)
{
if (pos_x>=0) pos_x=-text_screen->w;
else pos_x++;
if (pos_y>=0) pos_y=-text_screen->h;
else pos_y++;
}
for(i=pos_x;i<w;i+=text_background->w)
for(j=pos_y;j<h;j+=text_background->h)
{
r.x=i;
r.y=j;
r.w=text_background->w;
r.h=text_background->h;
SDL_BlitSurface(text_background,NULL,text_screen,&r);
}
if (menu_moving)
update_window_color();
}
void text_flip(void)
{
SDL_Delay(10);
SDL_BlitSurface(text_screen,NULL,prSDLScreen,NULL);
SDL_Flip(prSDLScreen);
}
void init_kickstart()
{
if (uae4all_init_rom(romfile))
{
#ifndef USE_GUICHAN
init_text(0);
text_draw_background();
text_draw_window(2, 6, 42, 12, "--- ERROR ---");
write_text(6, 12, "kickstart rom(s) not found!");
write_text(8, 14, "Press any button to exit");
text_flip();
SDL_Delay(333);
SDL_Event ev;
while(true) {
while (SDL_PollEvent(&ev)) {
switch (ev.type) {
case SDL_JOYBUTTONDOWN:
exit(0);
}
}
}
/*
while (SDL_PollEvent(&ev))
SDL_Delay(10);
while (!SDL_PollEvent(&ev))
SDL_Delay(10);
while (SDL_PollEvent(&ev))
if (ev.type == SDL_QUIT)
exit(1);
text_draw_background();
text_flip();
SDL_Delay(333);
*/
#endif
kickstart_warning=1;
}
else
{
kickstart_warning=0;
bReloadKickstart=1;
}
}
void init_text(int splash)
{
#ifdef __PSP2__
//Display menu always in 320*240 on Vita
if(prSDLScreen != NULL) {
SDL_FillRect(prSDLScreen,NULL,0);
SDL_Flip(prSDLScreen);
SDL_FreeSurface(prSDLScreen);
};
prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_DOUBLEBUF);
printf("init_text: SDL_SetVideoMode(%i, %i, 16)\n", 320, 240);
float sh = (float) 480;
float sw = (float)320*((float)480/(float)240);
int x = (960-sw)/2;
int y = (544-sh)/2;
SDL_SetVideoModeScaling(x, y, sw, sh);
printf("init_text: SDL_SetVideoModeScaling(%i, %i, %i, %i)\n", x, y, (int)sw, (int)sh);
//This requires a recent SDL-Vita branch SDL12 for example
//https://github.com/rsn8887/SDL-Vita/tree/SDL12
//to compile
SDL_SetVideoModeBilinear(0);
#elif PANDORA
setenv("SDL_OMAP_LAYER_SIZE","640x480",1);
setenv("SDL_OMAP_BORDER_CUT","0,0,0,30",1);
prSDLScreen = SDL_SetVideoMode(320, 270, 16, SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF);
#else
prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE|SDL_FULLSCREEN);
#endif
char fname[256];
SDL_Surface *tmp;
if (!text_screen)
{
text_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w,prSDLScreen->h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
window_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w,prSDLScreen->h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
tmp=SDL_LoadBMP(MENU_FILE_TEXT);
if (text_screen==NULL || tmp==NULL)
exit(-1);
text_image=SDL_DisplayFormat(tmp);
SDL_FreeSurface(tmp);
if (text_image==NULL)
exit(-2);
SDL_SetColorKey(text_image,(SDL_SRCCOLORKEY | SDL_RLEACCEL),SDL_MapRGB(text_image -> format, 0, 0, 0));
tmp=SDL_LoadBMP(MENU_FILE_BACKGROUND);
if (tmp==NULL)
exit(-3);
text_background=SDL_DisplayFormat(tmp);
SDL_FreeSurface(tmp);
if (text_background==NULL)
exit(-3);
tmp=SDL_LoadBMP(MENU_FILE_WINDOW);
if (tmp==NULL)
exit(-4);
SDL_Rect dest;
dest.w=32;
dest.h=24;
for (int y=0;y<10;y++)
{
//text_window_background
dest.y=24*y;
for(int x=0;x<10;x++)
{
dest.x=32*x;
SDL_BlitSurface(tmp,NULL,window_screen,&dest);
}
}
SDL_FreeSurface(tmp);
}
if (splash)
{
SDL_Surface *sur;
SDL_Rect r;
int i,j;
obten_colores();
if (skipintro)
goto skipintro;
tmp=SDL_LoadBMP(MENU_FILE_SPLASH);
if (tmp==NULL)
exit(-6);
sur = SDL_DisplayFormat(tmp);
SDL_FreeSurface(tmp);
r.x=(text_screen->w - sur->w)/2;
r.y=(text_screen->h - sur->h)/2;
r.h=sur->w;
r.w=sur->h;
SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
for (i=128;i>-8;i-=8)
{
SDL_Delay(50);
SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
SDL_BlitSurface(sur,NULL,text_screen,&r);
fade16(text_screen,i);
text_flip();
}
SDL_Delay(3000);
for(i=0;i<128;i+=16)
{
SDL_Delay(50);
SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
SDL_BlitSurface(sur,NULL,text_screen,&r);
fade16(text_screen,i);
text_flip();
}
for(i=128;i>-8;i-=8)
{
SDL_Delay(50);
text_draw_background();
fade16(text_screen,i);
text_flip();
}
SDL_FreeSurface(sur);
}
else
{
SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
text_flip();
uae4all_resume_music();
}
skipintro:
menu_msg_time=SDL_GetTicks();
}
void quit_text(void)
{
SDL_FreeSurface(text_image);
text_image = NULL;
SDL_FreeSurface(text_background);
text_background = NULL;
SDL_FreeSurface(text_window_background);
text_window_background = NULL;
SDL_FreeSurface(text_screen);
text_screen = NULL;
SDL_FreeSurface(window_screen);
window_screen = NULL;
}
void write_text_pos(int x, int y, char * str)
{
int i, c;
SDL_Rect src, dest;
for (i = 0; i < strlen(str); i++)
{
c = -1;
if (str[i] >= '0' && str[i] <= '9')
c = str[i] - '0';
else if (str[i] >= 'A' && str[i] <= 'Z')
c = str[i] - 'A' + 10;
else if (str[i] >= 'a' && str[i] <= 'z')
c = str[i] - 'a' + 36;
else if (str[i] == '#')
c = 62;
else if (str[i] == '=')
c = 63;
else if (str[i] == '.')
c = 64;
else if (str[i] == '_')
c = -2;
else if (str[i] == '-')
c = -3;
else if (str[i] == '(')
c = 65;
else if (str[i] == ')')
c = 66;
if (c >= 0)
{
src.x = c * 7;
src.y = 0;
src.w = 7;
src.h = 8;
dest.x = x + (i * 7);
dest.y = y;
dest.w = 7;
dest.h = 8;
SDL_BlitSurface(text_image, &src,
text_screen, &dest);
}
else if (c == -2 || c == -3)
{
dest.x = x + (i * 8);
if (c == -2)
dest.y = y + 7;
else if (c == -3)
dest.y = y + 3;
dest.w = 7;
dest.h = 1;
SDL_FillRect(text_screen, &dest, menu_barra0_color);
}
}
}
void write_text(int x, int y, const char * str)
{
int i, c;
SDL_Rect src, dest;
for (i = 0; i < strlen(str); i++)
{
c = -1;
if (str[i] >= '0' && str[i] <= '9')
c = str[i] - '0';
else if (str[i] >= 'A' && str[i] <= 'Z')
c = str[i] - 'A' + 10;
else if (str[i] >= 'a' && str[i] <= 'z')
c = str[i] - 'a' + 36;
else if (str[i] == '#')
c = 62;
else if (str[i] == '=')
c = 63;
else if (str[i] == '.')
c = 64;
else if (str[i] == '_')
c = -2;
else if (str[i] == '-')
c = -3;
else if (str[i] == '(')
c = 65;
else if (str[i] == ')')
c = 66;
if (c >= 0)
{
src.x = c * 7;
src.y = 0;
src.w = 7;
src.h = 8;
dest.x = (x + i) * 7;
dest.y = y * 7; //10;
dest.w = 7;
dest.h = 8;
SDL_BlitSurface(text_image, &src,
text_screen, &dest);
}
else if (c == -2 || c == -3)
{
dest.x = (x + i) * 7;
if (c == -2)
dest.y = y * 7 /*10*/ + 7;
else if (c == -3)
dest.y = y * 7 /*10*/ + 3;
dest.w = 7;
dest.h = 1;
SDL_FillRect(text_screen, &dest, menu_barra0_color);
}
if (i>42)
break;
}
}
void write_text_inv(int x, int y, const char * str)
{
SDL_Rect dest;
dest.x = (x * 7) -2 ;
dest.y = (y * 7) /*10*/ - 2;
dest.w = (strlen(str) * 7) + 4;
dest.h = 12;
SDL_FillRect(text_screen, &dest, menu_inv_color);
write_text(x, y, str);
}
void write_centered_text(int y, char * str)
{
write_text(40 - (strlen(str) / 2), y/2, str);
}
void write_num(int x, int y, int v)
{
char str[24];
snprintf(str, 24, "%d", v);
write_text(x, y, str);
}
void write_num_inv(int x, int y, int v)
{
SDL_Rect dest;
int i,l=1;
for(i=10;i<1000000;i*=10)
if (v/i)
l++;
else
break;
dest.x = (x * 7) -2 ;
dest.y = (y * 8) /*10*/ - 2;
dest.w = (l * 7) + 4;
dest.h = 12;
SDL_FillRect(text_screen, &dest, menu_inv_color);
write_num(x, y, v);
}
void text_draw_window(int x, int y, int w, int h, const char *title)
{
int i,j;
int x_screen = x * 7;
int y_screen = y * 8;
int x_corn = x_screen-2;
int y_corn = y_screen-12;
int w_corn = (w*7)+4;
int h_corn = (h*8)+4+12;
int x_shadow = x_corn+w_corn;
int y_shadow = y_corn+6;
int w_shadow = 10;
int h_shadow = h_corn+4;
int x_shadow_d = x_corn+5;
int y_shadow_d = y_corn+h_corn;
int w_shadow_d = w_corn-5;
int h_shadow_d = 10;
SDL_Rect dest;
dest.x = x_shadow;
dest.y = y_shadow;
dest.w = w_shadow;
dest.h = h_shadow;
SDL_FillRect(text_screen, &dest, menu_win0_color);
dest.x = x_shadow_d;
dest.y = y_shadow_d;
dest.w = w_shadow_d;
dest.h = h_shadow_d;
SDL_FillRect(text_screen, &dest, menu_win0_color);
dest.x = x_corn;
dest.y = y_corn;
dest.w = w_corn;
dest.h = h_corn;
SDL_FillRect(text_screen, &dest, menu_win1_color);
dest.x=x_screen;
dest.y=y_screen;
dest.w=w*7;
dest.h=h*8;
SDL_BlitSurface(window_screen,&dest,text_screen,&dest);
write_text(x + ((w-strlen(title)) / 2), y-1, title);
}
void _text_draw_window(SDL_Surface *sf, int x, int y, int w, int h, const char *title)
{
SDL_Surface *back=text_screen;
text_screen=sf;
text_draw_window(x,y,w,h,title);
text_screen=back;
}
void text_draw_barra(int x, int y, int w, int h, int per, int max)
{
SDL_Rect dest;
if (h>5)
h-=4;
dest.x=x-1;
dest.y=y-1;
dest.w=w+2;
dest.h=h+2;
SDL_FillRect(text_screen, &dest, menu_barra1_color);
if (per>max)
per=max;
dest.x=x;
dest.y=y;
dest.h=h;
dest.w=(w*per)/max;
SDL_FillRect(text_screen, &dest, menu_barra0_color);
}
void text_draw_window_bar(int x, int y, int w, int h, int per, int max, const char *title)
{
text_draw_window(x,y,w,h,title);
text_draw_barra(x+4, y+28, w-24, 12, per, max);
write_text((x/8)+4,(y/8)+1,"Please wait");
}
void _text_draw_window_bar(SDL_Surface *sf, int x, int y, int w, int h, int per, int max, const char *title)
{
SDL_Surface *back=text_screen;
text_screen=sf;
text_draw_window_bar(x,y,w,h,per,max,title);
text_screen=back;
}