Avancées de la semaine, premier build SDL, vérification fonctions
This commit is contained in:
parent
4f62619310
commit
36176c1b42
19
README.md
19
README.md
|
@ -1,5 +1,5 @@
|
|||
# Raycaster_G90
|
||||
Raycaster texturé écrit en C pour G90+E/FX-CG50 avec Gint
|
||||
Raycaster texturé écrit en C pour G90+E/FX-CG50 avec gint et PC (Linux) avec SDL2
|
||||
Touches :
|
||||
- PC :
|
||||
- Echap pour quitter
|
||||
|
@ -12,7 +12,8 @@ Touches :
|
|||
## Build
|
||||
- Dépendances :
|
||||
- Pour Linux (Port non finalisé) :
|
||||
- `libsdl2-dev`
|
||||
- une lib `sdl2` de dev
|
||||
- `cmake`
|
||||
- `build-essential` sur dérivés de Debian,
|
||||
- `base-devel` sur Arch et dérivés
|
||||
- `cmake`
|
||||
|
@ -30,21 +31,21 @@ Touches :
|
|||
`fxsdk build-cg`
|
||||
Et vous devrez avoir un .g3a tout frais dans le dossier.
|
||||
- Instructions pour Linux :
|
||||
Le build n'est pas encore officielement supporté et ne fonctionne pas à ce jour. Voyez ces instructions comme pour le futur ou pour les devs voulant aider.
|
||||
Le build n'est pas encore officielement supporté et n'est pas complété. Voyez ces instructions comme pour le futur ou pour les devs voulant aider.
|
||||
|
||||
- Installez les dépendances
|
||||
Ce qui pour Debian, Ubuntu et dérivés ressemblerait à
|
||||
`sudo apt install git libsdl2-dev build-essential cmake`
|
||||
et pour Arch et dérivés
|
||||
`sudo pacman -S git libsdl2-dev cmake base-devel`
|
||||
`sudo pacman -S git sdl2 cmake base-devel`
|
||||
- Clonez le repo dans le dossier de votre choix avec
|
||||
`git clone https://gitea.planet-casio.com/Fcalva/Raycaster_G90`
|
||||
- Allez dans le dossier et configurez
|
||||
`cd Raycaster_G90`
|
||||
`mkdir build`
|
||||
`cmake build`
|
||||
- Et finalement, compilez
|
||||
`cd build`
|
||||
`cd Raycaster_G90`
|
||||
`mkdir build`
|
||||
`cd build`
|
||||
`cmake ..`
|
||||
- Et finalement, compilez
|
||||
`make`
|
||||
|
||||
## Licenses
|
||||
|
|
11
src/main.c
11
src/main.c
|
@ -96,13 +96,6 @@ int main(){
|
|||
player.plane.y = fix(-0.66F);
|
||||
player.speed_mult = 0xFFFF;
|
||||
|
||||
image_t *timage;
|
||||
|
||||
while(1){
|
||||
sleep(10);
|
||||
dupdate();
|
||||
}
|
||||
/*
|
||||
while (exit_game == 0) {
|
||||
prof_t frame = prof_make();
|
||||
prof_enter(frame);
|
||||
|
@ -111,7 +104,7 @@ int main(){
|
|||
|
||||
//draw_sprites(&zombard, &ShooterLevel0, &player1);
|
||||
|
||||
draw_walls(&game, vram);
|
||||
//draw_walls(&game, vram);
|
||||
|
||||
//if(first_frame == 1) main_menu();
|
||||
|
||||
|
@ -144,7 +137,7 @@ int main(){
|
|||
prof_leave(frame);
|
||||
frame_time = (int)prof_time(frame)/1000;
|
||||
}
|
||||
*/
|
||||
|
||||
prof_quit();
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ image_t sdl_tex_load(char *filename){
|
|||
|
||||
image_t tex;
|
||||
tex.tex = IMG_LoadTexture(SDL_inf.renderer, filename);
|
||||
tex.subrect = malloc(sizeof(SDL_Rect));
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
@ -53,6 +54,13 @@ image_t *image_alloc(int w, int h, enum img_type image_type){
|
|||
image_t *tex;
|
||||
tex = malloc(sizeof(image_t));
|
||||
|
||||
tex->subrect = malloc(sizeof(SDL_Rect));
|
||||
|
||||
tex->subrect->x = 0;
|
||||
tex->subrect->y = 0;
|
||||
tex->subrect->w = w;
|
||||
tex->subrect->h = h;
|
||||
|
||||
tex->tex = SDL_CreateTexture(SDL_inf.renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET,
|
||||
w, h);
|
||||
|
||||
|
@ -61,6 +69,8 @@ image_t *image_alloc(int w, int h, enum img_type image_type){
|
|||
|
||||
void image_free(image_t *img){
|
||||
|
||||
free(img->subrect);
|
||||
|
||||
SDL_DestroyTexture(img->tex);
|
||||
|
||||
free(img);
|
||||
|
@ -80,7 +90,7 @@ void dprint(int x, int y, SDL_Color fg, char const *format, ...){
|
|||
|
||||
image_t *image_create_vram(void){
|
||||
image_t *tex;
|
||||
tex = malloc(sizeof(image_t));
|
||||
tex = NULL;
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
@ -99,4 +109,10 @@ void dupdate(void){
|
|||
SDL_RenderPresent(SDL_inf.renderer);
|
||||
}
|
||||
|
||||
void dimage(int x, int y, image_t *image){
|
||||
extern SDL_Info SDL_inf;
|
||||
|
||||
SDL_RenderCopy(SDL_inf.renderer, image, image->subrect, image->subrect);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// - Importation (sdl_tex_load() ) - 20%
|
||||
// - gint/display.h :
|
||||
// - dprint() - 5%
|
||||
// - dimage() - 0%
|
||||
// - dclear() - 100%
|
||||
// - dupdate() - 100%
|
||||
// - gint_dvline() - 0%
|
||||
|
@ -55,6 +56,8 @@ typedef struct {
|
|||
|
||||
SDL_Texture *tex;
|
||||
|
||||
SDL_Rect *subrect;
|
||||
|
||||
} image_t;
|
||||
|
||||
typedef struct{
|
||||
|
@ -83,6 +86,8 @@ void dupdate(void);
|
|||
|
||||
void gint_dvline(int x1, int x2, int x, SDL_Color color);
|
||||
|
||||
void dimage(int x, int y, image_t *image);
|
||||
|
||||
struct image_linear_map{
|
||||
fixed_t h_scale;
|
||||
fixed_t v_scale;
|
||||
|
|
Loading…
Reference in New Issue