Fixed compilation error on Linux (name conflicts, issue 132)
Load/Save: Fixed display of mount points and drives ("Select drive" button)
Started documenting global variables
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@698 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
efbc978e6f
commit
663229efb3
@ -972,9 +972,9 @@ void Button_Settings(void)
|
||||
y_sensitivity?y_sensitivity:1);
|
||||
// Gestion des fontes
|
||||
if (Config.Font)
|
||||
Font=GFX_fun_font;
|
||||
Menu_font=GFX_fun_font;
|
||||
else
|
||||
Font=GFX_system_font;
|
||||
Menu_font=GFX_system_font;
|
||||
|
||||
if (config_is_reloaded)
|
||||
Compute_optimal_menu_colors(Main_palette);
|
||||
|
||||
4
divers.c
4
divers.c
@ -105,8 +105,8 @@ void Hide_current_image_with_stencil(byte color, byte * stencil)
|
||||
{
|
||||
int nb_pixels=0; //ECX
|
||||
//al=color
|
||||
//edi=Screen
|
||||
byte* Pixel_Courant=Screen; //dl
|
||||
//edi=Screen_pixels
|
||||
byte* Pixel_Courant=Screen_pixels; //dl
|
||||
int i;
|
||||
|
||||
nb_pixels=Main_image_height*Main_image_width;
|
||||
|
||||
2
files.c
2
files.c
@ -106,7 +106,7 @@ char * Format_filename(char * fname, int type)
|
||||
else if (fname[0]=='.' || type==2)
|
||||
{
|
||||
// Fichiers ".quelquechose" ou lecteurs: Calé à gauche sur 18 caractères maximum.
|
||||
strcpy(result," ");
|
||||
strcpy(result," ");
|
||||
for (c=0;fname[c]!='\0' && c < 18;c++)
|
||||
result[c]=fname[c];
|
||||
// Un caractère spécial pour indiquer que l'affichage est tronqué
|
||||
|
||||
244
global.h
244
global.h
@ -19,72 +19,81 @@
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// Dans MAIN on declare les variables
|
||||
// Dans les autres fichiers, on ne fait que les référencer
|
||||
#ifdef GLOBAL_VARIABLES
|
||||
#define GFX2_GLOBAL
|
||||
#else
|
||||
#define GFX2_GLOBAL extern
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
///@file global.h
|
||||
/// This file contains all global variables.
|
||||
/// They are prefixed by ::GFX2_GLOBAL so they are extern when needed.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Ce fichier contient les déclaration des variables globales //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// -- Section des variables de CONFIGURATION ---------------------------------
|
||||
|
||||
#ifndef _GLOBAL_H_
|
||||
#define _GLOBAL_H_
|
||||
|
||||
#include <SDL.h>
|
||||
#include "struct.h"
|
||||
|
||||
// MAIN declares the variables,
|
||||
// other files only have an extern definition.
|
||||
#ifdef GLOBAL_VARIABLES
|
||||
/// Magic prefix to make all declarations extern, except when included by main.c.
|
||||
#define GFX2_GLOBAL
|
||||
#else
|
||||
#define GFX2_GLOBAL extern
|
||||
#endif
|
||||
|
||||
// -- CONFIGURATION variables
|
||||
|
||||
/// Current configuration.
|
||||
GFX2_GLOBAL T_Config Config;
|
||||
|
||||
// Tableau des touches spéciales
|
||||
/// Array of special keys.
|
||||
GFX2_GLOBAL word Config_Key[NB_SPECIAL_SHORTCUTS][2];
|
||||
|
||||
|
||||
/// A video mode (resolution) usable by Grafx2.
|
||||
typedef struct
|
||||
{
|
||||
short Width;
|
||||
short Height;
|
||||
byte Mode;
|
||||
word Fullscreen;
|
||||
byte State; // 0:Cool 1:OK ; 2:Bof ; 3:Naze ; si on rajoute +128 => incompatible
|
||||
short Width; ///< Screen width
|
||||
short Height; ///< Screen height
|
||||
byte Mode; ///< Unused (used to be Mode-X, SVGA, etc)
|
||||
word Fullscreen; ///< 0 for window, 1 for fullscreen
|
||||
byte State; /// How good is the mode supported. 0:Good (white) 1:OK (light) 2:So-so (dark) 4:User-disabled (black); +128 => System doesn't support it at all.
|
||||
} T_Video_mode;
|
||||
|
||||
/// Array of all video modes supported by your platform. Actually filled up to ::Nb_video_modes, excluded.
|
||||
GFX2_GLOBAL T_Video_mode Video_mode[MAX_VIDEO_MODES];
|
||||
GFX2_GLOBAL int Nb_video_modes; // Nombre de modes réellement recensés dans Video_mode[]
|
||||
|
||||
/// Actual number of video modes in ::Video_mode.
|
||||
GFX2_GLOBAL int Nb_video_modes;
|
||||
|
||||
// Palette par défaut
|
||||
|
||||
/// A default 256-color palette.
|
||||
GFX2_GLOBAL T_Palette Default_palette;
|
||||
|
||||
// Couleurs du menu
|
||||
// Menu colors
|
||||
|
||||
GFX2_GLOBAL byte MC_Black;
|
||||
GFX2_GLOBAL byte MC_Dark;
|
||||
GFX2_GLOBAL byte MC_Light;
|
||||
GFX2_GLOBAL byte MC_White;
|
||||
GFX2_GLOBAL byte MC_Trans;
|
||||
GFX2_GLOBAL byte MC_Black; /// Index of color to use as "black" in the GUI menus.
|
||||
GFX2_GLOBAL byte MC_Dark; /// Index of color to use as "dark grey" in the GUI menus.
|
||||
GFX2_GLOBAL byte MC_Light; /// Index of color to use as "light grey" in the GUI menus.
|
||||
GFX2_GLOBAL byte MC_White; /// Index of color to use as "white" in the GUI menus.
|
||||
GFX2_GLOBAL byte MC_Trans; /// Index of color to use as "transparent" while loading the GUI file.
|
||||
|
||||
/// Favorite menu colors (RGB values).
|
||||
GFX2_GLOBAL T_Components Fav_menu_colors[4];
|
||||
|
||||
// State des entrées
|
||||
|
||||
GFX2_GLOBAL word Mouse_X; // Abscisse de la souris
|
||||
GFX2_GLOBAL word Mouse_Y; // Ordonnée de la souris
|
||||
GFX2_GLOBAL byte Mouse_K; // State des boutons de la souris (tient comte des boutons appuyés simultanéments
|
||||
// Input state
|
||||
GFX2_GLOBAL word Mouse_X; /// Current mouse cursor position.
|
||||
GFX2_GLOBAL word Mouse_Y; /// Current mouse cursor position.
|
||||
GFX2_GLOBAL byte Mouse_K; /// Current mouse buttons state. Bitfield: 1 for RMB, 2 for LMB.
|
||||
|
||||
/// Helper macro to take only one button when both are pressed (LMB has priority)
|
||||
#define Mouse_K_unique (Mouse_K==0?0:(Mouse_K&1?1:(Mouse_K&2?2:0))) // State des boutons de la souris (un seul bouton à la fois, on regarde d'abord le 1, puis le 2, ...)
|
||||
|
||||
GFX2_GLOBAL dword Key; // Key tapée
|
||||
GFX2_GLOBAL dword Key_ANSI; // Caractère tapé
|
||||
GFX2_GLOBAL Uint8* Keyboard_state; // Scancode de la touche en cours et etat des touches de ctrl
|
||||
// Modificateurs pour Key
|
||||
/// Last key pressed, 0 if none. Set by the latest call to ::Get_input()
|
||||
GFX2_GLOBAL dword Key;
|
||||
|
||||
///
|
||||
/// Last character typed, converted to ANSI character set (Windows-1252).
|
||||
/// This is mostly used when the user enters text (filename, etc).
|
||||
GFX2_GLOBAL dword Key_ANSI;
|
||||
|
||||
// Keyboard modifiers
|
||||
// (Name conflict with windows.h)
|
||||
#ifdef MOD_SHIFT
|
||||
#undef MOD_SHIFT
|
||||
@ -95,78 +104,141 @@ GFX2_GLOBAL Uint8* Keyboard_state; // Scancode de la touche en cours et etat de
|
||||
#ifdef MOD_ALT
|
||||
#undef MOD_ALT
|
||||
#endif
|
||||
/// Key modifier for SHIFT key. Used as mask in ::Key, for example.
|
||||
#define MOD_SHIFT 0x1000
|
||||
/// Key modifier for CONTROL key. Used as mask in ::Key, for example.
|
||||
#define MOD_CTRL 0x2000
|
||||
/// Key modifier for ALT key. Used as mask in ::Key, for example.
|
||||
#define MOD_ALT 0x4000
|
||||
|
||||
GFX2_GLOBAL byte Quit_is_required; // !=0 lorsque l'utilisateur demande la fermeture de fenêtre.
|
||||
/// Boolean set to true when the OS/window manager requests the application to close. ie: [X] button
|
||||
GFX2_GLOBAL byte Quit_is_required;
|
||||
|
||||
/// Divisor for the mouse coordinates recieved. No target currently needs it, should be left at 1.
|
||||
GFX2_GLOBAL byte Mouse_fix_factor_X;
|
||||
/// Divisor for the mouse coordinates recieved. No target currently needs it, should be left at 1.
|
||||
GFX2_GLOBAL byte Mouse_fix_factor_Y;
|
||||
|
||||
///
|
||||
/// This boolean is true when the current operation allows changing the
|
||||
/// foreground or background color.
|
||||
GFX2_GLOBAL byte Allow_color_change_during_operation;
|
||||
|
||||
// Données sur le curseur
|
||||
// Mouse cursor data
|
||||
|
||||
/// Current mouse cursor. Value is in enum ::CURSOR_SHAPES
|
||||
GFX2_GLOBAL byte Cursor_shape;
|
||||
GFX2_GLOBAL byte Cursor_shape_before_window; // Forme du curseur avant l'ouverture d'une fenêtre
|
||||
/// Backup of ::Cursor_shape, used while a window is open (and needs a different cursor)
|
||||
GFX2_GLOBAL byte Cursor_shape_before_window;
|
||||
/// Boolean, means the cursor should not be drawn. It's togglable by the user.
|
||||
GFX2_GLOBAL byte Cursor_hidden;
|
||||
GFX2_GLOBAL byte Cursor_in_menu; // Booléen "Le curseur se trouve dans le menu"
|
||||
GFX2_GLOBAL byte Cursor_in_menu_precedent; // Booléen "Le curseur se trouvait précédemment dans le menu"
|
||||
GFX2_GLOBAL word Cursor_offset_X[NB_CURSOR_SPRITES]; // Coordonnées X du point sensible de curseurs en sprite
|
||||
GFX2_GLOBAL word Cursor_offset_Y[NB_CURSOR_SPRITES]; // Coordonnées Y du point sensible de curseurs en sprite
|
||||
GFX2_GLOBAL byte GFX_cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH]; // Dessins des sprites de curseur
|
||||
GFX2_GLOBAL byte CURSOR_BACKGROUND[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH]; // Contenu du dessous du curseur
|
||||
/// Boolean, means the cursor is currently hovering over a menu GUI element.
|
||||
GFX2_GLOBAL byte Cursor_in_menu;
|
||||
/// Boolean, means the cursor was hovering over a menu GUI element.
|
||||
GFX2_GLOBAL byte Cursor_in_menu_previous;
|
||||
/// X coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_WIDTH
|
||||
GFX2_GLOBAL word Cursor_offset_X[NB_CURSOR_SPRITES];
|
||||
/// Y coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_HEIGHT
|
||||
GFX2_GLOBAL word Cursor_offset_Y[NB_CURSOR_SPRITES];
|
||||
/// Graphic resources for the mouse cursor.
|
||||
GFX2_GLOBAL byte GFX_cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
|
||||
/// Storage for the graphics under the mouse cursor. Used by ::Hide_cursor and ::Display_cursor
|
||||
GFX2_GLOBAL byte CURSOR_BACKGROUND[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
|
||||
|
||||
// Données sur le pinceau
|
||||
// Paintbrush data
|
||||
|
||||
/// Active paintbrush. It's an index in enum ::PAINTBRUSH_SHAPES
|
||||
GFX2_GLOBAL byte Paintbrush_shape;
|
||||
/// Backup of ::Paintbrush_shape, before fill operation
|
||||
GFX2_GLOBAL byte Paintbrush_shape_before_fill;
|
||||
/// Backup of ::Paintbrush_shape, before color picker operation
|
||||
GFX2_GLOBAL byte Paintbrush_shape_before_colorpicker;
|
||||
/// Backup of ::Paintbrush_shaper, before lasso operation
|
||||
GFX2_GLOBAL byte Paintbrush_shape_before_lasso;
|
||||
/// Boolean, true when the preview paintbrush shouldn't be drawn.
|
||||
GFX2_GLOBAL byte Paintbrush_hidden;
|
||||
/// Cordinate of the preview paintbrush in image space.
|
||||
GFX2_GLOBAL short Paintbrush_X;
|
||||
/// Cordinate of the preview paintbrush in image space.
|
||||
GFX2_GLOBAL short Paintbrush_Y;
|
||||
/// Graphic resources for the preset paintbrushes.
|
||||
GFX2_GLOBAL byte GFX_paintbrush_sprite [NB_PAINTBRUSH_SPRITES][PAINTBRUSH_HEIGHT][PAINTBRUSH_WIDTH];
|
||||
/// Width of the preset paintbrushes.
|
||||
GFX2_GLOBAL word Preset_paintbrush_width[NB_PAINTBRUSH_SPRITES];
|
||||
/// Height of the preset paintbrushes.
|
||||
GFX2_GLOBAL word Preset_paintbrush_height[NB_PAINTBRUSH_SPRITES];
|
||||
/// Type of the preset paintbrush: index in enum PAINTBRUSH_SHAPES
|
||||
GFX2_GLOBAL byte Paintbrush_type[NB_PAINTBRUSH_SPRITES];
|
||||
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_width[]/2
|
||||
GFX2_GLOBAL word Preset_paintbrush_offset_X[NB_PAINTBRUSH_SPRITES];
|
||||
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_height[]/2
|
||||
GFX2_GLOBAL word Preset_paintbrush_offset_Y[NB_PAINTBRUSH_SPRITES];
|
||||
/// Pixel data of the current brush
|
||||
GFX2_GLOBAL byte * Paintbrush_sprite;
|
||||
/// Current paintbrush's width
|
||||
GFX2_GLOBAL short Paintbrush_width;
|
||||
/// Current paintbrush's height
|
||||
GFX2_GLOBAL short Paintbrush_height;
|
||||
/// Position of current paintbrush's handle
|
||||
GFX2_GLOBAL short Paintbrush_offset_X;
|
||||
/// Position of current paintbrush's handle
|
||||
GFX2_GLOBAL short Paintbrush_offset_Y;
|
||||
|
||||
// Commandes graphiques
|
||||
|
||||
/// Current pixel ratio. Index in enum ::PIXEL_RATIO
|
||||
GFX2_GLOBAL int Pixel_ratio;
|
||||
/// Current width of pixels, according to ::Pixel_ratio
|
||||
GFX2_GLOBAL int Pixel_width;
|
||||
/// Current height of pixels, according to ::Pixel_ratio
|
||||
GFX2_GLOBAL int Pixel_height;
|
||||
GFX2_GLOBAL Func_pixel Pixel; // Affiche un point à l'écran
|
||||
GFX2_GLOBAL Func_pixel Pixel_in_menu;// Affiche un point dans le menu (ou pas si le menu est invisible)
|
||||
GFX2_GLOBAL Func_read Read_pixel; // Teste la couleur d'un pixel dans l'écran
|
||||
GFX2_GLOBAL Func_display Display_screen; // Affiche rapidement tout l'écran (en faisant attention de ne pas effacer le menu)
|
||||
GFX2_GLOBAL Func_block Block; // Affiche rapidement un bloc à l'écran
|
||||
GFX2_GLOBAL Func_pixel Pixel_preview_normal; // Affiche un point de l'image à l'écran en mode normal (pas en mode loupe)
|
||||
GFX2_GLOBAL Func_pixel Pixel_preview_magnifier; // Affiche un point de l'image à l'écran en mode loupe
|
||||
GFX2_GLOBAL Func_pixel Pixel_preview; // Affiche un point de l'image à l'écran en fonction de l'état du mode loupe
|
||||
GFX2_GLOBAL Func_line_XOR Horizontal_XOR_line;// Affiche une ligne horizontale en XOR (pour placer la loupe)
|
||||
GFX2_GLOBAL Func_line_XOR Vertical_XOR_line; // Affiche une ligne verticale en XOR (pour placer la loupe)
|
||||
GFX2_GLOBAL Func_display_brush_color Display_brush_color; // Affiche une partie de la brosse en couleur
|
||||
GFX2_GLOBAL Func_display_brush_mono Display_brush_mono; // Affiche une partie de la brosse en monochrome
|
||||
GFX2_GLOBAL Func_display_brush_color Clear_brush; // Efface la partie de la brosse affichée à l'écran
|
||||
GFX2_GLOBAL Func_remap Remap_screen; // Remappe une partie de l'écran avec les nouvelles couleurs du menu
|
||||
GFX2_GLOBAL Func_procsline Display_line; // Afficher une ligne
|
||||
GFX2_GLOBAL Func_procsline Display_line_fast; // Afficher une ligne talle quelle (sans la doubler en mode wide)
|
||||
GFX2_GLOBAL Func_procsline Read_line; // Afficher ou lire une ligne
|
||||
GFX2_GLOBAL Func_display_zoom Display_zoomed_screen; // Affiche rapidement toute la partie zoomée à l'écran (en faisant attention de ne pas effacer le menu)
|
||||
|
||||
// Graphic commands
|
||||
|
||||
/// On the screen, draw a point.
|
||||
GFX2_GLOBAL Func_pixel Pixel;
|
||||
/// On screen, draw a point in the menu (do nothing is menu is hidden).
|
||||
GFX2_GLOBAL Func_pixel Pixel_in_menu;
|
||||
/// Test a pixel color from screen.
|
||||
GFX2_GLOBAL Func_read Read_pixel;
|
||||
/// Redraw all screen, without overwriting the menu.
|
||||
GFX2_GLOBAL Func_display Display_screen;
|
||||
/// Draw a rectangle on screen.
|
||||
GFX2_GLOBAL Func_block Block;
|
||||
/// Draw a point from the image to screen (no zoom).
|
||||
GFX2_GLOBAL Func_pixel Pixel_preview_normal;
|
||||
/// Draw a point from the image to screen (magnified part).
|
||||
GFX2_GLOBAL Func_pixel Pixel_preview_magnifier;
|
||||
/// Draw a point from the image to screen (zoomed if needed).
|
||||
GFX2_GLOBAL Func_pixel Pixel_preview;
|
||||
/// Draw a horizontal XOR line on screen.
|
||||
GFX2_GLOBAL Func_line_XOR Horizontal_XOR_line;
|
||||
/// Draw a vertical XOR line on screen.
|
||||
GFX2_GLOBAL Func_line_XOR Vertical_XOR_line;
|
||||
/// Display part of the brush on screen, color mode.
|
||||
GFX2_GLOBAL Func_display_brush_color Display_brush_color;
|
||||
/// Display part of the brush on screen, monochrome mode.
|
||||
GFX2_GLOBAL Func_display_brush_mono Display_brush_mono;
|
||||
/// Clear the brush currently displayed on screen, redrawing the image instead.
|
||||
GFX2_GLOBAL Func_display_brush_color Clear_brush;
|
||||
/// Remap part of the screen after the menu colors have changed.
|
||||
GFX2_GLOBAL Func_remap Remap_screen;
|
||||
/// Draw a line on screen.
|
||||
GFX2_GLOBAL Func_procsline Display_line;
|
||||
/// Draw a line on screen, without doubling it if using wide pixels. (to be used when the line is already doubled in the input buffer)
|
||||
GFX2_GLOBAL Func_procsline Display_line_fast;
|
||||
/// Read a line of pixels from screen.
|
||||
GFX2_GLOBAL Func_procsline Read_line;
|
||||
/// Redraw all magnified part on screen, without overwriting the menu.
|
||||
GFX2_GLOBAL Func_display_zoom Display_zoomed_screen;
|
||||
/// Display part of the brush on the magnified part of screen, color mode.
|
||||
GFX2_GLOBAL Func_display_brush_color_zoom Display_brush_color_zoom;
|
||||
/// Display part of the brush on the magnified part of screen, monochrome mode.
|
||||
GFX2_GLOBAL Func_display_brush_mono_zoom Display_brush_mono_zoom;
|
||||
/// Clear the brush currently displayed on the magnified part of screen, redrawing the image instead.
|
||||
GFX2_GLOBAL Func_display_brush_color_zoom Clear_brush_scaled;
|
||||
/// Draw an arbitrary brush on screen (not the current brush)
|
||||
GFX2_GLOBAL Func_draw_brush Display_brush;
|
||||
// Données sur les dimensions de l'écran
|
||||
|
||||
// Screen data
|
||||
|
||||
GFX2_GLOBAL int Resize_width; // \__ Positionnées lorsque l'utilisateur tire
|
||||
GFX2_GLOBAL int Resize_height; // / un bord de la fenêtre.
|
||||
@ -292,51 +364,51 @@ GFX2_GLOBAL word Menu_palette_cell_width; // Taille d'une couleur de la palette
|
||||
|
||||
// Données sur la fenêtre de menu
|
||||
|
||||
GFX2_GLOBAL byte Window; // Nombre de fenetres empilées. 0 si pas de fenetre ouverte.
|
||||
GFX2_GLOBAL byte Windows_open; // Nombre de fenetres empilées. 0 si pas de fenetre ouverte.
|
||||
|
||||
GFX2_GLOBAL byte Menu_is_visible_before_window; // Le menu était visible avant d'ouvir une fenêtre
|
||||
GFX2_GLOBAL word Menu_Y_before_window; // Ordonnée du menu avant d'ouvrir une fenêtre
|
||||
GFX2_GLOBAL byte Paintbrush_hidden_before_window;// Le pinceau étatit déjà caché avant l'ouverture de la fenetre?
|
||||
|
||||
GFX2_GLOBAL word Window_stack_pos_X[8]; // Position du bord gauche de la fenêtre dans l'écran
|
||||
#define Window_pos_X Window_stack_pos_X[Window-1]
|
||||
#define Window_pos_X Window_stack_pos_X[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL word Window_stack_pos_Y[8]; // Position du bord haut de la fenêtre dans l'écran
|
||||
#define Window_pos_Y Window_stack_pos_Y[Window-1]
|
||||
#define Window_pos_Y Window_stack_pos_Y[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL word Window_stack_width[8]; // Largeur de la fenêtre
|
||||
#define Window_width Window_stack_width[Window-1]
|
||||
#define Window_width Window_stack_width[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL word Window_stack_height[8]; // Hauteur de la fenêtre
|
||||
#define Window_height Window_stack_height[Window-1]
|
||||
#define Window_height Window_stack_height[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL word Window_stack_nb_buttons[8];
|
||||
#define Window_nb_buttons Window_stack_nb_buttons[Window-1]
|
||||
#define Window_nb_buttons Window_stack_nb_buttons[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL T_Normal_button * Window_stack_normal_button_list[8];
|
||||
#define Window_normal_button_list Window_stack_normal_button_list[Window-1]
|
||||
#define Window_normal_button_list Window_stack_normal_button_list[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL T_Palette_button * Window_stack_palette_button_list[8];
|
||||
#define Window_palette_button_list Window_stack_palette_button_list[Window-1]
|
||||
#define Window_palette_button_list Window_stack_palette_button_list[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL T_Scroller_button * Window_stack_scroller_button_list[8];
|
||||
#define Window_scroller_button_list Window_stack_scroller_button_list[Window-1]
|
||||
#define Window_scroller_button_list Window_stack_scroller_button_list[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL T_Special_button * Window_stack_special_button_list[8];
|
||||
#define Window_special_button_list Window_stack_special_button_list[Window-1]
|
||||
#define Window_special_button_list Window_stack_special_button_list[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL T_Dropdown_button * Window_stack_dropdown_button_list[8];
|
||||
#define Window_dropdown_button_list Window_stack_dropdown_button_list[Window-1]
|
||||
#define Window_dropdown_button_list Window_stack_dropdown_button_list[Windows_open-1]
|
||||
|
||||
|
||||
GFX2_GLOBAL int Window_stack_attribute1[8];
|
||||
#define Window_attribute1 Window_stack_attribute1[Window-1]
|
||||
#define Window_attribute1 Window_stack_attribute1[Windows_open-1]
|
||||
|
||||
// Cette variable sert à stocker 2 informations:
|
||||
// - Sur le click d'un scroller, la position active (0-n)
|
||||
// - Sur le click d'une palette, le numero de couleur (0-255).
|
||||
GFX2_GLOBAL int Window_stack_attribute2[8];
|
||||
#define Window_attribute2 Window_stack_attribute2[Window-1]
|
||||
#define Window_attribute2 Window_stack_attribute2[Windows_open-1]
|
||||
|
||||
|
||||
|
||||
@ -528,7 +600,7 @@ GFX2_GLOBAL byte GFX_help_font_t1 [64][6][8];
|
||||
GFX2_GLOBAL byte GFX_help_font_t2 [64][6][8];
|
||||
GFX2_GLOBAL byte GFX_help_font_t3 [64][6][8];
|
||||
GFX2_GLOBAL byte GFX_help_font_t4 [64][6][8];
|
||||
GFX2_GLOBAL byte * Font;
|
||||
GFX2_GLOBAL byte * Menu_font;
|
||||
|
||||
// Les données de l'aide:
|
||||
|
||||
|
||||
2
init.c
2
init.c
@ -412,7 +412,7 @@ void Load_DAT(void)
|
||||
cursor_x+=8;
|
||||
}
|
||||
cursor_y+=8;
|
||||
Font=GFX_system_font;
|
||||
Menu_font=GFX_system_font;
|
||||
|
||||
// Font Fun
|
||||
for (i=0; i<256; i++)
|
||||
|
||||
6
main.c
6
main.c
@ -493,7 +493,7 @@ int Init_program(int argc,char * argv[])
|
||||
// Initialisation des opérations
|
||||
Init_operations();
|
||||
|
||||
Window=0;
|
||||
Windows_open=0;
|
||||
|
||||
// Charger les sprites et la palette
|
||||
Load_DAT();
|
||||
@ -535,9 +535,9 @@ int Init_program(int argc,char * argv[])
|
||||
|
||||
// Prise en compte de la fonte
|
||||
if (Config.Font)
|
||||
Font=GFX_fun_font;
|
||||
Menu_font=GFX_fun_font;
|
||||
else
|
||||
Font=GFX_system_font;
|
||||
Menu_font=GFX_system_font;
|
||||
|
||||
// Allocation de mémoire pour la brosse
|
||||
if (!(Brush =(byte *)malloc( 1* 1))) Error(ERROR_MEMORY);
|
||||
|
||||
60
moteur.c
60
moteur.c
@ -448,7 +448,7 @@ void Move_separator(void)
|
||||
|
||||
// Afficher la barre en XOR
|
||||
Hide_cursor();
|
||||
Window=1;
|
||||
Windows_open=1;
|
||||
Cursor_shape=CURSOR_SHAPE_HORIZONTAL;
|
||||
Vertical_XOR_line(Main_separator_position,0,Menu_Y);
|
||||
Vertical_XOR_line(Main_X_zoom-1,0,Menu_Y);
|
||||
@ -492,7 +492,7 @@ void Move_separator(void)
|
||||
Hide_cursor();
|
||||
Vertical_XOR_line(Main_separator_position,0,Menu_Y);
|
||||
Vertical_XOR_line(Main_X_zoom-1,0,Menu_Y);
|
||||
Window=0;
|
||||
Windows_open=0;
|
||||
Cursor_shape=old_cursor_shape;
|
||||
Compute_magnifier_data();
|
||||
Position_screen_according_to_zoom();
|
||||
@ -961,7 +961,7 @@ void Main_handler(void)
|
||||
// Si le curseur vient de changer de zone
|
||||
|
||||
if ( (button_index!=prev_button_number)
|
||||
|| (!Cursor_in_menu_precedent)
|
||||
|| (!Cursor_in_menu_previous)
|
||||
|| (prev_button_number==BUTTON_CHOOSE_COL) )
|
||||
{
|
||||
// Si le curseur n'est pas sur un bouton
|
||||
@ -1048,24 +1048,24 @@ void Main_handler(void)
|
||||
{
|
||||
if ( (Current_operation!=OPERATION_COLORPICK) && (Current_operation!=OPERATION_REPLACE) )
|
||||
{
|
||||
if(Cursor_in_menu_precedent)
|
||||
if(Cursor_in_menu_previous)
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Cursor_in_menu_precedent)
|
||||
if(Cursor_in_menu_previous)
|
||||
{
|
||||
Print_in_menu("X: Y: ( )",0);
|
||||
}
|
||||
}
|
||||
Cursor_in_menu_precedent = 0;
|
||||
Cursor_in_menu_previous = 0;
|
||||
}
|
||||
|
||||
if(Cursor_in_menu)
|
||||
{
|
||||
Cursor_in_menu_precedent = 1;
|
||||
Cursor_in_menu_previous = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1101,7 +1101,7 @@ void Open_window(word width,word height, char * title)
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
Window++;
|
||||
Windows_open++;
|
||||
|
||||
Window_width=width;
|
||||
Window_height=height;
|
||||
@ -1112,7 +1112,7 @@ void Open_window(word width,word height, char * title)
|
||||
Window_pos_Y=(Screen_height-(height*Menu_factor_Y))>>1;
|
||||
|
||||
// Sauvegarde de ce que la fenêtre remplace
|
||||
Save_background(&(Window_background[Window-1]), Window_pos_X, Window_pos_Y, width, height);
|
||||
Save_background(&(Window_background[Windows_open-1]), Window_pos_X, Window_pos_Y, width, height);
|
||||
|
||||
// Fenêtre grise
|
||||
Block(Window_pos_X+(Menu_factor_X<<1),Window_pos_Y+(Menu_factor_Y<<1),(width-4)*Menu_factor_X,(height-4)*Menu_factor_Y,MC_Light);
|
||||
@ -1129,7 +1129,7 @@ void Open_window(word width,word height, char * title)
|
||||
|
||||
Print_in_window((width-(strlen(title)<<3))>>1,3,title,MC_Black,MC_Light);
|
||||
|
||||
if (Window == 1)
|
||||
if (Windows_open == 1)
|
||||
{
|
||||
Menu_is_visible_before_window=Menu_is_visible;
|
||||
Menu_is_visible=0;
|
||||
@ -1197,19 +1197,19 @@ void Close_window(void)
|
||||
Window_dropdown_button_list=temp5;
|
||||
}
|
||||
|
||||
if (Window != 1)
|
||||
if (Windows_open != 1)
|
||||
{
|
||||
// Restore de ce que la fenêtre cachait
|
||||
Restore_background(Window_background[Window-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
Window_background[Window-1]=NULL;
|
||||
Restore_background(Window_background[Windows_open-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
Window_background[Windows_open-1]=NULL;
|
||||
Update_rect(Window_pos_X,Window_pos_Y,Window_width*Menu_factor_X,Window_height*Menu_factor_Y);
|
||||
Window--;
|
||||
Windows_open--;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(Window_background[Window-1]);
|
||||
Window_background[Window-1]=NULL;
|
||||
Window--;
|
||||
free(Window_background[Windows_open-1]);
|
||||
Window_background[Windows_open-1]=NULL;
|
||||
Windows_open--;
|
||||
|
||||
Paintbrush_hidden=Paintbrush_hidden_before_window;
|
||||
|
||||
@ -1654,7 +1654,7 @@ void Open_popup(word x_pos, word y_pos, word width,word height)
|
||||
// -Pas de titre
|
||||
// -Pas de cadre en relief mais seulement un plat, et il est blanc au lieu de noir.
|
||||
{
|
||||
Window++;
|
||||
Windows_open++;
|
||||
|
||||
Window_width=width;
|
||||
Window_height=height;
|
||||
@ -1662,7 +1662,7 @@ void Open_popup(word x_pos, word y_pos, word width,word height)
|
||||
Window_pos_Y=y_pos;
|
||||
|
||||
// Sauvegarde de ce que la fenêtre remplace
|
||||
Save_background(&(Window_background[Window-1]), Window_pos_X, Window_pos_Y, width, height);
|
||||
Save_background(&(Window_background[Windows_open-1]), Window_pos_X, Window_pos_Y, width, height);
|
||||
|
||||
/*
|
||||
// Fenêtre grise
|
||||
@ -1673,7 +1673,7 @@ void Open_popup(word x_pos, word y_pos, word width,word height)
|
||||
// Frame noir puis en relief
|
||||
Window_display_frame_mono(0,0,width,height,MC_White);
|
||||
*/
|
||||
if (Window == 1)
|
||||
if (Windows_open == 1)
|
||||
{
|
||||
Menu_is_visible_before_window=Menu_is_visible;
|
||||
Menu_is_visible=0;
|
||||
@ -1741,18 +1741,18 @@ void Close_popup(void)
|
||||
Window_dropdown_button_list=temp5;
|
||||
}
|
||||
|
||||
if (Window != 1)
|
||||
if (Windows_open != 1)
|
||||
{
|
||||
// Restore de ce que la fenêtre cachait
|
||||
Restore_background(Window_background[Window-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
Window_background[Window-1]=NULL;
|
||||
Restore_background(Window_background[Windows_open-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
Window_background[Windows_open-1]=NULL;
|
||||
Update_rect(Window_pos_X,Window_pos_Y,Window_width*Menu_factor_X,Window_height*Menu_factor_Y);
|
||||
Window--;
|
||||
Windows_open--;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(Window_background[Window-1]);
|
||||
Window--;
|
||||
free(Window_background[Windows_open-1]);
|
||||
Windows_open--;
|
||||
|
||||
Paintbrush_hidden=Paintbrush_hidden_before_window;
|
||||
|
||||
@ -2069,11 +2069,11 @@ void Move_window(short dx, short dy)
|
||||
Save_background(&buffer, Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
|
||||
// Restore de ce que la fenêtre cachait
|
||||
Restore_background(Window_background[Window-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
Window_background[Window-1] = NULL;
|
||||
Restore_background(Window_background[Windows_open-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
|
||||
Window_background[Windows_open-1] = NULL;
|
||||
|
||||
// Sauvegarde de ce que la fenêtre remplace
|
||||
Save_background(&(Window_background[Window-1]), new_x, new_y, Window_width, Window_height);
|
||||
Save_background(&(Window_background[Windows_open-1]), new_x, new_y, Window_width, Window_height);
|
||||
|
||||
// Raffichage de la fenêtre
|
||||
Restore_background(buffer, new_x, new_y, Window_width, Window_height);
|
||||
@ -2536,7 +2536,7 @@ void Remap_window_backgrounds(byte * conversion_table, int Min_Y, int Max_Y)
|
||||
byte* EDI;
|
||||
int dx,cx;
|
||||
|
||||
for (window_index=0; window_index<Window; window_index++)
|
||||
for (window_index=0; window_index<Windows_open; window_index++)
|
||||
{
|
||||
EDI = Window_background[window_index];
|
||||
|
||||
|
||||
38
pxdouble.c
38
pxdouble.c
@ -35,16 +35,16 @@
|
||||
void Pixel_double (word x,word y,byte color)
|
||||
/* Affiche un pixel de la color aux coords x;y à l'écran */
|
||||
{
|
||||
*(Screen + x * 2 + y * 4 * Screen_width)=color;
|
||||
*(Screen + x * 2 + y * 4 * Screen_width + 1)=color;
|
||||
*(Screen + x * 2 + (y * 4 + 2 )* Screen_width)=color;
|
||||
*(Screen + x * 2 + (y * 4 + 2 )* Screen_width + 1)=color;
|
||||
*(Screen_pixels + x * 2 + y * 4 * Screen_width)=color;
|
||||
*(Screen_pixels + x * 2 + y * 4 * Screen_width + 1)=color;
|
||||
*(Screen_pixels + x * 2 + (y * 4 + 2 )* Screen_width)=color;
|
||||
*(Screen_pixels + x * 2 + (y * 4 + 2 )* Screen_width + 1)=color;
|
||||
}
|
||||
|
||||
byte Read_pixel_double (word x,word y)
|
||||
/* On retourne la couleur du pixel aux coords données */
|
||||
{
|
||||
return *( Screen + y * 4 * Screen_width + x * 2);
|
||||
return *( Screen_pixels + y * 4 * Screen_width + x * 2);
|
||||
}
|
||||
|
||||
void Block_double (word start_x,word start_y,word width,word height,byte color)
|
||||
@ -61,7 +61,7 @@ void Block_double (word start_x,word start_y,word width,word height,byte color)
|
||||
void Display_part_of_screen_double (word width,word height,word image_width)
|
||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||
{
|
||||
byte* dest=Screen; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
int dy;
|
||||
@ -126,7 +126,7 @@ void Pixel_preview_magnifier_double (word x,word y,byte color)
|
||||
void Horizontal_XOR_line_double(word x_pos,word y_pos,word width)
|
||||
{
|
||||
//On calcule la valeur initiale de dest:
|
||||
byte* dest=y_pos*4*Screen_width+x_pos*2+Screen;
|
||||
byte* dest=y_pos*4*Screen_width+x_pos*2+Screen_pixels;
|
||||
|
||||
int x;
|
||||
|
||||
@ -137,7 +137,7 @@ void Horizontal_XOR_line_double(word x_pos,word y_pos,word width)
|
||||
void Vertical_XOR_line_double(word x_pos,word y_pos,word height)
|
||||
{
|
||||
int i;
|
||||
byte *dest=Screen+x_pos*2+y_pos*Screen_width*4;
|
||||
byte *dest=Screen_pixels+x_pos*2+y_pos*Screen_width*4;
|
||||
for (i=height;i>0;i--)
|
||||
{
|
||||
*dest=*(dest+1)=*(dest+Screen_width*2)=*(dest+Screen_width*2+1)=~*dest;
|
||||
@ -148,7 +148,7 @@ void Vertical_XOR_line_double(word x_pos,word y_pos,word height)
|
||||
void Display_brush_color_double(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * 4 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 4 * Screen_width + x_pos * 2;
|
||||
// src = Position dans la brosse
|
||||
byte* src = Brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -183,7 +183,7 @@ void Display_brush_mono_double(word x_pos, word y_pos,
|
||||
byte transp_color, byte color, word brush_width)
|
||||
/* On affiche la brosse en monochrome */
|
||||
{
|
||||
byte* dest=y_pos*4*Screen_width+x_pos*2+Screen; // dest = adr destination à
|
||||
byte* dest=y_pos*4*Screen_width+x_pos*2+Screen_pixels; // dest = adr destination à
|
||||
// l'écran
|
||||
byte* src=brush_width*y_offset+x_offset+Brush; // src = adr ds
|
||||
// la brosse
|
||||
@ -212,7 +212,7 @@ void Display_brush_mono_double(word x_pos, word y_pos,
|
||||
|
||||
void Clear_brush_double(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte transp_color,word image_width)
|
||||
{
|
||||
byte* dest=Screen+x_pos*2+y_pos*4*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels+x_pos*2+y_pos*4*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
int x;
|
||||
@ -241,7 +241,7 @@ void Clear_brush_double(word x_pos,word y_pos,__attribute__((unused)) word x_off
|
||||
void Display_brush_double(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * 4 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 4 * Screen_width + x_pos * 2;
|
||||
// src = Position dans la brosse
|
||||
byte* src = brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -272,7 +272,7 @@ void Display_brush_double(byte * brush, word x_pos,word y_pos,word x_offset,word
|
||||
void Remap_screen_double(word x_pos,word y_pos,word width,word height,byte * conversion_table)
|
||||
{
|
||||
// dest = coords a l'écran
|
||||
byte* dest = Screen + y_pos * 4 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 4 * Screen_width + x_pos * 2;
|
||||
int x,y;
|
||||
|
||||
// Pour chaque ligne
|
||||
@ -296,8 +296,8 @@ void Display_line_on_screen_fast_double(word x_pos,word y_pos,word width,byte *
|
||||
/* On affiche toute une ligne de pixels telle quelle. */
|
||||
/* Utilisée si le buffer contient déja des pixel doublés. */
|
||||
{
|
||||
memcpy(Screen+x_pos*2+y_pos*4*Screen_width,line,width*2);
|
||||
memcpy(Screen+x_pos*2+(y_pos*4+2)*Screen_width,line,width*2);
|
||||
memcpy(Screen_pixels+x_pos*2+y_pos*4*Screen_width,line,width*2);
|
||||
memcpy(Screen_pixels+x_pos*2+(y_pos*4+2)*Screen_width,line,width*2);
|
||||
}
|
||||
|
||||
void Display_line_on_screen_double(word x_pos,word y_pos,word width,byte * line)
|
||||
@ -305,7 +305,7 @@ void Display_line_on_screen_double(word x_pos,word y_pos,word width,byte * line)
|
||||
{
|
||||
int x;
|
||||
byte *dest;
|
||||
dest=Screen+x_pos*2+y_pos*4*Screen_width;
|
||||
dest=Screen_pixels+x_pos*2+y_pos*4*Screen_width;
|
||||
for(x=width;x>0;x--)
|
||||
{
|
||||
*(dest+Screen_width*2+1)=*(dest+Screen_width*2)=*(dest+1)=*dest=*line;
|
||||
@ -319,7 +319,7 @@ void Display_transparent_mono_line_on_screen_double(
|
||||
// Affiche une ligne à l'écran avec une couleur + transparence.
|
||||
// Utilisé par les brosses en mode zoom
|
||||
{
|
||||
byte* dest = Screen+ y_pos*ZOOMX*Screen_width + x_pos*ZOOMX;
|
||||
byte* dest = Screen_pixels+ y_pos*ZOOMX*Screen_width + x_pos*ZOOMX;
|
||||
int x;
|
||||
// Pour chaque pixel
|
||||
for(x=0;x<width;x++)
|
||||
@ -335,7 +335,7 @@ void Display_transparent_mono_line_on_screen_double(
|
||||
|
||||
void Read_line_screen_double(word x_pos,word y_pos,word width,byte * line)
|
||||
{
|
||||
memcpy(line,Screen_width * 4 * y_pos + x_pos * 2 + Screen,width*2);
|
||||
memcpy(line,Screen_width * 4 * y_pos + x_pos * 2 + Screen_pixels,width*2);
|
||||
}
|
||||
|
||||
void Display_part_of_screen_scaled_double(
|
||||
@ -399,7 +399,7 @@ void Display_brush_color_zoom_double(word x_pos,word y_pos,
|
||||
{
|
||||
Display_transparent_line_on_screen_wide(x_pos,y*ZOOMX,width*Main_magnifier_factor,buffer,transp_color);
|
||||
// TODO: pas clair ici
|
||||
memcpy(Screen + (y*ZOOMY+1)*ZOOMX*Screen_width + x_pos*ZOOMX, Screen + y*ZOOMX*ZOOMY*Screen_width + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
||||
memcpy(Screen_pixels + (y*ZOOMY+1)*ZOOMX*Screen_width + x_pos*ZOOMX, Screen_pixels + y*ZOOMX*ZOOMY*Screen_width + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
|
||||
30
pxsimple.c
30
pxsimple.c
@ -31,13 +31,13 @@
|
||||
void Pixel_simple (word x,word y,byte color)
|
||||
/* Affiche un pixel de la color aux coords x;y à l'écran */
|
||||
{
|
||||
*(Screen + x + y * Screen_width)=color;
|
||||
*(Screen_pixels + x + y * Screen_width)=color;
|
||||
}
|
||||
|
||||
byte Read_pixel_simple (word x,word y)
|
||||
/* On retourne la couleur du pixel aux coords données */
|
||||
{
|
||||
return *( Screen + y * Screen_width + x );
|
||||
return *( Screen_pixels + y * Screen_width + x );
|
||||
}
|
||||
|
||||
void Block_simple (word start_x,word start_y,word width,word height,byte color)
|
||||
@ -54,7 +54,7 @@ void Block_simple (word start_x,word start_y,word width,word height,byte color)
|
||||
void Display_part_of_screen_simple (word width,word height,word image_width)
|
||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||
{
|
||||
byte* dest=Screen; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
|
||||
@ -111,7 +111,7 @@ void Pixel_preview_magnifier_simple (word x,word y,byte color)
|
||||
void Horizontal_XOR_line_simple(word x_pos,word y_pos,word width)
|
||||
{
|
||||
//On calcule la valeur initiale de dest:
|
||||
byte* dest=y_pos*Screen_width+x_pos+Screen;
|
||||
byte* dest=y_pos*Screen_width+x_pos+Screen_pixels;
|
||||
|
||||
int x;
|
||||
|
||||
@ -125,15 +125,15 @@ void Vertical_XOR_line_simple(word x_pos,word y_pos,word height)
|
||||
byte color;
|
||||
for (i=y_pos;i<y_pos+height;i++)
|
||||
{
|
||||
color=*(Screen+x_pos+i*Screen_width);
|
||||
*(Screen+x_pos+i*Screen_width)=~color;
|
||||
color=*(Screen_pixels+x_pos+i*Screen_width);
|
||||
*(Screen_pixels+x_pos+i*Screen_width)=~color;
|
||||
}
|
||||
}
|
||||
|
||||
void Display_brush_color_simple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * Screen_width + x_pos;
|
||||
// src = Position dans la brosse
|
||||
byte* src = Brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -167,7 +167,7 @@ void Display_brush_mono_simple(word x_pos, word y_pos,
|
||||
byte transp_color, byte color, word brush_width)
|
||||
/* On affiche la brosse en monochrome */
|
||||
{
|
||||
byte* dest=y_pos*Screen_width+x_pos+Screen; // dest = adr Destination à
|
||||
byte* dest=y_pos*Screen_width+x_pos+Screen_pixels; // dest = adr Destination à
|
||||
// l'écran
|
||||
byte* src=brush_width*y_offset+x_offset+Brush; // src = adr ds
|
||||
// la brosse
|
||||
@ -196,7 +196,7 @@ void Display_brush_mono_simple(word x_pos, word y_pos,
|
||||
|
||||
void Clear_brush_simple(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte transp_color,word image_width)
|
||||
{
|
||||
byte* dest=Screen+x_pos+y_pos*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels+x_pos+y_pos*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
|
||||
@ -217,7 +217,7 @@ void Clear_brush_simple(word x_pos,word y_pos,__attribute__((unused)) word x_off
|
||||
void Display_brush_simple(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * Screen_width + x_pos;
|
||||
// src = Position dans la brosse
|
||||
byte* src = brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -248,7 +248,7 @@ void Display_brush_simple(byte * brush, word x_pos,word y_pos,word x_offset,word
|
||||
void Remap_screen_simple(word x_pos,word y_pos,word width,word height,byte * conversion_table)
|
||||
{
|
||||
// dest = coords a l'écran
|
||||
byte* dest = Screen + y_pos * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * Screen_width + x_pos;
|
||||
int x,y;
|
||||
|
||||
// Pour chaque ligne
|
||||
@ -270,7 +270,7 @@ void Remap_screen_simple(word x_pos,word y_pos,word width,word height,byte * con
|
||||
void Display_line_on_screen_simple(word x_pos,word y_pos,word width,byte * line)
|
||||
/* On affiche toute une ligne de pixels. Utilisé pour les textes. */
|
||||
{
|
||||
memcpy(Screen+x_pos+y_pos*Screen_width,line,width);
|
||||
memcpy(Screen_pixels+x_pos+y_pos*Screen_width,line,width);
|
||||
}
|
||||
|
||||
void Display_transparent_mono_line_on_screen_simple(
|
||||
@ -279,7 +279,7 @@ void Display_transparent_mono_line_on_screen_simple(
|
||||
// Affiche une ligne à l'écran avec une couleur + transparence.
|
||||
// Utilisé par les brosses en mode zoom
|
||||
{
|
||||
byte* dest = Screen+ y_pos * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels+ y_pos * Screen_width + x_pos;
|
||||
int x;
|
||||
// Pour chaque pixel
|
||||
for(x=0;x<width;x++)
|
||||
@ -293,7 +293,7 @@ void Display_transparent_mono_line_on_screen_simple(
|
||||
|
||||
void Read_line_screen_simple(word x_pos,word y_pos,word width,byte * line)
|
||||
{
|
||||
memcpy(line,Screen_width * y_pos + x_pos + Screen,width);
|
||||
memcpy(line,Screen_width * y_pos + x_pos + Screen_pixels,width);
|
||||
}
|
||||
|
||||
void Display_part_of_screen_scaled_simple(
|
||||
@ -339,7 +339,7 @@ void Display_part_of_screen_scaled_simple(
|
||||
void Display_transparent_line_on_screen_simple(word x_pos,word y_pos,word width,byte* line,byte transp_color)
|
||||
{
|
||||
byte* src = line;
|
||||
byte* dest = Screen + y_pos * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * Screen_width + x_pos;
|
||||
|
||||
word x;
|
||||
|
||||
|
||||
34
pxtall.c
34
pxtall.c
@ -32,14 +32,14 @@
|
||||
void Pixel_tall (word x,word y,byte color)
|
||||
/* Affiche un pixel de la color aux coords x;y à l'écran */
|
||||
{
|
||||
*(Screen + x + y * 2 * Screen_width)=color;
|
||||
*(Screen + x + (y * 2 + 1) * Screen_width)=color;
|
||||
*(Screen_pixels + x + y * 2 * Screen_width)=color;
|
||||
*(Screen_pixels + x + (y * 2 + 1) * Screen_width)=color;
|
||||
}
|
||||
|
||||
byte Read_pixel_tall (word x,word y)
|
||||
/* On retourne la couleur du pixel aux coords données */
|
||||
{
|
||||
return *( Screen + y * 2 * Screen_width + x );
|
||||
return *( Screen_pixels + y * 2 * Screen_width + x );
|
||||
}
|
||||
|
||||
void Block_tall (word start_x,word start_y,word width,word height,byte color)
|
||||
@ -56,7 +56,7 @@ void Block_tall (word start_x,word start_y,word width,word height,byte color)
|
||||
void Display_part_of_screen_tall (word width,word height,word image_width)
|
||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||
{
|
||||
byte* dest=Screen; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
|
||||
@ -115,14 +115,14 @@ void Pixel_preview_magnifier_tall (word x,word y,byte color)
|
||||
void Horizontal_XOR_line_tall(word x_pos,word y_pos,word width)
|
||||
{
|
||||
//On calcule la valeur initiale de dest:
|
||||
byte* dest=y_pos*2*Screen_width+x_pos+Screen;
|
||||
byte* dest=y_pos*2*Screen_width+x_pos+Screen_pixels;
|
||||
|
||||
int x;
|
||||
|
||||
for (x=0;x<width;x++)
|
||||
*(dest+x)=~*(dest+x);
|
||||
|
||||
dest=(y_pos*2+1)*Screen_width+x_pos+Screen;
|
||||
dest=(y_pos*2+1)*Screen_width+x_pos+Screen_pixels;
|
||||
for (x=0;x<width;x++)
|
||||
*(dest+x)=~*(dest+x);
|
||||
}
|
||||
@ -133,15 +133,15 @@ void Vertical_XOR_line_tall(word x_pos,word y_pos,word height)
|
||||
byte color;
|
||||
for (i=y_pos*2;i<(y_pos+height)*2;i++)
|
||||
{
|
||||
color=*(Screen+x_pos+i*Screen_width);
|
||||
*(Screen+x_pos+i*Screen_width)=~color;
|
||||
color=*(Screen_pixels+x_pos+i*Screen_width);
|
||||
*(Screen_pixels+x_pos+i*Screen_width)=~color;
|
||||
}
|
||||
}
|
||||
|
||||
void Display_brush_color_tall(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos;
|
||||
// src = Position dans la brosse
|
||||
byte* src = Brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -176,7 +176,7 @@ void Display_brush_mono_tall(word x_pos, word y_pos,
|
||||
byte transp_color, byte color, word brush_width)
|
||||
/* On affiche la brosse en monochrome */
|
||||
{
|
||||
byte* dest=y_pos*2*Screen_width+x_pos+Screen; // dest = adr Destination à
|
||||
byte* dest=y_pos*2*Screen_width+x_pos+Screen_pixels; // dest = adr Destination à
|
||||
// l'écran
|
||||
byte* src=brush_width*y_offset+x_offset+Brush; // src = adr ds
|
||||
// la brosse
|
||||
@ -208,7 +208,7 @@ void Display_brush_mono_tall(word x_pos, word y_pos,
|
||||
|
||||
void Clear_brush_tall(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte transp_color,word image_width)
|
||||
{
|
||||
byte* dest=Screen+x_pos+y_pos*2*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels+x_pos+y_pos*2*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
|
||||
@ -231,7 +231,7 @@ void Clear_brush_tall(word x_pos,word y_pos,__attribute__((unused)) word x_offse
|
||||
void Display_brush_tall(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos;
|
||||
// src = Position dans la brosse
|
||||
byte* src = brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -263,7 +263,7 @@ void Display_brush_tall(byte * brush, word x_pos,word y_pos,word x_offset,word y
|
||||
void Remap_screen_tall(word x_pos,word y_pos,word width,word height,byte * conversion_table)
|
||||
{
|
||||
// dest = coords a l'écran
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos;
|
||||
int x,y;
|
||||
|
||||
// Pour chaque ligne
|
||||
@ -285,13 +285,13 @@ void Remap_screen_tall(word x_pos,word y_pos,word width,word height,byte * conve
|
||||
void Display_line_on_screen_tall(word x_pos,word y_pos,word width,byte * line)
|
||||
/* On affiche toute une ligne de pixels. Utilisé pour les textes. */
|
||||
{
|
||||
memcpy(Screen+x_pos+y_pos*2*Screen_width,line,width);
|
||||
memcpy(Screen+x_pos+(y_pos*2+1)*Screen_width,line,width);
|
||||
memcpy(Screen_pixels+x_pos+y_pos*2*Screen_width,line,width);
|
||||
memcpy(Screen_pixels+x_pos+(y_pos*2+1)*Screen_width,line,width);
|
||||
}
|
||||
|
||||
void Read_line_screen_tall(word x_pos,word y_pos,word width,byte * line)
|
||||
{
|
||||
memcpy(line,Screen_width * 2 * y_pos + x_pos + Screen,width);
|
||||
memcpy(line,Screen_width * 2 * y_pos + x_pos + Screen_pixels,width);
|
||||
}
|
||||
|
||||
void Display_part_of_screen_scaled_tall(
|
||||
@ -354,7 +354,7 @@ void Display_brush_color_zoom_tall(word x_pos,word y_pos,
|
||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
||||
{
|
||||
Display_transparent_line_on_screen_simple(x_pos,y*2,width*Main_magnifier_factor,buffer,transp_color);
|
||||
memcpy(Screen + (y*2 +1) * Screen_width + x_pos, Screen + y*2* Screen_width + x_pos, width*Main_magnifier_factor);
|
||||
memcpy(Screen_pixels + (y*2 +1) * Screen_width + x_pos, Screen_pixels + y*2* Screen_width + x_pos, width*Main_magnifier_factor);
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
|
||||
32
pxwide.c
32
pxwide.c
@ -31,14 +31,14 @@
|
||||
void Pixel_wide (word x,word y,byte color)
|
||||
/* Affiche un pixel de la color aux coords x;y à l'écran */
|
||||
{
|
||||
*(Screen + x * 2 + y * 2 * Screen_width)=color;
|
||||
*(Screen + x * 2 + y * 2 * Screen_width + 1)=color;
|
||||
*(Screen_pixels + x * 2 + y * 2 * Screen_width)=color;
|
||||
*(Screen_pixels + x * 2 + y * 2 * Screen_width + 1)=color;
|
||||
}
|
||||
|
||||
byte Read_pixel_wide (word x,word y)
|
||||
/* On retourne la couleur du pixel aux coords données */
|
||||
{
|
||||
return *( Screen + y * 2 * Screen_width + x * 2);
|
||||
return *( Screen_pixels + y * 2 * Screen_width + x * 2);
|
||||
}
|
||||
|
||||
void Block_wide (word start_x,word start_y,word width,word height,byte color)
|
||||
@ -55,7 +55,7 @@ void Block_wide (word start_x,word start_y,word width,word height,byte color)
|
||||
void Display_part_of_screen_wide (word width,word height,word image_width)
|
||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||
{
|
||||
byte* dest=Screen; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
int dy;
|
||||
@ -118,7 +118,7 @@ void Pixel_preview_magnifier_wide (word x,word y,byte color)
|
||||
void Horizontal_XOR_line_wide(word x_pos,word y_pos,word width)
|
||||
{
|
||||
//On calcule la valeur initiale de dest:
|
||||
byte* dest=y_pos*2*Screen_width+x_pos*2+Screen;
|
||||
byte* dest=y_pos*2*Screen_width+x_pos*2+Screen_pixels;
|
||||
|
||||
int x;
|
||||
|
||||
@ -130,7 +130,7 @@ void Vertical_XOR_line_wide(word x_pos,word y_pos,word height)
|
||||
{
|
||||
int i;
|
||||
byte color;
|
||||
byte *dest=Screen+x_pos*2+y_pos*Screen_width*2;
|
||||
byte *dest=Screen_pixels+x_pos*2+y_pos*Screen_width*2;
|
||||
for (i=height;i>0;i--)
|
||||
{
|
||||
color=~*dest;
|
||||
@ -143,7 +143,7 @@ void Vertical_XOR_line_wide(word x_pos,word y_pos,word height)
|
||||
void Display_brush_color_wide(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
// src = Position dans la brosse
|
||||
byte* src = Brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -178,7 +178,7 @@ void Display_brush_mono_wide(word x_pos, word y_pos,
|
||||
byte transp_color, byte color, word brush_width)
|
||||
/* On affiche la brosse en monochrome */
|
||||
{
|
||||
byte* dest=y_pos*2*Screen_width+x_pos*2+Screen; // dest = adr Destination à
|
||||
byte* dest=y_pos*2*Screen_width+x_pos*2+Screen_pixels; // dest = adr Destination à
|
||||
// l'écran
|
||||
byte* src=brush_width*y_offset+x_offset+Brush; // src = adr ds
|
||||
// la brosse
|
||||
@ -207,7 +207,7 @@ void Display_brush_mono_wide(word x_pos, word y_pos,
|
||||
|
||||
void Clear_brush_wide(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte transp_color,word image_width)
|
||||
{
|
||||
byte* dest=Screen+x_pos*2+y_pos*2*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* dest=Screen_pixels+x_pos*2+y_pos*2*Screen_width; //On va se mettre en 0,0 dans l'écran (dest)
|
||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||
int y;
|
||||
int x;
|
||||
@ -236,7 +236,7 @@ void Clear_brush_wide(word x_pos,word y_pos,__attribute__((unused)) word x_offse
|
||||
void Display_brush_wide(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
|
||||
{
|
||||
// dest = Position à l'écran
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
// src = Position dans la brosse
|
||||
byte* src = brush + y_offset * brush_width + x_offset;
|
||||
|
||||
@ -267,7 +267,7 @@ void Display_brush_wide(byte * brush, word x_pos,word y_pos,word x_offset,word y
|
||||
void Remap_screen_wide(word x_pos,word y_pos,word width,word height,byte * conversion_table)
|
||||
{
|
||||
// dest = coords a l'écran
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
int x,y;
|
||||
|
||||
// Pour chaque ligne
|
||||
@ -290,7 +290,7 @@ void Display_line_on_screen_fast_wide(word x_pos,word y_pos,word width,byte * li
|
||||
/* On affiche toute une ligne de pixels telle quelle. */
|
||||
/* Utilisée si le buffer contient déja des pixel doublés. */
|
||||
{
|
||||
memcpy(Screen+x_pos*2+y_pos*2*Screen_width,line,width*2);
|
||||
memcpy(Screen_pixels+x_pos*2+y_pos*2*Screen_width,line,width*2);
|
||||
}
|
||||
|
||||
void Display_line_on_screen_wide(word x_pos,word y_pos,word width,byte * line)
|
||||
@ -298,7 +298,7 @@ void Display_line_on_screen_wide(word x_pos,word y_pos,word width,byte * line)
|
||||
{
|
||||
int x;
|
||||
byte *dest;
|
||||
dest=Screen+x_pos*2+y_pos*2*Screen_width;
|
||||
dest=Screen_pixels+x_pos*2+y_pos*2*Screen_width;
|
||||
for(x=width;x>0;x--)
|
||||
{
|
||||
*dest=*line;
|
||||
@ -314,7 +314,7 @@ void Display_transparent_mono_line_on_screen_wide(
|
||||
// Affiche une ligne à l'écran avec une couleur + transparence.
|
||||
// Utilisé par les brosses en mode zoom
|
||||
{
|
||||
byte* dest = Screen+ y_pos*2 * Screen_width + x_pos*2;
|
||||
byte* dest = Screen_pixels+ y_pos*2 * Screen_width + x_pos*2;
|
||||
int x;
|
||||
// Pour chaque pixel
|
||||
for(x=0;x<width;x++)
|
||||
@ -331,7 +331,7 @@ void Display_transparent_mono_line_on_screen_wide(
|
||||
|
||||
void Read_line_screen_wide(word x_pos,word y_pos,word width,byte * line)
|
||||
{
|
||||
memcpy(line,Screen_width * 2 * y_pos + x_pos * 2 + Screen,width*2);
|
||||
memcpy(line,Screen_width * 2 * y_pos + x_pos * 2 + Screen_pixels,width*2);
|
||||
}
|
||||
|
||||
void Display_part_of_screen_scaled_wide(
|
||||
@ -377,7 +377,7 @@ void Display_part_of_screen_scaled_wide(
|
||||
void Display_transparent_line_on_screen_wide(word x_pos,word y_pos,word width,byte* line,byte transp_color)
|
||||
{
|
||||
byte* src = line;
|
||||
byte* dest = Screen + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
byte* dest = Screen_pixels + y_pos * 2 * Screen_width + x_pos * 2;
|
||||
|
||||
word x;
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
|
||||
*width = Screen_SDL->w;
|
||||
*height = Screen_SDL->h;
|
||||
}
|
||||
Screen=Screen_SDL->pixels;
|
||||
Screen_pixels=Screen_SDL->pixels;
|
||||
}
|
||||
else
|
||||
DEBUG("Error changement de mode video !!",0);
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
void Set_mode_SDL(int *,int *,int);
|
||||
|
||||
SDL_Rect ** List_SDL_video_modes;
|
||||
byte* Screen;
|
||||
byte* Screen_pixels;
|
||||
|
||||
void Update_rect(short x, short y, unsigned short width, unsigned short height);
|
||||
void Flush_update(void);
|
||||
|
||||
144
texte.c
144
texte.c
@ -68,7 +68,7 @@ typedef struct T_Font
|
||||
struct T_Font * Previous;
|
||||
} T_Font;
|
||||
// Liste chainée des polices de texte
|
||||
T_Font * Font_list_start;
|
||||
T_Font * font_list_start;
|
||||
int Nb_fonts;
|
||||
|
||||
// Inspiré par Allegro
|
||||
@ -87,8 +87,8 @@ int Compare_fonts(T_Font * font_1, T_Font * font_2)
|
||||
// Ajout d'une fonte à la liste.
|
||||
void Add_font(const char *name)
|
||||
{
|
||||
char * Font_name;
|
||||
T_Font * Font;
|
||||
char * font_name;
|
||||
T_Font * font;
|
||||
int size=strlen(name)+1;
|
||||
int index;
|
||||
|
||||
@ -114,7 +114,7 @@ void Add_font(const char *name)
|
||||
return;
|
||||
#endif
|
||||
|
||||
Font = (T_Font *)malloc(sizeof(T_Font));
|
||||
font = (T_Font *)malloc(sizeof(T_Font));
|
||||
|
||||
switch (EXTID(tolower(name[size-4]), tolower(name[size-3]), tolower(name[size-2])))
|
||||
{
|
||||
@ -122,8 +122,8 @@ void Add_font(const char *name)
|
||||
case EXTID('f','o','n'):
|
||||
case EXTID('o','t','f'):
|
||||
case EXTID('p','f','b'):
|
||||
Font->Is_truetype = 1;
|
||||
Font->Is_bitmap = 0;
|
||||
font->Is_truetype = 1;
|
||||
font->Is_bitmap = 0;
|
||||
break;
|
||||
case EXTID('b','m','p'):
|
||||
case EXTID('g','i','f'):
|
||||
@ -136,84 +136,84 @@ void Add_font(const char *name)
|
||||
case EXTID('x','c','f'):
|
||||
case EXTID('x','p','m'):
|
||||
case EXTID('.','x','v'):
|
||||
Font->Is_truetype = 0;
|
||||
Font->Is_bitmap = 1;
|
||||
font->Is_truetype = 0;
|
||||
font->Is_bitmap = 1;
|
||||
break;
|
||||
default:
|
||||
#ifdef __macosx__
|
||||
if(strcasecmp(&name[size-6], "dfont") == 0)
|
||||
{
|
||||
Font->Is_truetype = 1;
|
||||
Font->Is_bitmap = 0;
|
||||
font->Is_truetype = 1;
|
||||
font->Is_bitmap = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(Font);
|
||||
free(font);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
free(Font);
|
||||
free(font);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
Font->Name = (char *)malloc(size);
|
||||
strcpy(Font->Name, name);
|
||||
font->Name = (char *)malloc(size);
|
||||
strcpy(font->Name, name);
|
||||
// Label
|
||||
strcpy(Font->Label, " ");
|
||||
if (Font->Is_truetype)
|
||||
Font->Label[17]=Font->Label[18]='T'; // Logo TT
|
||||
Font_name=Find_last_slash(Font->Name);
|
||||
if (Font_name==NULL)
|
||||
Font_name=Font->Name;
|
||||
strcpy(font->Label, " ");
|
||||
if (font->Is_truetype)
|
||||
font->Label[17]=font->Label[18]='T'; // Logo TT
|
||||
font_name=Find_last_slash(font->Name);
|
||||
if (font_name==NULL)
|
||||
font_name=font->Name;
|
||||
else
|
||||
Font_name++;
|
||||
for (index=0; index < 17 && Font_name[index]!='\0' && Font_name[index]!='.'; index++)
|
||||
Font->Label[index]=Font_name[index];
|
||||
font_name++;
|
||||
for (index=0; index < 17 && font_name[index]!='\0' && font_name[index]!='.'; index++)
|
||||
font->Label[index]=font_name[index];
|
||||
|
||||
// Gestion Liste
|
||||
Font->Next = NULL;
|
||||
Font->Previous = NULL;
|
||||
if (Font_list_start==NULL)
|
||||
font->Next = NULL;
|
||||
font->Previous = NULL;
|
||||
if (font_list_start==NULL)
|
||||
{
|
||||
// Premiere (liste vide)
|
||||
Font_list_start = Font;
|
||||
font_list_start = font;
|
||||
Nb_fonts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int compare;
|
||||
compare = Compare_fonts(Font, Font_list_start);
|
||||
compare = Compare_fonts(font, font_list_start);
|
||||
if (compare<=0)
|
||||
{
|
||||
if (compare==0 && !strcmp(Font->Name, Font_list_start->Name))
|
||||
if (compare==0 && !strcmp(font->Name, font_list_start->Name))
|
||||
{
|
||||
// Doublon
|
||||
free(Font->Name);
|
||||
free(Font);
|
||||
free(font->Name);
|
||||
free(font);
|
||||
return;
|
||||
}
|
||||
// Avant la premiere
|
||||
Font->Next=Font_list_start;
|
||||
Font_list_start=Font;
|
||||
font->Next=font_list_start;
|
||||
font_list_start=font;
|
||||
Nb_fonts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
T_Font *searched_font;
|
||||
searched_font=Font_list_start;
|
||||
while (searched_font->Next && (compare=Compare_fonts(Font, searched_font->Next))>0)
|
||||
searched_font=font_list_start;
|
||||
while (searched_font->Next && (compare=Compare_fonts(font, searched_font->Next))>0)
|
||||
searched_font=searched_font->Next;
|
||||
// Après searched_font
|
||||
if (compare==0 && strcmp(Font->Name, searched_font->Next->Name)==0)
|
||||
if (compare==0 && strcmp(font->Name, searched_font->Next->Name)==0)
|
||||
{
|
||||
// Doublon
|
||||
free(Font->Name);
|
||||
free(Font);
|
||||
free(font->Name);
|
||||
free(font);
|
||||
return;
|
||||
}
|
||||
Font->Next=searched_font->Next;
|
||||
searched_font->Next=Font;
|
||||
font->Next=searched_font->Next;
|
||||
searched_font->Next=font;
|
||||
Nb_fonts++;
|
||||
}
|
||||
}
|
||||
@ -223,12 +223,12 @@ void Add_font(const char *name)
|
||||
// Trouve le nom d'une fonte par son numéro
|
||||
char * Font_name(int index)
|
||||
{
|
||||
T_Font *Font = Font_list_start;
|
||||
T_Font *font = font_list_start;
|
||||
if (index<0 ||index>=Nb_fonts)
|
||||
return "";
|
||||
while (index--)
|
||||
Font = Font->Next;
|
||||
return Font->Name;
|
||||
font = font->Next;
|
||||
return font->Name;
|
||||
}
|
||||
|
||||
|
||||
@ -236,20 +236,20 @@ char * Font_name(int index)
|
||||
// Renvoie un pointeur sur un buffer statique de 20 caracteres.
|
||||
char * Font_label(int index)
|
||||
{
|
||||
T_Font *Font;
|
||||
T_Font *font;
|
||||
static char label[20];
|
||||
|
||||
strcpy(label, " ");
|
||||
|
||||
// Recherche de la fonte
|
||||
Font = Font_list_start;
|
||||
font = font_list_start;
|
||||
if (index<0 ||index>=Nb_fonts)
|
||||
return label;
|
||||
while (index--)
|
||||
Font = Font->Next;
|
||||
font = font->Next;
|
||||
|
||||
// Libellé
|
||||
strcpy(label, Font->Label);
|
||||
strcpy(label, font->Label);
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -257,12 +257,12 @@ char * Font_label(int index)
|
||||
// Vérifie si une fonte donnée est TrueType
|
||||
int TrueType_font(int index)
|
||||
{
|
||||
T_Font *Font = Font_list_start;
|
||||
T_Font *font = font_list_start;
|
||||
if (index<0 ||index>=Nb_fonts)
|
||||
return 0;
|
||||
while (index--)
|
||||
Font = Font->Next;
|
||||
return Font->Is_truetype;
|
||||
font = font->Next;
|
||||
return font->Is_truetype;
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +277,7 @@ void Init_text(void)
|
||||
#endif
|
||||
|
||||
// Initialisation des fontes
|
||||
Font_list_start = NULL;
|
||||
font_list_start = NULL;
|
||||
Nb_fonts=0;
|
||||
// Parcours du répertoire "fonts"
|
||||
strcpy(directory_name, Repertoire_des_donnees);
|
||||
@ -369,7 +369,7 @@ int TrueType_is_supported()
|
||||
#ifndef NOTTF
|
||||
byte *Render_text_TTF(const char *str, int font_number, int size, int antialias, int bold, int italic, int *width, int *height)
|
||||
{
|
||||
TTF_Font *Font;
|
||||
TTF_Font *font;
|
||||
SDL_Surface * TexteColore;
|
||||
SDL_Surface * Texte8Bit;
|
||||
byte * new_brush;
|
||||
@ -380,8 +380,8 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
||||
SDL_Color Couleur_Arriere;
|
||||
|
||||
// Chargement de la fonte
|
||||
Font=TTF_OpenFont(Font_name(font_number), size);
|
||||
if (!Font)
|
||||
font=TTF_OpenFont(Font_name(font_number), size);
|
||||
if (!font)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -391,7 +391,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
||||
style|=TTF_STYLE_ITALIC;
|
||||
if (bold)
|
||||
style|=TTF_STYLE_BOLD;
|
||||
TTF_SetFontStyle(Font, style);
|
||||
TTF_SetFontStyle(font, style);
|
||||
// Couleurs
|
||||
if (antialias)
|
||||
{
|
||||
@ -407,12 +407,12 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
||||
|
||||
// Rendu du texte: crée une surface SDL RGB 24bits
|
||||
if (antialias)
|
||||
TexteColore=TTF_RenderText_Shaded(Font, str, Couleur_Avant, Couleur_Arriere );
|
||||
TexteColore=TTF_RenderText_Shaded(font, str, Couleur_Avant, Couleur_Arriere );
|
||||
else
|
||||
TexteColore=TTF_RenderText_Solid(Font, str, Couleur_Avant);
|
||||
TexteColore=TTF_RenderText_Solid(font, str, Couleur_Avant);
|
||||
if (!TexteColore)
|
||||
{
|
||||
TTF_CloseFont(Font);
|
||||
TTF_CloseFont(font);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
||||
{
|
||||
SDL_FreeSurface(TexteColore);
|
||||
SDL_FreeSurface(Texte8Bit);
|
||||
TTF_CloseFont(Font);
|
||||
TTF_CloseFont(font);
|
||||
return NULL;
|
||||
}
|
||||
if (!antialias)
|
||||
@ -442,7 +442,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
||||
*width=Texte8Bit->w;
|
||||
*height=Texte8Bit->h;
|
||||
SDL_FreeSurface(Texte8Bit);
|
||||
TTF_CloseFont(Font);
|
||||
TTF_CloseFont(font);
|
||||
return new_brush;
|
||||
}
|
||||
#endif
|
||||
@ -450,7 +450,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
||||
|
||||
byte *Render_text_SFont(const char *str, int font_number, int *width, int *height)
|
||||
{
|
||||
SFont_Font *Font;
|
||||
SFont_Font *font;
|
||||
SDL_Surface * TexteColore;
|
||||
SDL_Surface * Texte8Bit;
|
||||
SDL_Surface *Surface_fonte;
|
||||
@ -460,22 +460,22 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
|
||||
Surface_fonte=IMG_Load(Font_name(font_number));
|
||||
if (!Surface_fonte)
|
||||
return NULL;
|
||||
Font=SFont_InitFont(Surface_fonte);
|
||||
if (!Font)
|
||||
font=SFont_InitFont(Surface_fonte);
|
||||
if (!font)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Calcul des dimensions
|
||||
*height=SFont_TextHeight(Font);
|
||||
*width=SFont_TextWidth(Font, str);
|
||||
*height=SFont_TextHeight(font);
|
||||
*width=SFont_TextWidth(font, str);
|
||||
// Allocation d'une surface SDL
|
||||
TexteColore=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 24, 0, 0, 0, 0);
|
||||
// Rendu du texte
|
||||
SFont_Write(TexteColore, Font, 0, 0, str);
|
||||
SFont_Write(TexteColore, font, 0, 0, str);
|
||||
if (!TexteColore)
|
||||
{
|
||||
SFont_FreeFont(Font);
|
||||
SFont_FreeFont(font);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -487,11 +487,11 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
|
||||
{
|
||||
SDL_FreeSurface(TexteColore);
|
||||
SDL_FreeSurface(Texte8Bit);
|
||||
SFont_FreeFont(Font);
|
||||
SFont_FreeFont(font);
|
||||
return NULL;
|
||||
}
|
||||
SDL_FreeSurface(Texte8Bit);
|
||||
SFont_FreeFont(Font);
|
||||
SFont_FreeFont(font);
|
||||
|
||||
return new_brush;
|
||||
}
|
||||
@ -502,7 +502,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
|
||||
// et retourne l'adresse du bloc d'octets.
|
||||
byte *Render_text(const char *str, int font_number, int size, int antialias, int bold, int italic, int *width, int *height)
|
||||
{
|
||||
T_Font *Font = Font_list_start;
|
||||
T_Font *font = font_list_start;
|
||||
int index=font_number;
|
||||
|
||||
// Verification type de la fonte
|
||||
@ -510,8 +510,8 @@ byte *Render_text(const char *str, int font_number, int size, int antialias, int
|
||||
return NULL;
|
||||
|
||||
while (index--)
|
||||
Font = Font->Next;
|
||||
if (Font->Is_truetype)
|
||||
font = font->Next;
|
||||
if (font->Is_truetype)
|
||||
{
|
||||
#ifndef NOTTF
|
||||
return Render_text_TTF(str, font_number, size, antialias, bold, italic, width, height);
|
||||
|
||||
12
windows.c
12
windows.c
@ -359,7 +359,7 @@ void Display_menu(void)
|
||||
Display_foreback();
|
||||
|
||||
|
||||
if (!Window)
|
||||
if (!Windows_open)
|
||||
{
|
||||
if ((Mouse_Y<Menu_Y) && // Souris dans l'image
|
||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ))
|
||||
@ -405,7 +405,7 @@ void Print_general(short x,short y,const char * str,byte text_color,byte backgro
|
||||
for (index=0;str[index]!='\0';index++)
|
||||
{
|
||||
// Pointeur sur le premier pixel du caractère
|
||||
font_pixel=Font+(((unsigned char)str[index])<<6);
|
||||
font_pixel=Menu_font+(((unsigned char)str[index])<<6);
|
||||
for (x_pos=0;x_pos<8;x_pos+=1)
|
||||
for (repeat_menu_x_factor=0;repeat_menu_x_factor<Menu_factor_X*Pixel_width;repeat_menu_x_factor++)
|
||||
Horizontal_line_buffer[real_x++]=*(font_pixel+x_pos+y_pos)?text_color:background_color;
|
||||
@ -424,7 +424,7 @@ void Print_char_in_window(short x_pos,short y_pos,const unsigned char c,byte tex
|
||||
x_pos=(x_pos*Menu_factor_X)+Window_pos_X;
|
||||
y_pos=(y_pos*Menu_factor_Y)+Window_pos_Y;
|
||||
// Premier pixel du caractère
|
||||
pixel=Font + (c<<6);
|
||||
pixel=Menu_font + (c<<6);
|
||||
|
||||
for (y=0;y<8;y++)
|
||||
for (x=0;x<8;x++)
|
||||
@ -442,7 +442,7 @@ void Print_transparent_char_in_window(short x_pos,short y_pos,const unsigned cha
|
||||
x_pos=(x_pos*Menu_factor_X)+Window_pos_X;
|
||||
y_pos=(y_pos*Menu_factor_Y)+Window_pos_Y;
|
||||
// Premier pixel du caractère
|
||||
pixel=Font + (c<<6);
|
||||
pixel=Menu_font + (c<<6);
|
||||
|
||||
for (y=0;y<8;y++)
|
||||
for (x=0;x<8;x++)
|
||||
@ -1483,7 +1483,7 @@ void Display_cursor(void)
|
||||
// Si le curseur est dans le menu ou sur la barre de split, on affiche toujours une flèche.
|
||||
if ( ( (Mouse_Y<Menu_Y)
|
||||
&& ( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
||||
|| (Window) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
||||
|| (Windows_open) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
||||
shape=Cursor_shape;
|
||||
else
|
||||
shape=CURSOR_SHAPE_ARROW;
|
||||
@ -1787,7 +1787,7 @@ void Hide_cursor(void)
|
||||
if ( ( (Mouse_Y<Menu_Y)
|
||||
&& ( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position)
|
||||
|| (Mouse_X>=Main_X_zoom) ) )
|
||||
|| (Window) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
||||
|| (Windows_open) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
||||
shape=Cursor_shape;
|
||||
else
|
||||
shape=CURSOR_SHAPE_ARROW;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user