diff --git a/project/msvc/.gitignore b/project/msvc/.gitignore index e8376ee0..9c785f39 100644 --- a/project/msvc/.gitignore +++ b/project/msvc/.gitignore @@ -1,5 +1,7 @@ Debug +Debug-* Release +Release-* ipch *.suo *.user diff --git a/project/msvc/grafx2-win32.sln b/project/msvc/grafx2-win32.sln new file mode 100644 index 00000000..a69b4803 --- /dev/null +++ b/project/msvc/grafx2-win32.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grafx2-win32", "grafx2-win32.vcxproj", "{34A001FF-927D-4E09-BE4A-F5D1C4AF39C6}" + ProjectSection(ProjectDependencies) = postProject + {056D84A3-08C5-4A2A-A24B-D2E6D00D9552} = {056D84A3-08C5-4A2A-A24B-D2E6D00D9552} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generateversion", "generateversion.vcxproj", "{056D84A3-08C5-4A2A-A24B-D2E6D00D9552}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {34A001FF-927D-4E09-BE4A-F5D1C4AF39C6}.Debug|Win32.ActiveCfg = Debug|Win32 + {34A001FF-927D-4E09-BE4A-F5D1C4AF39C6}.Debug|Win32.Build.0 = Debug|Win32 + {34A001FF-927D-4E09-BE4A-F5D1C4AF39C6}.Release|Win32.ActiveCfg = Release|Win32 + {34A001FF-927D-4E09-BE4A-F5D1C4AF39C6}.Release|Win32.Build.0 = Release|Win32 + {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Debug|Win32.ActiveCfg = Debug|Win32 + {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Debug|Win32.Build.0 = Debug|Win32 + {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Release|Win32.ActiveCfg = Release|Win32 + {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/project/msvc/grafx2-win32.vcxproj b/project/msvc/grafx2-win32.vcxproj new file mode 100644 index 00000000..b349a568 --- /dev/null +++ b/project/msvc/grafx2-win32.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {34A001FF-927D-4E09-BE4A-F5D1C4AF39C6} + grafx2win32 + + + + Application + true + Unicode + + + Application + false + true + MultiByte + + + + + + + + + + + + + $(Configuration)-win32\ + $(SolutionDir)..\..\bin\ + $(ProjectName)$(Configuration) + + + $(Configuration)-win32\ + $(SolutionDir)..\..\bin\ + $(ProjectName)$(Configuration) + + + + Level3 + Disabled + NOTTF;__ENABLE_LUA__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;%(PreprocessorDefinitions) + 4244 + ..\..\..\..\lua\include;%(AdditionalIncludeDirectories) + + + true + + + + + Level3 + MaxSpeed + true + true + NOTTF;__ENABLE_LUA__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;%(PreprocessorDefinitions) + 4244 + ..\..\..\..\lua\include;%(AdditionalIncludeDirectories) + + + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project/msvc/grafx2-win32.vcxproj.filters b/project/msvc/grafx2-win32.vcxproj.filters new file mode 100644 index 00000000..e7e747f2 --- /dev/null +++ b/project/msvc/grafx2-win32.vcxproj.filters @@ -0,0 +1,353 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + + + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + + + Fichiers de ressources + + + \ No newline at end of file diff --git a/project/msvc/grafx2.vcxproj b/project/msvc/grafx2.vcxproj index 7bff05b6..0162b51a 100644 --- a/project/msvc/grafx2.vcxproj +++ b/project/msvc/grafx2.vcxproj @@ -41,10 +41,12 @@ true $(SolutionDir)..\..\bin\ $(ProjectName)$(Configuration) + $(Configuration)-sdl\ false $(SolutionDir)..\..\bin\ + $(Configuration)-sdl\ diff --git a/src/brush.c b/src/brush.c index fc72626f..d3653a3d 100644 --- a/src/brush.c +++ b/src/brush.c @@ -33,7 +33,7 @@ #include "misc.h" #include "errors.h" #include "windows.h" -#include "sdlscreen.h" +#include "screen.h" #include "brush.h" #include "tiles.h" diff --git a/src/brush_ops.c b/src/brush_ops.c index 2e6fe97a..a1aa895b 100644 --- a/src/brush_ops.c +++ b/src/brush_ops.c @@ -35,7 +35,7 @@ #include "misc.h" #include "operatio.h" #include "pages.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #if defined(__VBCC__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) @@ -961,8 +961,11 @@ void Rotate_brush_1_5(void) // On corrige les coordonnées de la ligne si la touche shift est appuyée... cursor_x = Paintbrush_X; cursor_y = Paintbrush_Y; +#if defined(USE_SDL) || defined(USE_SDL2) if(SDL_GetModState() & KMOD_SHIFT) Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&cursor_x,&cursor_y); + // TODO : portable +#endif if ( (cursor_x!=old_x) || (cursor_y!=old_y) || (prev_state!=2) ) { @@ -1032,8 +1035,11 @@ void Rotate_brush_0_5(void) // On corrige les coordonnées de la ligne si la touche shift est appuyée... cursor_x = Paintbrush_X; cursor_y = Paintbrush_Y; +#if defined(USE_SDL) || defined(USE_SDL2) if(SDL_GetModState() & KMOD_SHIFT) Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&cursor_x,&cursor_y); + // TODO +#endif if ((cursor_x!=old_x) || (cursor_y!=old_y) || (prev_state!=3)) { diff --git a/src/buttons.c b/src/buttons.c index 696c5622..96fff253 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -71,7 +71,7 @@ #include "io.h" #include "help.h" #include "text.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "brush.h" #include "input.h" @@ -86,7 +86,7 @@ #elif defined(__MINT__) #include #include -#elif defined(__WIN32__) +#elif defined(WIN32) #ifndef _MSC_VER #include #endif diff --git a/src/buttons_effects.c b/src/buttons_effects.c index 397e1755..0b7a55f2 100644 --- a/src/buttons_effects.c +++ b/src/buttons_effects.c @@ -38,7 +38,7 @@ #include "misc.h" #include "pages.h" #include "readline.h" -#include "sdlscreen.h" +#include "screen.h" #include "struct.h" #include "windows.h" #include "tiles.h" diff --git a/src/engine.c b/src/engine.c index eeda4634..f4dd38a3 100644 --- a/src/engine.c +++ b/src/engine.c @@ -33,7 +33,7 @@ #include "operatio.h" #include "shade.h" #include "errors.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "brush.h" #include "input.h" diff --git a/src/factory.c b/src/factory.c index 485e04e7..98b6e656 100644 --- a/src/factory.c +++ b/src/factory.c @@ -37,7 +37,7 @@ #include "misc.h" #include "pages.h" // Backup() #include "readline.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "palette.h" #include "input.h" // Is_shortcut() diff --git a/src/filesel.c b/src/filesel.c index 07c291ee..4f4e59b7 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -25,7 +25,9 @@ along with Grafx2; if not, see */ +#if defined(USE_SDL) || defined(USE_SDL2) #include +#endif #if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) #include @@ -61,7 +63,7 @@ #include "errors.h" #include "io.h" #include "windows.h" -#include "sdlscreen.h" +#include "screen.h" #include "loadsave.h" #include "mountlist.h" #include "engine.h" diff --git a/src/graph.c b/src/graph.c index 3a89cde1..3eeccc6e 100644 --- a/src/graph.c +++ b/src/graph.c @@ -36,7 +36,7 @@ #include "buttons.h" #include "pages.h" #include "errors.h" -#include "sdlscreen.h" +#include "screen.h" #include "graph.h" #include "misc.h" #include "pxsimple.h" @@ -52,6 +52,9 @@ #include "input.h" #include "brush.h" #include "tiles.h" +#if defined(USE_SDL) || defined(USE_SDL2) +#include "sdlscreen.h" +#endif #if defined(__VBCC__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) #define M_PI 3.141592653589793238462643 @@ -397,7 +400,9 @@ try_again: if (screen_changed) { +#if defined(USE_SDL) || defined(USE_SDL2) Set_mode_SDL(&width, &height,fullscreen); +#endif } if (screen_changed || pixels_changed) diff --git a/src/help.c b/src/help.c index 395e8a21..201603ea 100644 --- a/src/help.c +++ b/src/help.c @@ -52,7 +52,7 @@ #include "engine.h" #include "helpfile.h" #include "help.h" -#include "sdlscreen.h" +#include "screen.h" #include "text.h" #include "keyboard.h" #include "windows.h" @@ -61,6 +61,7 @@ #include "errors.h" #include "pages.h" #include "factory.h" +#include "keycodes.h" extern const char Program_version[]; // generated in pversion.c extern const char SVN_revision[]; // generated in version.c diff --git a/src/input.c b/src/input.c index 09c8cca0..48ff4b0c 100644 --- a/src/input.c +++ b/src/input.c @@ -30,7 +30,7 @@ #include "global.h" #include "keyboard.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "errors.h" #include "misc.h" diff --git a/src/keyboard.h b/src/keyboard.h index a9910f68..8a71c3fc 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -37,6 +37,9 @@ /// Add 0x4000 for the Alt modifier ::MOD_ALT /// Add 0x8000 for the "Meta" modifier ::MOD_META (On MacOS X it's the CMD key) ////////////////////////////////////////////////////////////////////////////// +#if defined(USE_SDL) +#include +#endif /*! Convert an SDL keysym to an ANSI/ASCII character. diff --git a/src/keycodes.h b/src/keycodes.h new file mode 100644 index 00000000..0bcf94fa --- /dev/null +++ b/src/keycodes.h @@ -0,0 +1,29 @@ +/* vim:expandtab:ts=2 sw=2: +*/ +/* Grafx2 - The Ultimate 256-color bitmap paint program + + Copyright 2018 Thomas Bernard + Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) + + Grafx2 is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 + of the License. + + Grafx2 is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Grafx2; if not, see +*/ + +#ifndef KEYCODES_H_INCLUDED +#define KEYCODES_H_INCLUDED + +#if defined(USE_SDL) || defined(USE_SDL2) +#include +#endif + +#endif diff --git a/src/layers.c b/src/layers.c index 47e74389..8531bfaa 100644 --- a/src/layers.c +++ b/src/layers.c @@ -19,18 +19,22 @@ You should have received a copy of the GNU General Public License along with Grafx2; if not, see */ +#include +#include + #include "const.h" #include "struct.h" #include "global.h" #include "windows.h" #include "engine.h" #include "pages.h" -#include "sdlscreen.h" +#include "screen.h" #include "input.h" #include "help.h" #include "misc.h" #include "readline.h" #include "graph.h" +#include "keycodes.h" void Layer_activate(int layer, short side) { @@ -638,7 +642,7 @@ void Button_Anim_continuous_next(void) do { int target_frame; - Uint32 time_now; + dword time_now; Get_input(20); @@ -673,7 +677,7 @@ void Button_Anim_continuous_prev(void) do { int target_frame; - Uint32 time_now; + dword time_now; Get_input(20); diff --git a/src/loadsave.c b/src/loadsave.c index db9fe882..06163ff4 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -61,6 +61,7 @@ #if defined(USE_SDL) || defined(USE_SDL2) #include "sdlscreen.h" #endif +#include "screen.h" #include "struct.h" #include "windows.h" #include "engine.h" diff --git a/src/main.c b/src/main.c index a3533eb4..f9921fbb 100644 --- a/src/main.c +++ b/src/main.c @@ -58,7 +58,7 @@ #include "engine.h" #include "pages.h" #include "loadsave.h" -#include "sdlscreen.h" +#include "screen.h" #include "errors.h" #include "readini.h" #include "saveini.h" diff --git a/src/misc.c b/src/misc.c index 1ec6ed70..c31a0299 100644 --- a/src/misc.c +++ b/src/misc.c @@ -39,14 +39,13 @@ #endif #endif #include "struct.h" -#include "sdlscreen.h" #include "global.h" #include "errors.h" #include "buttons.h" #include "engine.h" #include "misc.h" #include "keyboard.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "palette.h" #include "input.h" diff --git a/src/misc.h b/src/misc.h index d99e9a01..5b1512ce 100644 --- a/src/misc.h +++ b/src/misc.h @@ -27,6 +27,9 @@ #ifndef MISC_H__ #define MISC_H__ +/* For sprintf() used in Num2str() and Dec2str(a,b,c) */ +#include + #include "struct.h" #include "global.h" diff --git a/src/miscfileformats.c b/src/miscfileformats.c index d469119b..0423fd2b 100644 --- a/src/miscfileformats.c +++ b/src/miscfileformats.c @@ -38,7 +38,7 @@ #include "libraw2crtc.h" #include "loadsave.h" #include "misc.h" -#include "sdlscreen.h" +#include "screen.h" #include "struct.h" #include "windows.h" #include "oldies.h" diff --git a/src/operatio.c b/src/operatio.c index a345db44..d998ee84 100644 --- a/src/operatio.c +++ b/src/operatio.c @@ -33,7 +33,7 @@ #include "buttons.h" #include "pages.h" #include "errors.h" -#include "sdlscreen.h" +#include "screen.h" #include "brush.h" #include "windows.h" #include "input.h" diff --git a/src/palette.c b/src/palette.c index 80dbbbaa..3df22754 100644 --- a/src/palette.c +++ b/src/palette.c @@ -32,7 +32,7 @@ #include "buttons.h" #include "pages.h" #include "help.h" -#include "sdlscreen.h" +#include "screen.h" #include "errors.h" #include "op_c.h" #include "windows.h" diff --git a/src/pxdouble.c b/src/pxdouble.c index 4c05542b..2160cc9b 100644 --- a/src/pxdouble.c +++ b/src/pxdouble.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxdouble.h" diff --git a/src/pxquad.c b/src/pxquad.c index 8f022896..896db906 100644 --- a/src/pxquad.c +++ b/src/pxquad.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxquad.h" diff --git a/src/pxsimple.c b/src/pxsimple.c index b8461389..fb46d0d5 100644 --- a/src/pxsimple.c +++ b/src/pxsimple.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxsimple.h" diff --git a/src/pxtall.c b/src/pxtall.c index 2c196065..81728c69 100644 --- a/src/pxtall.c +++ b/src/pxtall.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxtall.h" diff --git a/src/pxtall2.c b/src/pxtall2.c index a4725fc8..e30041a7 100644 --- a/src/pxtall2.c +++ b/src/pxtall2.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxtall2.h" diff --git a/src/pxtall3.c b/src/pxtall3.c index de327348..82bc06bb 100644 --- a/src/pxtall3.c +++ b/src/pxtall3.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxtall3.h" diff --git a/src/pxtriple.c b/src/pxtriple.c index ffe2c344..82a632df 100644 --- a/src/pxtriple.c +++ b/src/pxtriple.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxtriple.h" diff --git a/src/pxwide.c b/src/pxwide.c index 7e3e944a..f9dc1973 100644 --- a/src/pxwide.c +++ b/src/pxwide.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxwide.h" diff --git a/src/pxwide2.c b/src/pxwide2.c index 9a5a4231..8f2368cf 100644 --- a/src/pxwide2.c +++ b/src/pxwide2.c @@ -24,7 +24,7 @@ #include #include #include "global.h" -#include "sdlscreen.h" +#include "screen.h" #include "misc.h" #include "graph.h" #include "pxwide2.h" diff --git a/src/readline.c b/src/readline.c index 6c934ea8..0f5c420f 100644 --- a/src/readline.c +++ b/src/readline.c @@ -37,16 +37,19 @@ #include "misc.h" #include "errors.h" #include "const.h" -#include "sdlscreen.h" +#include "screen.h" #include "readline.h" #include "windows.h" #include "input.h" #include "engine.h" #include "unicode.h" +#include "keycodes.h" -#ifdef __WIN32__ +#ifdef WIN32 #include +#if defined(USE_SDL) #include +#endif #elif defined __HAIKU__ #include "haiku.h" diff --git a/src/screen.h b/src/screen.h new file mode 100644 index 00000000..baffe2a4 --- /dev/null +++ b/src/screen.h @@ -0,0 +1,60 @@ +/* vim:expandtab:ts=2 sw=2: +*/ +/* Grafx2 - The Ultimate 256-color bitmap paint program + + Copyright 2018 Thomas Bernard + Copyright 2008 Yves Rizoud + Copyright 2007 Adrien Destugues + Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) + + Grafx2 is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 + of the License. + + Grafx2 is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Grafx2; if not, see +*/ + +////////////////////////////////////////////////////////////////////////////// +///@file screen.h +/// Screen update (refresh) system +////////////////////////////////////////////////////////////////////////////// + +#ifndef SCREEN_H_INCLUDED +#define SCREEN_H_INCLUDED + +#include "struct.h" +#include "global.h" + +byte Get_Screen_pixel(int x, int y); + +void Set_Screen_pixel(int x, int y, byte value); + +byte* Get_Screen_pixel_ptr(int x, int y); + +void Screen_FillRect(int x, int y, int w, int h, byte color); + +void Update_rect(short x, short y, unsigned short width, unsigned short height); +void Flush_update(void); +void Update_status_line(short char_pos, short width); + +int SetPalette(const T_Components * colors, int firstcolor, int ncolors); + +/// +/// Clears the parts of screen that are outside of the editing area. +/// There is such area only if the screen mode is not a multiple of the pixel +/// size, eg: 3x3 pixels in 1024x768 leaves 1 column on the right, 0 rows on bottom. +void Clear_border(byte color); + +extern volatile int Allow_colorcycling; + +/// Activates or desactivates file drag-dropping in program window. +void Allow_drag_and_drop(int flag); + +#endif // SCREEN_H_INCLUDED diff --git a/src/sdlscreen.h b/src/sdlscreen.h index 80183ade..6c810e10 100644 --- a/src/sdlscreen.h +++ b/src/sdlscreen.h @@ -37,18 +37,6 @@ void Set_mode_SDL(int *,int *,int); GFX2_GLOBAL SDL_Rect ** List_SDL_video_modes; -byte Get_Screen_pixel(int x, int y); - -void Set_Screen_pixel(int x, int y, byte value); - -byte* Get_Screen_pixel_ptr(int x, int y); - -void Screen_FillRect(int x, int y, int w, int h, byte color); - -void Update_rect(short x, short y, unsigned short width, unsigned short height); -void Flush_update(void); -void Update_status_line(short char_pos, short width); - /// /// Converts a SDL_Surface (indexed colors or RGB) into an array of bytes /// (indexed colors). @@ -66,17 +54,4 @@ void Set_SDL_pixel_8(SDL_Surface *bmp, int x, int y, byte color); /// Convert a SDL Palette to a grafx2 palette void Get_SDL_Palette(const SDL_Palette * sdl_palette, T_Palette palette); -int SetPalette(const T_Components * colors, int firstcolor, int ncolors); - -/// -/// Clears the parts of screen that are outside of the editing area. -/// There is such area only if the screen mode is not a multiple of the pixel -/// size, eg: 3x3 pixels in 1024x768 leaves 1 column on the right, 0 rows on bottom. -void Clear_border(byte color); - -extern volatile int Allow_colorcycling; - -/// Activates or desactivates file drag-dropping in program window. -void Allow_drag_and_drop(int flag); - -#endif // SDLSCREEN_H_INCLUDED +#endif // SDLSCREEN_H_INCLUDED \ No newline at end of file diff --git a/src/shade.c b/src/shade.c index 2ea99d8b..3ec1d1a1 100644 --- a/src/shade.c +++ b/src/shade.c @@ -28,10 +28,11 @@ #include "misc.h" #include "readline.h" #include "help.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "input.h" #include "shade.h" +#include "keycodes.h" void Button_Shade_mode(void) { diff --git a/src/text.c b/src/text.c index b02112c5..4f39c9e9 100644 --- a/src/text.c +++ b/src/text.c @@ -58,12 +58,14 @@ #endif #endif +#if defined(USE_SDL) || defined(USE_SDL2) #include #include "SFont.h" +#include "sdlscreen.h" +#endif #include "struct.h" #include "global.h" -#include "sdlscreen.h" #include "io.h" #include "errors.h" #include "windows.h" @@ -541,7 +543,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias, } #endif - +#if defined(USE_SDL) || defined(USE_SDL2) byte *Render_text_SFont(const char *str, int font_number, int *width, int *height, T_Palette palette) { SFont_Font *font; @@ -673,6 +675,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh return new_brush; } +#endif // Crée une brosse à partir des paramètres de texte demandés. // Si cela réussit, la fonction place les dimensions dans width et height, @@ -704,8 +707,9 @@ byte *Render_text(const char *str, int font_number, int size, int antialias, int } else { +#if defined(USE_SDL) || defined(USE_SDL2) return Render_text_SFont(str, font_number, width, height, palette); +#endif } } - diff --git a/src/tiles.c b/src/tiles.c index 05c758aa..08b1faf9 100644 --- a/src/tiles.c +++ b/src/tiles.c @@ -19,10 +19,13 @@ along with Grafx2; if not, see */ +#include +#include + #include "struct.h" #include "global.h" #include "graph.h" -#include "sdlscreen.h" +#include "screen.h" #include "engine.h" #include "windows.h" #include "input.h" diff --git a/src/transform.c b/src/transform.c index 37a69ec9..69429c3c 100644 --- a/src/transform.c +++ b/src/transform.c @@ -26,7 +26,7 @@ #include "struct.h" #include "transform.h" #include "engine.h" -#include "sdlscreen.h" +#include "screen.h" #include "windows.h" #include "input.h" #include "help.h" diff --git a/src/windows.c b/src/windows.c index a0d576a1..82a76d0e 100644 --- a/src/windows.c +++ b/src/windows.c @@ -46,9 +46,10 @@ #include "misc.h" #include "op_c.h" #include "readline.h" -#include "sdlscreen.h" +#include "screen.h" #include "palette.h" #include "unicode.h" +#include "keycodes.h" T_Toolbar_button Buttons_Pool[NB_BUTTONS]; T_Menu_Bar Menu_bars[MENUBAR_COUNT] =