First drawing functions. We can see the interface !

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@25 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2007-09-20 15:37:39 +00:00
parent d003a5c168
commit 28e0cdbaf1
5 changed files with 6265 additions and 6221 deletions

10930
boutons.c

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,17 @@ word Palette_Compter_nb_couleurs_utilisees(dword* Tableau)
void Set_palette(T_Palette Palette)
{
puts("Set_Palette non implémenté!\n");
SDL_Color PaletteSDL[255];
byte i=0;
do
{
PaletteSDL[i].r=Palette[i].R*4; //Les couleurs VGA ne vont que de 0 à 63
PaletteSDL[i].g=Palette[i].V*4;
PaletteSDL[i].b=Palette[i].B*4;
i++;
}
while(i!=0);
SDL_SetPalette(Ecran_SDL,SDL_PHYSPAL|SDL_LOGPAL,PaletteSDL,0,256);
}
void Attendre_fin_de_click(void)

1500
global.h

File diff suppressed because it is too large Load Diff

View File

@ -1328,6 +1328,7 @@ void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur
for (Repeat_Menu_Facteur_Y=0;Repeat_Menu_Facteur_Y<Menu_Facteur_Y;Repeat_Menu_Facteur_Y++)
Afficher_ligne(X,Reel_Y++,Largeur,Buffer_de_ligne_horizontale);
}
puts("GENERAL");
}
// -- Afficher un caractère dans une fenêtre --
@ -1362,6 +1363,7 @@ void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,char Caractere,
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y, Couleur);
}
puts("FENETRE");
}
// -- Afficher une chaŒne dans une fenêtre --

View File

@ -1,14 +1,22 @@
#include <SDL/SDL.h>
#include "global.h"
#include "sdlscreen.h"
void Pixel_SDL (word X,word Y,byte Couleur)
{
puts("Pixel_SDL non implémenté!\n");
*(((Uint8 *)Ecran_SDL->pixels) + Y * Ecran_SDL->pitch + X)=Couleur;
// SDL_UpdateRect(Ecran_SDL,X,Y,0,0);
}
static inline void Pixel_SDL_Fast(word X, word Y,byte Couleur)
{
*(((byte *)Ecran_SDL->pixels) + Y * Ecran_SDL->pitch +X)=Couleur;
}
byte Lit_Pixel_SDL (word X,word Y)
{
puts("Lit_Pixel_SDL non implémenté!\n");
return 0;
Uint8 * p = ((Uint8 *)Ecran_SDL->pixels) + Y * Ecran_SDL -> pitch + X * Ecran_SDL -> format -> BytesPerPixel;
return *p;
}
void Effacer_Tout_l_Ecran_SDL (byte Couleur)
@ -23,7 +31,13 @@ void Afficher_partie_de_l_ecran_SDL (word Largeur,word Hauteur,word Largeu
void Block_SDL (word Debut_X,word Debut_Y,word Largeur,word Hauteur,byte Couleur)
{
puts("Block_SDL non implémenté!\n");
SDL_Rect rectangle;
rectangle.x=Debut_X;
rectangle.y=Debut_Y;
rectangle.w=Largeur;
rectangle.h=Hauteur;
SDL_FillRect(Ecran_SDL,&rectangle,Couleur);
SDL_UpdateRect(Ecran_SDL,Debut_X,Debut_Y,Largeur,Hauteur);
}
void Pixel_Preview_Normal_SDL (word X,word Y,byte Couleur)
@ -53,7 +67,16 @@ void Display_brush_Color_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decala
void Display_brush_Mono_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse)
{
puts("Display_brush_Mono_SDL non implémenté!\n");
int i,j;
for(i=0;i<Hauteur;i++)
{
for(j=0;j<Largeur;j++)
{
if (*(Brosse+Decalage_X+Brosse_Largeur*Decalage_Y)==Couleur_de_transparence)
Pixel_SDL_Fast(Pos_X+j,Pos_Y+i,Couleur);
}
}
SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y,Largeur,Hauteur);
}
void Clear_brush_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_image)
@ -68,7 +91,12 @@ void Remap_screen_SDL (word Pos_X,word Pos_Y,word Largeur,word Hauteur,b
void Afficher_une_ligne_ecran_SDL (word Pos_X,word Pos_Y,word Largeur,byte * Ligne)
{
puts("Afficher_une_ligne_ecran_SDL non implémenté!\n");
int i;
for(i=0;i<Largeur;i++)
{
Pixel_SDL_Fast(Ecran_SDL,Pos_X+i,Pos_Y);
}
SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y,Largeur,1);
}
void Lire_une_ligne_ecran_SDL (word Pos_X,word Pos_Y,word Largeur,byte * Ligne)
@ -98,5 +126,5 @@ void Clear_brush_zoom_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Dec
void Set_Mode_SDL()
{
puts("Set_Mode_SDL non implémenté!\n");
Ecran_SDL=SDL_SetVideoMode(Largeur_ecran,Hauteur_ecran,8,SDL_SWSURFACE);
}