Compilation with SDL2 (to be finalized) > API=sdl2 make

This commit is contained in:
Thomas Bernard 2018-05-28 17:00:46 +02:00
parent 5c761ace2c
commit d86efa58e4
9 changed files with 236 additions and 19 deletions

View File

@ -457,17 +457,31 @@ endif
else
# Compiles a regular linux executable for the native platform
BIN = ../bin/grafx2
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -g $(shell sdl-config --cflags) $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM)
BIN = ../bin/grafx2-$(API)
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -g
ifeq ($(API),sdl)
COPT += $(shell sdl-config --cflags)
endif
ifeq ($(API),sdl2)
COPT += $(shell sdl2-config --cflags)
endif
COPT += $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM)
COPT += $(shell pkg-config --cflags libpng)
ifneq ($(PLATFORM), FreeBSD)
COPT += -D_XOPEN_SOURCE=700
endif
LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT)
LOPT = -lm
ifeq ($(API),sdl)
LOPT += $(shell sdl-config --libs) -lSDL_image
endif
ifeq ($(API),sdl2)
LOPT += $(shell sdl2-config --libs) -lSDL2_image
endif
LOPT += $(TTFLOPT)
LOPT += $(shell pkg-config --libs libpng)
LOPT += $(LUALOPT) -lm
LOPT += $(LUALOPT)
OBJDIR = ../obj/unix
FCLOPT = -lfontconfig
COPT += -DUSE_FC
@ -549,7 +563,7 @@ ifeq ($(API),sdl)
COPT += -DUSE_SDL
endif
ifeq ($(API),sdl2)
#APIOBJ = sdlscreen.o
APIOBJ = sdlscreen.o
COPT += -DUSE_SDL2
endif

View File

@ -452,7 +452,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"Around. What gets out from a side",
"reappears on the other.",
true,
#if defined(USE_SDL)
SDLK_KP5, // Kpad5
#else
SDLK_KP_5, // Kpad5
#endif
0},
{48,
"Picture effects",
@ -460,7 +464,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"",
"",
true,
#if defined(USE_SDL)
SDLK_KP5|MOD_SHIFT, // Shift + Kpad5
#else
SDLK_KP_5|MOD_SHIFT, // Shift + Kpad5
#endif
0},
{49,
"Drawing effects",
@ -1100,7 +1108,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"user-defined brush to its center.",
"",
true,
#if defined(USE_SDL)
SDLK_KP5|MOD_CTRL, // Ctrl + 5 (pavé numérique)
#else
SDLK_KP_5|MOD_CTRL, // Ctrl + 5 (pavé numérique)
#endif
0},
{113,
"Top-left brush attachment point",

View File

@ -44,9 +44,11 @@
#include <stdlib.h>
#include <errno.h>
#if defined(USE_SDL) || defined(USE_SDL2)
#include <SDL_byteorder.h>
#include <SDL_image.h>
#endif
#if defined(USE_SDL)
#include <SDL_byteorder.h>
#endif
#if defined(__WIN32__)
#include <windows.h> // GetLogicalDrives(), GetDriveType(), DRIVE_*
#endif
@ -1918,10 +1920,10 @@ void Init_operations(void)
// Définition d'un mode:
void Set_video_mode(short width,
short height,
byte mode,
word fullscreen)
static void Set_video_mode(short width,
short height,
byte mode,
word fullscreen)
{
byte supported = 0;
@ -1932,19 +1934,21 @@ void Set_video_mode(short width,
}
if (!fullscreen)
supported = 128; // Prefere, non modifiable
#if defined(USE_SDL)
else if (SDL_VideoModeOK(width, height, 8, SDL_FULLSCREEN))
supported = 1; // supported
#endif
else
{
// Non supporte : on ne le prend pas
return;
}
Video_mode[Nb_video_modes].Width = width;
Video_mode[Nb_video_modes].Height = height;
Video_mode[Nb_video_modes].Mode = mode;
Video_mode[Nb_video_modes].Fullscreen = fullscreen;
Video_mode[Nb_video_modes].State = supported;
Video_mode[Nb_video_modes].Width = width;
Video_mode[Nb_video_modes].Height = height;
Video_mode[Nb_video_modes].Mode = mode;
Video_mode[Nb_video_modes].Fullscreen = fullscreen;
Video_mode[Nb_video_modes].State = supported;
Nb_video_modes ++;
}
@ -1966,7 +1970,9 @@ int Compare_video_modes(const void *p1, const void *p2)
// Initializes the list of available video modes
void Set_all_video_modes(void)
{
#if defined(USE_SDL)
SDL_Rect** Modes;
#endif
Nb_video_modes=0;
// The first mode will have index number 0.
@ -2044,6 +2050,7 @@ void Set_all_video_modes(void)
Set_video_mode( 800,600,0, 1);
Set_video_mode(1024,768,0, 1);
#if defined(USE_SDL)
Modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
if ((Modes != (SDL_Rect**)0) && (Modes!=(SDL_Rect**)-1))
{
@ -2074,6 +2081,17 @@ void Set_all_video_modes(void)
// Note that we voluntarily omit the first entry: the default mode.
qsort(&Video_mode[1], Nb_video_modes - 1, sizeof(T_Video_mode), Compare_video_modes);
}
#endif
#if defined(USE_SDL2)
{
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
// Set the native desktop video mode
Set_video_mode(dm.w, dm.h, 0, 1);
}
}
#endif
}
//---------------------------------------------------------------------------
@ -3196,9 +3214,13 @@ void Define_icon(void)
if (icon->format->BitsPerPixel == 8)
{
// 8bit image: use color key
#if defined(USE_SDL)
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, pink);
SDL_WM_SetIcon(icon,NULL);
#else
SDL_SetColorKey(icon, SDL_TRUE, pink);
//SDL_SetWindowIcon(SDL_Window* window, icon);
#endif
}
else
{
@ -3213,7 +3235,11 @@ void Define_icon(void)
for (x=0;x<32;x++)
if (Get_SDL_pixel_hicolor(icon, x, y) != pink)
icon_mask[(y*32+x)/8] |=0x80>>(x&7);
#if defined(USE_SDL)
SDL_WM_SetIcon(icon,icon_mask);
#else
//SDL_SetWindowIcon(SDL_Window* window, icon);
#endif
free(icon_mask);
icon_mask = NULL;
}

View File

@ -47,7 +47,9 @@
// generic defaults like "Right Amiga+Q = Quit".
// In case this is annoying for some platforms, disable it.
#if defined(USE_SDL)
void Handle_window_resize(SDL_ResizeEvent event);
#endif
void Handle_window_exit(SDL_QuitEvent event);
static int Color_cycling(void);
@ -292,11 +294,13 @@ int Move_cursor_with_constraints()
// WM events management
#if defined(USE_SDL)
void Handle_window_resize(SDL_ResizeEvent event)
{
Resize_width = event.w;
Resize_height = event.h;
}
#endif
void Handle_window_exit(SDL_QuitEvent event)
{
@ -338,6 +342,9 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
// TODO: repeat system maybe?
return 0;
// In SDL 2.0 the mousewheel is no longer a button.
// Look for SDL_MOUSEWHEEL events.
#if defined(USE_SDL)
case SDL_BUTTON_WHEELUP:
Key = KEY_MOUSEWHEELUP|Key_modifiers(SDL_GetModState());
return 0;
@ -345,6 +352,7 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
case SDL_BUTTON_WHEELDOWN:
Key = KEY_MOUSEWHEELDOWN|Key_modifiers(SDL_GetModState());
return 0;
#endif
default:
return 0;
@ -376,6 +384,7 @@ int Handle_mouse_release(SDL_MouseButtonEvent event)
// Keyboard management
#if defined(USE_SDL)
int Handle_key_press(SDL_KeyboardEvent event)
{
//Appui sur une touche du clavier
@ -468,6 +477,7 @@ int Handle_key_press(SDL_KeyboardEvent event)
}
return 0;
}
#endif
int Release_control(int key_code, int modifier)
{
@ -543,6 +553,7 @@ int Release_control(int key_code, int modifier)
}
#if defined(USE_SDL)
int Handle_key_release(SDL_KeyboardEvent event)
{
int modifier;
@ -583,6 +594,7 @@ int Handle_key_release(SDL_KeyboardEvent event)
}
return Release_control(released_key, modifier);
}
#endif
// Joystick management
@ -610,7 +622,11 @@ int Handle_joystick_press(SDL_JoyButtonEvent event)
}
if (event.button == Joybutton_alt)
{
#if defined(USE_SDL)
SDL_SetModState(SDL_GetModState() | (KMOD_ALT|KMOD_META));
#else
SDL_SetModState(SDL_GetModState() | (KMOD_ALT|KMOD_GUI));
#endif
if (Config.Swap_buttons == MOD_ALT && Button_inverter==0)
{
Button_inverter=1;
@ -699,7 +715,11 @@ int Handle_joystick_release(SDL_JoyButtonEvent event)
}
if (event.button == Joybutton_alt)
{
#if defined(USE_SDL)
SDL_SetModState(SDL_GetModState() & ~(KMOD_ALT|KMOD_META));
#else
SDL_SetModState(SDL_GetModState() & ~(KMOD_ALT|KMOD_GUI));
#endif
return Release_control(0,MOD_ALT);
}
if (event.button == Joybutton_left_click)
@ -869,14 +889,20 @@ int Get_input(int sleep_time)
// Process as much events as possible without redrawing the screen.
// This mostly allows us to merge mouse events for people with an high
// resolution mouse
#if defined(USE_SDL)
while(!user_feedback_required && SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS)==1)
#elif defined(USE_SDL2)
while(!user_feedback_required && SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)==1)
#endif
{
switch(event.type)
{
#if defined(USE_SDL)
case SDL_VIDEORESIZE:
Handle_window_resize(event.resize);
user_feedback_required = 1;
break;
#endif
case SDL_QUIT:
Handle_window_exit(event.quit);
@ -897,13 +923,25 @@ int Get_input(int sleep_time)
user_feedback_required = 1;
break;
#if defined(USE_SDL2)
//case SDL_MOUSEWHEEL:
// break;
#endif
case SDL_KEYDOWN:
#if defined(USE_SDL)
Handle_key_press(event.key);
#else
//TODO SDL2
#endif
user_feedback_required = 1;
break;
case SDL_KEYUP:
#if defined(USE_SDL)
Handle_key_release(event.key);
//TODO SDL2
#endif
break;
// Start of Joystik handling
@ -1064,7 +1102,11 @@ void Adjust_mouse_sensitivity(word fullscreen)
void Set_mouse_position(void)
{
#if defined(USE_SDL)
SDL_WarpMouse(Mouse_X*Pixel_width, Mouse_Y*Pixel_height);
#elif defined(USE_SDL2)
//SDL_WarpMouseInWindow(Window_SDL, Mouse_X*Pixel_width, Mouse_Y*Pixel_height);
#endif
}
static int Color_cycling(void)

View File

@ -39,12 +39,13 @@
#define META_KEY_PREFIX "Super+"
#endif
#if defined(USE_SDL)
// Table de correspondance des scancode de clavier IBM PC AT vers
// les symboles de touches SDL (sym).
// La correspondance est bonne si le clavier est QWERTY US, ou si
// l'utilisateur est sous Windows.
// Dans l'ordre des colonnes: Normal, +Shift, +Control, +Alt
const word Scancode_to_sym[256][4] =
static const word Scancode_to_sym[256][4] =
{
/* 00 ??? */ { SDLK_UNKNOWN ,SDLK_UNKNOWN ,SDLK_UNKNOWN ,SDLK_UNKNOWN },
/* 01 Esc */ { SDLK_ESCAPE ,SDLK_ESCAPE ,SDLK_ESCAPE ,SDLK_ESCAPE },
@ -749,3 +750,18 @@ word Keysym_to_ANSI(SDL_keysym keysym)
// Sinon c'est une touche spéciale, on retourne son scancode
return keysym.sym;
}
#else
// SDL2 TODO
word Key_for_scancode(word scancode)
{
return scancode;
}
const char * Key_name(word key)
{
return "Unknown";
}
word Key_modifiers(SDL_Keymod mod)
{
return 0;
}
#endif

View File

@ -43,7 +43,9 @@
This is used to type text and numeric values in input boxes.
@param keysym SDL symbol to convert
*/
#if defined(USE_SDL)
word Keysym_to_ANSI(SDL_keysym keysym);
#endif
/*!
Convert an SDL keysym to an internal keycode number.
@ -52,7 +54,9 @@ word Keysym_to_ANSI(SDL_keysym keysym);
See the notice at the beginning of keyboard.h for the format of a keycode.
@param keysym SDL symbol to convert
*/
#if defined(USE_SDL)
word Keysym_to_keycode(SDL_keysym keysym);
#endif
/*!
Helper function to convert between SDL system and the old coding for PC keycodes.
@ -73,5 +77,9 @@ const char * Key_name(word key);
Returns a combination of ::MOD_SHIFT, ::MOD_ALT, ::MOD_CTRL
@param mod SDL modifiers state
*/
#if defined(USE_SDL)
word Key_modifiers(SDLMod mod);
#elif defined(USE_SDL2)
word Key_modifiers(SDL_Keymod mod);
#endif

View File

@ -38,14 +38,15 @@
#ifndef _MSC_VER
#include <unistd.h>
#endif
#if defined(USE_SDL) || defined(USE_SDL2)
#include <SDL.h>
#include <SDL_image.h>
// There is no WM on the GP2X...
#if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) && !defined(GCWZERO)
#include <SDL_syswm.h>
#endif
#endif
#include "const.h"
#include "struct.h"
@ -623,6 +624,7 @@ int Init_program(int argc,char * argv[])
Spare.time_of_safety_backup = 0;
#if defined(USE_SDL) || defined(USE_SDL2)
// SDL
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0)
{
@ -630,11 +632,14 @@ int Init_program(int argc,char * argv[])
printf("Couldn't initialize SDL.\n");
return(0);
}
#endif
//Joystick = SDL_JoystickOpen(0);
#if defined(USE_SDL)
SDL_EnableKeyRepeat(250, 32);
SDL_EnableUNICODE(SDL_ENABLE);
SDL_WM_SetCaption("GrafX2","GrafX2");
#endif
Define_icon();
// Texte

View File

@ -65,6 +65,11 @@
#endif
static SDL_Surface * Screen_SDL = NULL;
#if defined(USE_SDL2)
static SDL_Window * Window_SDL = NULL;
static SDL_Renderer * Renderer_SDL = NULL;
static SDL_Texture * Texture_SDL = NULL;
#endif
volatile int Allow_colorcycling=1;
@ -114,6 +119,7 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
static SDL_Cursor* cur = NULL;
static byte cursorData = 0;
#if defined(USE_SDL)
#ifdef GCWZERO
Screen_SDL=SDL_SetVideoMode(*width,*height,8,SDL_HWSURFACE|SDL_TRIPLEBUF|(fullscreen?SDL_FULLSCREEN:0)|SDL_RESIZABLE);
#else
@ -134,6 +140,14 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
{
DEBUG("Error: Unable to change video mode!",0);
}
#else
// SDL2
Window_SDL = SDL_CreateWindow("GrafX2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
*width, *height, (fullscreen?SDL_WINDOW_FULLSCREEN:SDL_WINDOW_RESIZABLE));
Renderer_SDL = SDL_CreateRenderer(Window_SDL, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
Texture_SDL = SDL_CreateTexture(Renderer_SDL, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, *width, *height);
Screen_SDL = SDL_CreateRGBSurface(0, *width, *height, 8, 0, 0, 0, 0);
#endif
// Trick borrowed to Barrage (http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg737265.html) :
// Showing the cursor but setting it to fully transparent allows us to get absolute mouse coordinates,
@ -153,6 +167,40 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
}
}
#if defined(USE_SDL2)
static void GFX2_UpdateRect(int x, int y, int width, int height)
{
byte * pixels;
int pitch;
int line;
static SDL_Surface *RGBcopy = NULL;
SDL_Rect source_rect;
source_rect.x = x;
source_rect.y = y;
source_rect.w = width;
source_rect.h = height;
if (RGBcopy == NULL)
{
RGBcopy = SDL_CreateRGBSurface(0,
Screen_SDL->w, Screen_SDL->h,
32, 0, 0, 0, 0);
}
// conversion ARGB
SDL_BlitSurface(Screen_SDL, &source_rect, RGBcopy, &source_rect);
// upload texture
SDL_LockTexture(Texture_SDL, &source_rect, (void **)(&pixels), &pitch );
for (line = 0; line < source_rect.h; line++)
{
memcpy(pixels + line * pitch, RGBcopy->pixels + source_rect.x * 4 + (source_rect.y+line)* RGBcopy->pitch, source_rect.w * 4 );
}
SDL_UnlockTexture(Texture_SDL);
SDL_RenderCopy(Renderer_SDL, Texture_SDL, &source_rect, &source_rect);
SDL_RenderPresent(Renderer_SDL);
}
#endif
#if (UPDATE_METHOD == UPDATE_METHOD_CUMULATED)
short Min_X=0;
short Min_Y=0;
@ -174,8 +222,10 @@ void Flush_update(void)
{
#ifdef GCWZERO
SDL_Flip(Screen_SDL);
#else
#elif defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, 0, 0, 0, 0);
#else
GFX2_UpdateRect(0, 0, 0, 0);
#endif
update_is_required=0;
}
@ -191,14 +241,22 @@ void Flush_update(void)
Min_X=0;
if (Min_Y<0)
Min_Y=0;
#if defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, Min_X*Pixel_width, Min_Y*Pixel_height, Min(Screen_width-Min_X, Max_X-Min_X)*Pixel_width, Min(Screen_height-Min_Y, Max_Y-Min_Y)*Pixel_height);
#else
GFX2_UpdateRect(Min_X*Pixel_width, Min_Y*Pixel_height, Min(Screen_width-Min_X, Max_X-Min_X)*Pixel_width, Min(Screen_height-Min_Y, Max_Y-Min_Y)*Pixel_height);
#endif
Min_X=Min_Y=10000;
Max_X=Max_Y=0;
}
if (Status_line_dirty_end)
{
#if defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, (18+(Status_line_dirty_begin*8))*Menu_factor_X*Pixel_width,Menu_status_Y*Pixel_height,(Status_line_dirty_end-Status_line_dirty_begin)*8*Menu_factor_X*Pixel_width,8*Menu_factor_Y*Pixel_height);
#else
GFX2_UpdateRect((18+(Status_line_dirty_begin*8))*Menu_factor_X*Pixel_width,Menu_status_Y*Pixel_height,(Status_line_dirty_end-Status_line_dirty_begin)*8*Menu_factor_X*Pixel_width,8*Menu_factor_Y*Pixel_height);
#endif
}
Status_line_dirty_begin=25;
Status_line_dirty_end=0;
@ -210,7 +268,11 @@ void Flush_update(void)
void Update_rect(short x, short y, unsigned short width, unsigned short height)
{
#if (UPDATE_METHOD == UPDATE_METHOD_MULTI_RECTANGLE)
#if defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, x*Pixel_width, y*Pixel_height, width*Pixel_width, height*Pixel_height);
#else
GFX2_UpdateRect(x*Pixel_width, y*Pixel_height, width*Pixel_width, height*Pixel_height);
#endif
#endif
#if (UPDATE_METHOD == UPDATE_METHOD_CUMULATED)
@ -242,7 +304,11 @@ void Update_rect(short x, short y, unsigned short width, unsigned short height)
void Update_status_line(short char_pos, short width)
{
#if (UPDATE_METHOD == UPDATE_METHOD_MULTI_RECTANGLE)
#if defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, (18+char_pos*8)*Menu_factor_X*Pixel_width,Menu_status_Y*Pixel_height,width*8*Menu_factor_X*Pixel_width,8*Menu_factor_Y*Pixel_height);
#else
GFX2_UpdateRect((18+char_pos*8)*Menu_factor_X*Pixel_width,Menu_status_Y*Pixel_height,width*8*Menu_factor_X*Pixel_width,8*Menu_factor_Y*Pixel_height);
#endif
#endif
#if (UPDATE_METHOD == UPDATE_METHOD_CUMULATED)
@ -304,7 +370,11 @@ SDL_Color Color_to_SDL_color(byte index)
color.r = Main.palette[index].R;
color.g = Main.palette[index].G;
color.b = Main.palette[index].B;
#if defined(USE_SDL)
color.unused = 255;
#else
color.a = 255;
#endif
return color;
}
@ -373,7 +443,11 @@ int SetPalette(const T_Components * colors, int firstcolor, int ncolors)
PaletteSDL[i].g = colors[i].G;
PaletteSDL[i].b = colors[i].B;
}
#if defined(USE_SDL)
return SDL_SetPalette(Screen_SDL, SDL_PHYSPAL | SDL_LOGPAL, PaletteSDL, firstcolor, ncolors);
#else
return SDL_SetPaletteColors(Screen_SDL->format->palette, PaletteSDL, firstcolor, ncolors);
#endif
}
void Clear_border(byte color)
@ -396,7 +470,11 @@ void Clear_border(byte color)
r.h=Screen_SDL->h;
r.w=width;
SDL_FillRect(Screen_SDL,&r,color);
#if defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, r.x, r.y, r.w, r.h);
#else
//SDL_RenderPresent(
#endif
}
if (height)
{
@ -406,7 +484,11 @@ void Clear_border(byte color)
r.h=height;
r.w=Screen_SDL->w - height;
SDL_FillRect(Screen_SDL,&r,color);
#if defined(USE_SDL)
SDL_UpdateRect(Screen_SDL, r.x, r.y, r.w, r.h);
#else
// TODO
#endif
}
}

View File

@ -432,7 +432,11 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
fg_color.r=fg_color.g=fg_color.b=255;
bg_color.r=bg_color.g=bg_color.b=0;
// The following is alpha, supposedly unused
#if defined(USE_SDL)
bg_color.unused=fg_color.unused=255;
#elif defined(USE_SDL2)
bg_color.a=fg_color.a=255;
#endif
// Text rendering: creates a 8bit surface with its dedicated palette
#ifdef __ANDROID__
@ -576,7 +580,11 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
rgb.r=((color & 0xE0)>>5)<<5;
rgb.g=((color & 0x1C)>>2)<<5;
rgb.b=((color & 0x03)>>0)<<6;
#if defined(USE_SDL)
SDL_SetColors(reduced_surface, &rgb, color, 1);
#else
//SDL_SetPaletteColors
#endif
}
// Perform reduction
for (y=0; y<font_surface->h; y++)
@ -606,7 +614,11 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
// Allocation d'une surface SDL
text_surface=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 8, 0, 0, 0, 0);
// Copy palette
#if defined(USE_SDL)
SDL_SetPalette(text_surface, SDL_LOGPAL, font_surface->format->palette->colors, 0, 256);
#else
//SDL_SetPaletteColors(
#endif
// Fill with transparent color
rectangle.x=0;
rectangle.y=0;