Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jumpNrun
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wise2023_jumpnrun
jumpNrun
Commits
ff3c9e8a
Commit
ff3c9e8a
authored
1 year ago
by
Michael
Browse files
Options
Downloads
Patches
Plain Diff
added boat image and load support
parent
3b478ca3
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
header.h
+2
-0
2 additions, 0 deletions
header.h
images/plank.png
+0
-0
0 additions, 0 deletions
images/plank.png
init.c
+8
-5
8 additions, 5 deletions
init.c
output.c
+5
-5
5 additions, 5 deletions
output.c
with
15 additions
and
10 deletions
header.h
+
2
−
0
View file @
ff3c9e8a
...
...
@@ -114,3 +114,5 @@ extern SDL_Texture *img_car_trans;
extern
SDL_Texture
*
img_carLeft_trans
;
extern
SDL_Texture
*
img_trainR
;
extern
SDL_Texture
*
img_trainL
;
extern
SDL_Texture
*
img_plank
;
This diff is collapsed.
Click to expand it.
images/plank.png
0 → 100644
+
0
−
0
View file @
ff3c9e8a
81.7 KiB
This diff is collapsed.
Click to expand it.
init.c
+
8
−
5
View file @
ff3c9e8a
...
...
@@ -15,9 +15,10 @@ SDL_Texture *img_finishlineBright;
SDL_Texture
*
img_finishlineDark
;
SDL_Texture
*
img_coin
;
SDL_Texture
*
img_carLeft_trans
;
// https://www.pinterest.com/pin/365776800983879017/
SDL_Texture
*
img_car_trans
;
// https://www.pinterest.com/pin/365776800983879017/
SDL_Texture
*
img_trainL
;
SDL_Texture
*
img_car_trans
;
SDL_Texture
*
img_trainL
;
//https://www.pinterest.com/hassanhojabri/sprite/
SDL_Texture
*
img_trainR
;
SDL_Texture
*
img_plank
;
//https://www.craiyon.com/image/_XEsXKthRYqpK8Vn6ZixAg
TTF_Font
*
font
;
int
playerscore
;
...
...
@@ -43,10 +44,11 @@ int init(SDL_Renderer* renderer) {
img_finishlineBright
=
IMG_LoadTexture
(
renderer
,
"images/finishlineBright.jpg"
);
img_finishlineDark
=
IMG_LoadTexture
(
renderer
,
"images/finishlineDark.jpg"
);
img_car_trans
=
IMG_LoadTexture
(
renderer
,
"images/car_trans.png"
);
// https://www.pinterest.com/pin/365776800983879017/
img_carLeft_trans
=
IMG_LoadTexture
(
renderer
,
"images/carLeft_trans.png"
);
// // https://www.pinterest.com/pin/365776800983879017/
img_carLeft_trans
=
IMG_LoadTexture
(
renderer
,
"images/carLeft_trans.png"
);
img_coin
=
IMG_LoadTexture
(
renderer
,
"images/coin.jpg"
);
img_trainL
=
IMG_LoadTexture
(
renderer
,
"images/trainL.png"
);
// https://www.pinterest.de/pin/645492559082244309/
img_trainR
=
IMG_LoadTexture
(
renderer
,
"images/trainR.png"
);
// https://www.pinterest.de/pin/645492559082244309/
img_trainR
=
IMG_LoadTexture
(
renderer
,
"images/trainR.png"
);
img_plank
=
IMG_LoadTexture
(
renderer
,
"images/plank.png"
);
//Initiierung der Bilder
int
flags
=
IMG_INIT_PNG
|
IMG_INIT_JPG
;
...
...
@@ -59,7 +61,7 @@ int init(SDL_Renderer* renderer) {
if
(
img_grassDark
==
NULL
||
img_grassBright
==
NULL
||
img_streetSingle
==
NULL
||
img_streetMultiple
==
NULL
||
img_traintrack
==
NULL
||
img_waterBrightSingle
==
NULL
||
img_waterBrightMultiple
==
NULL
||
img_waterDarkSingle
==
NULL
||
img_waterDarkMultiple
==
NULL
||
img_finishlineBright
==
NULL
||
img_finishlineDark
==
NULL
||
img_coin
==
NULL
||
img_carLeft_trans
==
NULL
||
img_trainL
==
NULL
||
img_trainR
==
NULL
||
img_car_trans
==
NULL
)
{
img_coin
==
NULL
||
img_carLeft_trans
==
NULL
||
img_trainL
==
NULL
||
img_trainR
==
NULL
||
img_car_trans
==
NULL
||
img_plank
==
NULL
)
{
SDL_Log
(
"Bild konnte nicht geladen werden! SDL_image Error: %s
\n
"
,
IMG_GetError
());
return
(
1
);
}
...
...
@@ -87,6 +89,7 @@ int exitGame(SDL_Renderer* renderer, SDL_Window* window) {
SDL_DestroyTexture
(
img_carLeft_trans
);
SDL_DestroyTexture
(
img_trainL
);
SDL_DestroyTexture
(
img_trainR
);
SDL_DestroyTexture
(
img_plank
);
SDL_Quit
();
return
0
;
...
...
This diff is collapsed.
Click to expand it.
output.c
+
5
−
5
View file @
ff3c9e8a
...
...
@@ -77,11 +77,10 @@ int paste_auto (SDL_Renderer* renderer, int x, int y, int width, int height,int
.
h
=
height
};
if
(
cur
->
type
==
boat
){
if
(
SDL_SetRenderDrawColor
(
renderer
,
75
,
33
,
0
,
255
)
!=
0
)
{
SDL_Log
(
"Farbe konnte nicht gesetzt werden! SDL_Error: %s
\n
"
,
SDL_GetError
());
return
-
1
;
}
if
(
SDL_RenderCopy
(
renderer
,
img_plank
,
NULL
,
&
rect
)
!=
0
)
{
SDL_Log
(
"Bild konnte nicht kopiert werden! SDL_Error Error: %s
\n
"
,
SDL_GetError
());
return
(
1
);
}
}
else
if
(
cur
->
type
==
car
){
if
(
cur
->
color
==
red
){
if
(
SDL_SetRenderDrawColor
(
renderer
,
200
,
0
,
0
,
255
)
!=
0
)
{
...
...
@@ -89,6 +88,7 @@ int paste_auto (SDL_Renderer* renderer, int x, int y, int width, int height,int
SDL_GetError
());
return
-
1
;
}
return
(
0
);
}
else
if
(
cur
->
color
==
blue
){
if
(
SDL_SetRenderDrawColor
(
renderer
,
0
,
0
,
200
,
255
)
!=
0
)
{
SDL_Log
(
"Farbe konnte nicht gesetzt werden! SDL_Error: %s
\n
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment