Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marian POIROT
Our awesome project
Commits
2a2e534c
Commit
2a2e534c
authored
Jun 25, 2021
by
Thibaud LEROY
Browse files
ajout d'un renderer clear
parent
a36a6594
Changes
23
Hide whitespace changes
Inline
Side-by-side
laby/texture_perso.c
View file @
2a2e534c
...
...
@@ -3,7 +3,7 @@
int
frameCount
=
0
;
float
frameCount2
=
0
;
void
play_with_elve_N
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_with_elve_N
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
...
...
@@ -76,13 +76,11 @@ void play_with_elve_N(SDL_Texture *texture_elve, SDL_Texture *background, SDL_Wi
state
[
9
].
w
=
offset_x
;
state
[
9
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
destination
.
y
=
destination
.
y
-
(
deplacement
/
nb_images_animation
);
//déplacement du personnage ici de wind dim.h /32 en tout (diviser par nb animation pour chaque anim)
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[
frameCount
],
&
destination
);
frameCount
=
(
frameCount
+
1
)
%
10
;
}
void
play_with_elve_N_l
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_with_elve_N_l
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
...
...
@@ -154,17 +152,15 @@ void play_with_elve_N_l(SDL_Texture *texture_elve, SDL_Texture *background, SDL_
state
[
9
].
w
=
offset_x
;
state
[
9
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
destination
.
y
=
destination
.
y
-
(
deplacement
/
nb_images_animation
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[
frameCount
],
&
destination
);
frameCount
=
(
frameCount
+
1
)
%
10
;
}
void
play_with_elve_S
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_with_elve_S
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
window_dimensions
=
{
0
},
destination
=
{
0
};
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
SDL_GetWindowSize
(
window
,
&
window_dimensions
.
w
,
&
window_dimensions
.
h
);
SDL_QueryTexture
(
texture_elve
,
NULL
,
NULL
,
&
source
.
w
,
&
source
.
h
);
int
nb_images
=
8
;
...
...
@@ -233,17 +229,15 @@ void play_with_elve_S(SDL_Texture *texture_elve, SDL_Texture *background, SDL_Wi
state
[
9
].
w
=
offset_x
;
state
[
9
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
destination
.
y
=
destination
.
y
+
(
deplacement
/
nb_images_animation
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[
frameCount
],
&
destination
);
frameCount
=
(
frameCount
+
1
)
%
10
;
}
void
play_with_elve_S_l
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_with_elve_S_l
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
window_dimensions
=
{
0
},
destination
=
{
0
};
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
SDL_GetWindowSize
(
window
,
&
window_dimensions
.
w
,
&
window_dimensions
.
h
);
SDL_QueryTexture
(
texture_elve
,
NULL
,
NULL
,
&
source
.
w
,
&
source
.
h
);
int
nb_images
=
8
;
...
...
@@ -312,18 +306,17 @@ void play_with_elve_S_l(SDL_Texture *texture_elve, SDL_Texture *background, SDL_
state
[
9
].
w
=
offset_x
;
state
[
9
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
destination
.
y
=
destination
.
y
+
(
deplacement
/
nb_images_animation
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[
frameCount
],
&
destination
);
frameCount
=
(
frameCount
+
1
)
%
10
;
}
void
play_with_elve_O
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_with_elve_O
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
window_dimensions
=
{
0
},
destination
=
{
0
};
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
SDL_GetWindowSize
(
window
,
&
window_dimensions
.
w
,
&
window_dimensions
.
h
);
SDL_QueryTexture
(
texture_elve
,
NULL
,
NULL
,
&
source
.
w
,
&
source
.
h
);
int
nb_images
=
8
;
...
...
@@ -393,17 +386,15 @@ void play_with_elve_O(SDL_Texture *texture_elve, SDL_Texture *background, SDL_Wi
state
[
9
].
w
=
offset_x
;
state
[
9
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
destination
.
x
=
destination
.
x
-
(
deplacement
/
nb_images_animation
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[
frameCount
],
&
destination
);
frameCount
=
(
frameCount
+
1
)
%
10
;
}
void
play_with_elve_E
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_with_elve_E
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
window_dimensions
=
{
0
},
destination
=
{
0
};
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
SDL_GetWindowSize
(
window
,
&
window_dimensions
.
w
,
&
window_dimensions
.
h
);
SDL_QueryTexture
(
texture_elve
,
NULL
,
NULL
,
&
source
.
w
,
&
source
.
h
);
int
nb_images
=
8
;
...
...
@@ -473,17 +464,16 @@ void play_with_elve_E(SDL_Texture *texture_elve, SDL_Texture *background, SDL_Wi
state
[
9
].
w
=
offset_x
;
state
[
9
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
destination
.
x
=
destination
.
x
+
(
deplacement
/
nb_images_animation
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[
frameCount
],
&
destination
);
frameCount
=
(
frameCount
+
1
)
%
10
;
}
void
play_standstill
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_standstill
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
window_dimensions
=
{
0
},
destination
=
{
0
};
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
SDL_GetWindowSize
(
window
,
&
window_dimensions
.
w
,
&
window_dimensions
.
h
);
SDL_QueryTexture
(
texture_elve
,
NULL
,
NULL
,
&
source
.
w
,
&
source
.
h
);
int
nb_images
=
8
;
...
...
@@ -516,8 +506,6 @@ void play_standstill(SDL_Texture *texture_elve, SDL_Texture *background, SDL_Win
state
[
3
].
w
=
offset_x
;
state
[
3
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[(
int
)
frameCount2
],
&
destination
);
frameCount2
=
(
frameCount2
+
0
.
25
);
...
...
@@ -526,17 +514,17 @@ void play_standstill(SDL_Texture *texture_elve, SDL_Texture *background, SDL_Win
}
}
void
play_standstill_l
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
)
void
play_standstill_l
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
)
{
SDL_Rect
source
=
{
0
},
window_dimensions
=
{
0
},
destination
=
{
0
};
SDL_Rect
source
=
{
0
},
destination
=
{
0
};
SDL_GetWindowSize
(
window
,
&
window_dimensions
.
w
,
&
window_dimensions
.
h
);
SDL_QueryTexture
(
texture_elve
,
NULL
,
NULL
,
&
source
.
w
,
&
source
.
h
);
int
nb_images
=
8
;
int
offset_x
=
source
.
w
/
nb_images
;
int
offset_y
=
source
.
h
;
SDL_Rect
state
[
1
];
SDL_Rect
state
[
4
];
destination
.
w
=
offset_x
*
zoom
;
destination
.
h
=
offset_y
*
zoom
;
...
...
@@ -562,9 +550,7 @@ void play_standstill_l(SDL_Texture *texture_elve, SDL_Texture *background, SDL_W
state
[
3
].
y
=
0
;
state
[
3
].
w
=
offset_x
;
state
[
3
].
h
=
offset_y
;
afficherImage
(
renderer
,
window
,
tab
,
taille_cell
,
background
);
affichage_fin
(
texture_fin
,
window
,
renderer
,
noeud_arrive
/
P
,
noeud_arrive
%
P
,
taille_cell
);
SDL_RenderCopy
(
renderer
,
texture_elve
,
&
state
[(
int
)
frameCount2
],
&
destination
);
frameCount2
=
(
frameCount2
+
0
.
25
);
if
(
frameCount2
>=
4
){
...
...
laby/texture_perso.h
View file @
2a2e534c
...
...
@@ -11,15 +11,14 @@
#include "affichage_image.h"
#include "kruskal.h"
void
play_with_background
(
SDL_Texture
*
my_background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_N
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_N_l
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_S
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_S_l
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_O
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_E
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_standstill
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_standstill_l
(
SDL_Texture
*
texture_elve
,
SDL_Texture
*
background
,
SDL_Window
*
window
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
,
int
**
tab
,
int
taille_cell
,
SDL_Texture
*
texture_fin
,
int
noeud_arrive
);
void
play_with_elve_N
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
);
void
play_with_elve_N_l
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
);
void
play_with_elve_S
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
);
void
play_with_elve_S_l
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
);
void
play_with_elve_O
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
);
void
play_with_elve_E
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
int
deplacement
,
float
zoom
);
void
play_standstill
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
);
void
play_standstill_l
(
SDL_Texture
*
texture_elve
,
SDL_Renderer
*
renderer
,
int
pos_x
,
int
pos_y
,
float
zoom
);
#endif
laby/texture_perso.o
View file @
2a2e534c
No preview for this file type
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment