Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • wise2023_jumpnrun/jumpnrun
1 result
Show changes
Commits on Source (2)
#include "auto.h"
#include "hDateien/auto.h"
// Vorbedinung:
......
#include "charac.h"
#include "hDateien/charac.h"
/*
Vorbedingung: Es wurde eine Taste gedrückt
......
#include "file_own.h"
#include "hDateien/file_own.h"
//V: playerhighscore exists and score.txt exists
//N if playerhighscore > current score; playerhighscore is written into corresponding space in score.txt. The rest is rewritten into score.txt (including the theme if playerhighscore < score)
......
#include "gameLoop.h"
#include "hDateien/gameLoop.h"
SDL_Rect *player;
......
......@@ -6,9 +6,6 @@
#include <stdlib.h>
#include <stdbool.h>
#include "output.h"
//#include "map.h"
//#include "rows.h"
//#include "gameLoop.h"
#include "header.h"
//Declarations of functions
......
File moved
File moved
File moved
File moved
......@@ -8,7 +8,9 @@
//Declaration of functions
int init(SDL_Renderer*);
SDL_Window* init_window(void);
SDL_Renderer* init_renderer(SDL_Window*);
int init_images(SDL_Renderer*);
int exitGame(SDL_Renderer*,SDL_Window* window);
......
File moved
File moved
File moved
File moved
File moved
File moved
#include "init.h"
#include "hDateien/init.h"
//Lädt Texturen rein
SDL_Texture *img_grassDark;
......@@ -23,9 +23,44 @@ SDL_Texture *img_duck;
SDL_Texture *img_3D_Duck;
TTF_Font* font;
SDL_Window* init_window(){
SDL_Window *window = SDL_CreateWindow("Smashy Roads", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (window == NULL){
SDL_Log("Es gab einen Fehler beim Erstellen des Fensters! SDL_Error: %s\n",SDL_GetError());
exit(-1);
}
return(window);
}
SDL_Renderer* init_renderer(SDL_Window *window){
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
if (renderer == NULL) {
SDL_Log("Renderer konnte nicht erstellt werden! SDL_Error: %s\n",SDL_GetError());
exit(-1);
}
if (SDL_RenderClear(renderer) != 0) {
SDL_Log("Renderer konnte nicht bereinigt werden! SDL_Error: %s\n",SDL_GetError());
exit(-1);
}
if (SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND) != 0) {
SDL_Log("Blendmode konnte nicht aktualisiert werden (main.c)! SDL_Error: %s\n",SDL_GetError());
exit(-1);
}
return(renderer);
}
//V: all images and fonts to load are in file images
//N: images and fonts have been loaded into renderer
int init(SDL_Renderer* renderer) {
int init_images(SDL_Renderer* renderer) {
//Initiiere Text
TTF_Init();
......
// v1.0
#include "main.h"
#include "hDateien/main.h"
//V: SDL2 is installed
//N: Game is closed
//E: You played the game
int main(void) {
// Initialiserung des Zufallgenerators
......@@ -17,34 +19,12 @@ int main(void) {
return(-1);
}
SDL_Window *window = SDL_CreateWindow("Smashy Roads", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
SDL_Window *window = init_window();
if (window == NULL){
SDL_Log("Es gab einen Fehler beim Erstellen des Fensters! SDL_Error: %s\n",SDL_GetError());
return(-1);
}
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
if (renderer == NULL) {
SDL_Log("Renderer konnte nicht erstellt werden! SDL_Error: %s\n",SDL_GetError());
return(-1);
}
if (SDL_RenderClear(renderer) != 0) {
SDL_Log("Renderer konnte nicht bereinigt werden! SDL_Error: %s\n",SDL_GetError());
return(-1);
}
if (SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND) != 0) {
SDL_Log("Blendmode konnte nicht aktualisiert werden (main.c)! SDL_Error: %s\n",SDL_GetError());
return(-1);
};
SDL_Renderer *renderer = init_renderer(window);
//Initialisierung der Bilder und Fonts
if (init(renderer)){
if (init_images(renderer)){
printf("Fehler beim laden der Bilder");
return(-1);
}
......
#include "map.h"
#include "hDateien/map.h"
// Vorbedingung: 0 <= player->y <= 1000, 0 <= player->x <= 900
......
#include "menu2.h"
#include "hDateien/menu2.h"
// Vorb.: Die Funktion zeigt die möglichen Reihen des Spiels
// Nachb.: Wenn man auf eine Reihe klickt, dann wir das Spiel mit einer bestimmten
......