Skip to content
Snippets Groups Projects
Commit f858c909 authored by Réthelyi Bálint's avatar Réthelyi Bálint :no_mouth:
Browse files

upgrade .c and .h files

parent d2d322d7
No related branches found
No related tags found
1 merge request!3Blint
......@@ -18,17 +18,5 @@ move.h
/home/blint/projects/nhf/move.h
/home/blint/projects/nhf/view.c
SDL2/SDL.h
-
SDL2/SDL_image.h
-
stdlib.h
-
stdio.h
-
view.h
/home/blint/projects/nhf/view.h
/home/blint/projects/nhf/view.h
......@@ -8,6 +8,7 @@ CMakeFiles/nhf.dir/main.c.o
CMakeFiles/nhf.dir/move.c.o
/home/blint/projects/nhf/move.c
/home/blint/projects/nhf/move.h
/home/blint/projects/nhf/view.h
/usr/include/SDL2/SDL.h
/usr/include/SDL2/SDL_assert.h
/usr/include/SDL2/SDL_atomic.h
......
......@@ -7,6 +7,7 @@ CMakeFiles/nhf.dir/main.c.o: ../view.h
CMakeFiles/nhf.dir/move.c.o: ../move.c
CMakeFiles/nhf.dir/move.c.o: ../move.h
CMakeFiles/nhf.dir/move.c.o: ../view.h
CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL.h
CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_assert.h
CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_atomic.h
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -32,22 +32,7 @@ int main(int argc, char *argv[]) {
SDL_WaitEvent(&ev);
SDL_RenderClear(renderer);
switch (ev.type) {
case SDL_KEYUP:
switch (ev.key.keysym.sym) {
case SDLK_i:
kirajzol(renderer, kep, elozo_x, elozo_y);
moving = true;
break;
case SDLK_ESCAPE: quit = true;
break;
}
break;
case SDL_QUIT:
quit = true;
break;
}
keywatcher(ev, kep, elozo_x, elozo_y, &quit, &moving, renderer);
if (moving){
move(ev);
......
......@@ -3,7 +3,9 @@
//
#include <SDL.h>
#include <stdbool.h>
#include "move.h"
#include "view.h"
int v = 5;
int vx = 0;
......@@ -66,3 +68,24 @@ void move(SDL_Event ev)
break;
}
}
void keywatcher(SDL_Event ev, SDL_Texture *kep, int x, int y, bool *quit, bool *moving, SDL_Renderer *renderer)
{
switch (ev.type) {
case SDL_KEYUP:
switch (ev.key.keysym.sym) {
case SDLK_i:
kirajzol(renderer, kep, x, y);
*moving = true;
break;
case SDLK_ESCAPE:
*quit = true;
break;
}
break;
case SDL_QUIT:
*quit = true;
break;
}
}
......@@ -5,10 +5,12 @@
#ifndef NHF_MOVE_H
#define NHF_MOVE_H
#endif //NHF_MOVE_H
extern int v;
extern int vx;
extern int vy;
void move(SDL_Event ev);
void keywatcher(SDL_Event ev, SDL_Texture *kep, int x, int y, bool *quit, bool *moving, SDL_Renderer *renderer);
#endif //NHF_MOVE_H
\ No newline at end of file
......@@ -5,8 +5,6 @@
#ifndef NHF_VIEW_H
#define NHF_VIEW_H
#endif //NHF_VIEW_H
extern int owl;
void sdl_init(int szeles, int magas, SDL_Window **pwindow, SDL_Renderer **prenderer);
......@@ -14,3 +12,5 @@ void sdl_init(int szeles, int magas, SDL_Window **pwindow, SDL_Renderer **prende
SDL_Texture *kep_betolt(SDL_Renderer *renderer, char *filename);
void kirajzol(SDL_Renderer *renderer, SDL_Texture *kep, int x, int y);
#endif //NHF_VIEW_H
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment