diff --git a/CMakeLists.txt b/CMakeLists.txt
index efc5ea06fe1741d84c123d63e7abe529b583b3b8..54c060cd334a5b4efbc3f83ce790a2cee645a1b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ project(nhf C)
 
 set(CMAKE_C_STANDARD 99)
 
-add_executable(nhf main.c)
+add_executable(nhf main.c view.c view.h move.c move.h)
 
 target_link_libraries(nhf m)
 
diff --git a/cmake-build-debug/CMakeFiles/Makefile2 b/cmake-build-debug/CMakeFiles/Makefile2
index a1d94a7ab1f5a02983436f78e761527a948d629c..db763b891fa8573b27c03609b0865e41f6ccbc4b 100644
--- a/cmake-build-debug/CMakeFiles/Makefile2
+++ b/cmake-build-debug/CMakeFiles/Makefile2
@@ -74,12 +74,12 @@ preinstall:
 CMakeFiles/nhf.dir/all:
 	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/depend
 	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/build
-	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/blint/projects/nhf/cmake-build-debug/CMakeFiles --progress-num=1,2 "Built target nhf"
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/blint/projects/nhf/cmake-build-debug/CMakeFiles --progress-num=1,2,3,4 "Built target nhf"
 .PHONY : CMakeFiles/nhf.dir/all
 
 # Build rule for subdir invocation for target.
 CMakeFiles/nhf.dir/rule: cmake_check_build_system
-	$(CMAKE_COMMAND) -E cmake_progress_start /home/blint/projects/nhf/cmake-build-debug/CMakeFiles 2
+	$(CMAKE_COMMAND) -E cmake_progress_start /home/blint/projects/nhf/cmake-build-debug/CMakeFiles 4
 	$(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/nhf.dir/all
 	$(CMAKE_COMMAND) -E cmake_progress_start /home/blint/projects/nhf/cmake-build-debug/CMakeFiles 0
 .PHONY : CMakeFiles/nhf.dir/rule
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache b/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache
index c69873d2cec6a6716814a81fd82eb2b9d271e8fd..0ccae6845f993171ad772b4966ab6cb1fb754395 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache
@@ -7,6 +7,18 @@
 #IncludeRegexTransform: 
 
 /home/blint/projects/nhf/main.c
+SDL2/SDL_image.h
+-
+stdbool.h
+-
+view.h
+/home/blint/projects/nhf/view.h
+move.h
+/home/blint/projects/nhf/move.h
+
+/home/blint/projects/nhf/move.h
+
+/home/blint/projects/nhf/view.c
 SDL2/SDL.h
 -
 SDL2/SDL_image.h
@@ -15,6 +27,8 @@ stdlib.h
 -
 stdio.h
 -
-stdbool.h
--
+view.h
+/home/blint/projects/nhf/view.h
+
+/home/blint/projects/nhf/view.h
 
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/DependInfo.cmake b/cmake-build-debug/CMakeFiles/nhf.dir/DependInfo.cmake
index 0c73032676c36e3b5726e81d42e5ef533140e7d4..0b1ac2a4a2db44c73303bc184392ed5bc95b57a4 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/DependInfo.cmake
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/DependInfo.cmake
@@ -5,6 +5,8 @@ set(CMAKE_DEPENDS_LANGUAGES
 # The set of files for implicit dependencies of each language:
 set(CMAKE_DEPENDS_CHECK_C
   "/home/blint/projects/nhf/main.c" "/home/blint/projects/nhf/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o"
+  "/home/blint/projects/nhf/move.c" "/home/blint/projects/nhf/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o"
+  "/home/blint/projects/nhf/view.c" "/home/blint/projects/nhf/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o"
   )
 set(CMAKE_C_COMPILER_ID "GNU")
 
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/build.make b/cmake-build-debug/CMakeFiles/nhf.dir/build.make
index 0c46cf05a6a6ae12d6290fbb1cb080bbb458ca35..3cd4592f010cd97850602b79fb19d2ad356f8834 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/build.make
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/build.make
@@ -70,17 +70,47 @@ CMakeFiles/nhf.dir/main.c.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/nhf.dir/main.c.s"
 	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/blint/projects/nhf/main.c -o CMakeFiles/nhf.dir/main.c.s
 
+CMakeFiles/nhf.dir/view.c.o: CMakeFiles/nhf.dir/flags.make
+CMakeFiles/nhf.dir/view.c.o: ../view.c
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/blint/projects/nhf/cmake-build-debug/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/nhf.dir/view.c.o"
+	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/nhf.dir/view.c.o   -c /home/blint/projects/nhf/view.c
+
+CMakeFiles/nhf.dir/view.c.i: cmake_force
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/nhf.dir/view.c.i"
+	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/blint/projects/nhf/view.c > CMakeFiles/nhf.dir/view.c.i
+
+CMakeFiles/nhf.dir/view.c.s: cmake_force
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/nhf.dir/view.c.s"
+	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/blint/projects/nhf/view.c -o CMakeFiles/nhf.dir/view.c.s
+
+CMakeFiles/nhf.dir/move.c.o: CMakeFiles/nhf.dir/flags.make
+CMakeFiles/nhf.dir/move.c.o: ../move.c
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/blint/projects/nhf/cmake-build-debug/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building C object CMakeFiles/nhf.dir/move.c.o"
+	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/nhf.dir/move.c.o   -c /home/blint/projects/nhf/move.c
+
+CMakeFiles/nhf.dir/move.c.i: cmake_force
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/nhf.dir/move.c.i"
+	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/blint/projects/nhf/move.c > CMakeFiles/nhf.dir/move.c.i
+
+CMakeFiles/nhf.dir/move.c.s: cmake_force
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/nhf.dir/move.c.s"
+	/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/blint/projects/nhf/move.c -o CMakeFiles/nhf.dir/move.c.s
+
 # Object files for target nhf
 nhf_OBJECTS = \
-"CMakeFiles/nhf.dir/main.c.o"
+"CMakeFiles/nhf.dir/main.c.o" \
+"CMakeFiles/nhf.dir/view.c.o" \
+"CMakeFiles/nhf.dir/move.c.o"
 
 # External object files for target nhf
 nhf_EXTERNAL_OBJECTS =
 
 nhf: CMakeFiles/nhf.dir/main.c.o
+nhf: CMakeFiles/nhf.dir/view.c.o
+nhf: CMakeFiles/nhf.dir/move.c.o
 nhf: CMakeFiles/nhf.dir/build.make
 nhf: CMakeFiles/nhf.dir/link.txt
-	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/blint/projects/nhf/cmake-build-debug/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C executable nhf"
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/blint/projects/nhf/cmake-build-debug/CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Linking C executable nhf"
 	$(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/nhf.dir/link.txt --verbose=$(VERBOSE)
 
 # Rule to build all files generated by this target.
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/cmake_clean.cmake b/cmake-build-debug/CMakeFiles/nhf.dir/cmake_clean.cmake
index 50067f86afeff23716d981ff01e43575a5c392b2..d222ce5fad7e7d3e8da521df763f1ac9aedb208c 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/cmake_clean.cmake
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/cmake_clean.cmake
@@ -1,5 +1,7 @@
 file(REMOVE_RECURSE
   "CMakeFiles/nhf.dir/main.c.o"
+  "CMakeFiles/nhf.dir/move.c.o"
+  "CMakeFiles/nhf.dir/view.c.o"
   "nhf"
   "nhf.pdb"
 )
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/depend.internal b/cmake-build-debug/CMakeFiles/nhf.dir/depend.internal
index 7d47a4188b5331c3e31dfa5953681fd7a8424a11..91f3310eca6256a75ebf666af4573e9de4c208b6 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/depend.internal
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/depend.internal
@@ -3,3 +3,56 @@
 
 CMakeFiles/nhf.dir/main.c.o
  /home/blint/projects/nhf/main.c
+ /home/blint/projects/nhf/move.h
+ /home/blint/projects/nhf/view.h
+CMakeFiles/nhf.dir/move.c.o
+ /home/blint/projects/nhf/move.c
+ /home/blint/projects/nhf/move.h
+ /usr/include/SDL2/SDL.h
+ /usr/include/SDL2/SDL_assert.h
+ /usr/include/SDL2/SDL_atomic.h
+ /usr/include/SDL2/SDL_audio.h
+ /usr/include/SDL2/SDL_blendmode.h
+ /usr/include/SDL2/SDL_clipboard.h
+ /usr/include/SDL2/SDL_config.h
+ /usr/include/SDL2/SDL_cpuinfo.h
+ /usr/include/SDL2/SDL_endian.h
+ /usr/include/SDL2/SDL_error.h
+ /usr/include/SDL2/SDL_events.h
+ /usr/include/SDL2/SDL_filesystem.h
+ /usr/include/SDL2/SDL_gamecontroller.h
+ /usr/include/SDL2/SDL_gesture.h
+ /usr/include/SDL2/SDL_haptic.h
+ /usr/include/SDL2/SDL_hints.h
+ /usr/include/SDL2/SDL_joystick.h
+ /usr/include/SDL2/SDL_keyboard.h
+ /usr/include/SDL2/SDL_keycode.h
+ /usr/include/SDL2/SDL_loadso.h
+ /usr/include/SDL2/SDL_log.h
+ /usr/include/SDL2/SDL_main.h
+ /usr/include/SDL2/SDL_messagebox.h
+ /usr/include/SDL2/SDL_mouse.h
+ /usr/include/SDL2/SDL_mutex.h
+ /usr/include/SDL2/SDL_pixels.h
+ /usr/include/SDL2/SDL_platform.h
+ /usr/include/SDL2/SDL_power.h
+ /usr/include/SDL2/SDL_quit.h
+ /usr/include/SDL2/SDL_rect.h
+ /usr/include/SDL2/SDL_render.h
+ /usr/include/SDL2/SDL_rwops.h
+ /usr/include/SDL2/SDL_scancode.h
+ /usr/include/SDL2/SDL_sensor.h
+ /usr/include/SDL2/SDL_shape.h
+ /usr/include/SDL2/SDL_stdinc.h
+ /usr/include/SDL2/SDL_surface.h
+ /usr/include/SDL2/SDL_system.h
+ /usr/include/SDL2/SDL_thread.h
+ /usr/include/SDL2/SDL_timer.h
+ /usr/include/SDL2/SDL_touch.h
+ /usr/include/SDL2/SDL_version.h
+ /usr/include/SDL2/SDL_video.h
+ /usr/include/SDL2/begin_code.h
+ /usr/include/SDL2/close_code.h
+CMakeFiles/nhf.dir/view.c.o
+ /home/blint/projects/nhf/view.c
+ /home/blint/projects/nhf/view.h
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/depend.make b/cmake-build-debug/CMakeFiles/nhf.dir/depend.make
index 1c7855e60f43c8958ff15cf29fe0e64877628af9..95bd43aa89b220c10b2911e1f1204345dd7120f7 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/depend.make
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/depend.make
@@ -2,4 +2,57 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 3.15
 
 CMakeFiles/nhf.dir/main.c.o: ../main.c
+CMakeFiles/nhf.dir/main.c.o: ../move.h
+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: /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
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_audio.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_blendmode.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_clipboard.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_config.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_cpuinfo.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_endian.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_error.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_events.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_filesystem.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_gamecontroller.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_gesture.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_haptic.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_hints.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_joystick.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_keyboard.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_keycode.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_loadso.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_log.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_main.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_messagebox.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_mouse.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_mutex.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_pixels.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_platform.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_power.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_quit.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_rect.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_render.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_rwops.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_scancode.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_sensor.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_shape.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_stdinc.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_surface.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_system.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_thread.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_timer.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_touch.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_version.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/SDL_video.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/begin_code.h
+CMakeFiles/nhf.dir/move.c.o: /usr/include/SDL2/close_code.h
+
+CMakeFiles/nhf.dir/view.c.o: ../view.c
+CMakeFiles/nhf.dir/view.c.o: ../view.h
 
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/link.txt b/cmake-build-debug/CMakeFiles/nhf.dir/link.txt
index ba62e5746d3b7882d5fda69c7cfeb51a4d030d4a..5f41754272d0072b599c2df2c1b0d51e700ee00d 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/link.txt
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/link.txt
@@ -1 +1 @@
-/usr/bin/cc   -I/usr/include/SDL2 -D_REENTRANT -g   CMakeFiles/nhf.dir/main.c.o  -o nhf -lm -lSDL2 -lSDL2_gfx -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_image 
+/usr/bin/cc   -I/usr/include/SDL2 -D_REENTRANT -g   CMakeFiles/nhf.dir/main.c.o CMakeFiles/nhf.dir/view.c.o CMakeFiles/nhf.dir/move.c.o  -o nhf -lm -lSDL2 -lSDL2_gfx -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_image 
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o b/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o
index 115375b5652ad1cc61d21ace25729fbf8dda88c6..2a535b4d4b49bf2475723f19b9d17583340e6b91 100644
Binary files a/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o and b/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o differ
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o b/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o
new file mode 100644
index 0000000000000000000000000000000000000000..07212cca7f4775e6ccd8b08ea81181635cc5d449
Binary files /dev/null and b/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o differ
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/progress.make b/cmake-build-debug/CMakeFiles/nhf.dir/progress.make
index abadeb0c3abaa81d622026fcd3ae096d03dd29b7..a69a57e8e4ffee737b6054e9068354426a41030f 100644
--- a/cmake-build-debug/CMakeFiles/nhf.dir/progress.make
+++ b/cmake-build-debug/CMakeFiles/nhf.dir/progress.make
@@ -1,3 +1,5 @@
 CMAKE_PROGRESS_1 = 1
 CMAKE_PROGRESS_2 = 2
+CMAKE_PROGRESS_3 = 3
+CMAKE_PROGRESS_4 = 4
 
diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o b/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o
new file mode 100644
index 0000000000000000000000000000000000000000..f5d22b1f5875683dcb601353744ecd5f6f3082e9
Binary files /dev/null and b/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o differ
diff --git a/cmake-build-debug/CMakeFiles/progress.marks b/cmake-build-debug/CMakeFiles/progress.marks
index 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f..b8626c4cff2849624fb67f87cd0ad72b163671ad 100644
--- a/cmake-build-debug/CMakeFiles/progress.marks
+++ b/cmake-build-debug/CMakeFiles/progress.marks
@@ -1 +1 @@
-2
+4
diff --git a/cmake-build-debug/Makefile b/cmake-build-debug/Makefile
index 094eeca8d34add0c56603b535f5fd45e551291c2..40de2d1a3a73553ac251d66a587e70088b0c48c7 100644
--- a/cmake-build-debug/Makefile
+++ b/cmake-build-debug/Makefile
@@ -150,6 +150,60 @@ main.c.s:
 	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/main.c.s
 .PHONY : main.c.s
 
+move.o: move.c.o
+
+.PHONY : move.o
+
+# target to build an object file
+move.c.o:
+	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/move.c.o
+.PHONY : move.c.o
+
+move.i: move.c.i
+
+.PHONY : move.i
+
+# target to preprocess a source file
+move.c.i:
+	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/move.c.i
+.PHONY : move.c.i
+
+move.s: move.c.s
+
+.PHONY : move.s
+
+# target to generate assembly for a file
+move.c.s:
+	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/move.c.s
+.PHONY : move.c.s
+
+view.o: view.c.o
+
+.PHONY : view.o
+
+# target to build an object file
+view.c.o:
+	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/view.c.o
+.PHONY : view.c.o
+
+view.i: view.c.i
+
+.PHONY : view.i
+
+# target to preprocess a source file
+view.c.i:
+	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/view.c.i
+.PHONY : view.c.i
+
+view.s: view.c.s
+
+.PHONY : view.s
+
+# target to generate assembly for a file
+view.c.s:
+	$(MAKE) -f CMakeFiles/nhf.dir/build.make CMakeFiles/nhf.dir/view.c.s
+.PHONY : view.c.s
+
 # Help Target
 help:
 	@echo "The following are some of the valid targets for this Makefile:"
@@ -162,6 +216,12 @@ help:
 	@echo "... main.o"
 	@echo "... main.i"
 	@echo "... main.s"
+	@echo "... move.o"
+	@echo "... move.i"
+	@echo "... move.s"
+	@echo "... view.o"
+	@echo "... view.i"
+	@echo "... view.s"
 .PHONY : help
 
 
diff --git a/cmake-build-debug/nhf b/cmake-build-debug/nhf
index 69b018a94701372f4ae08bd2dd2cfe05d22b5b07..c70970a9a49548b4c25bb561a20dbaac434a5362 100755
Binary files a/cmake-build-debug/nhf and b/cmake-build-debug/nhf differ
diff --git a/cmake-build-debug/nhf.cbp b/cmake-build-debug/nhf.cbp
index 7cee7db8f69ef6ec6a6b8055ef705114ea790620..0f68c720f5add1fb6c2b8e5635524f258ab63430 100644
--- a/cmake-build-debug/nhf.cbp
+++ b/cmake-build-debug/nhf.cbp
@@ -83,6 +83,18 @@
 		<Unit filename="/home/blint/projects/nhf/main.c">
 			<Option target="nhf"/>
 		</Unit>
+		<Unit filename="/home/blint/projects/nhf/move.c">
+			<Option target="nhf"/>
+		</Unit>
+		<Unit filename="/home/blint/projects/nhf/move.h">
+			<Option target="nhf"/>
+		</Unit>
+		<Unit filename="/home/blint/projects/nhf/view.c">
+			<Option target="nhf"/>
+		</Unit>
+		<Unit filename="/home/blint/projects/nhf/view.h">
+			<Option target="nhf"/>
+		</Unit>
 		<Unit filename="/home/blint/projects/nhf/CMakeLists.txt">
 			<Option virtualFolder="CMake Files\"/>
 		</Unit>
diff --git a/main.c b/main.c
index 4fce4d8fc7cc989ea0ca4b1f266737d501c72388..9e0a4f8657c77b5d567bac2c5ce86555dbfdadf0 100644
--- a/main.c
+++ b/main.c
@@ -1,115 +1,20 @@
-#include <SDL2/SDL.h>
 #include <SDL2/SDL_image.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <stdbool.h>
+#include "view.h"
+#include "move.h"
 
 int H = 600;
 int W = 900;
-int owl = 50;
-int v = 5;
-int vx = 0;
-int vy = 0;
-
-void sdl_init(int szeles, int magas, SDL_Window **pwindow, SDL_Renderer **prenderer) {
-    if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
-        SDL_Log("Nem indithato az SDL: %s", SDL_GetError());
-        exit(1);
-    }
-    SDL_Window *window = SDL_CreateWindow("InfoC Mario nhf", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, szeles, magas, 0);
-    if (window == NULL) {
-        SDL_Log("Nem hozhato letre az ablak: %s", SDL_GetError());
-        exit(1);
-    }
-    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
-    if (renderer == NULL) {
-        SDL_Log("Nem hozhato letre a megjelenito: %s", SDL_GetError());
-        exit(1);
-    }
-    SDL_RenderClear(renderer);
-
-    *pwindow = window;
-    *prenderer = renderer;
-}
-
-void kirajzol(SDL_Renderer *renderer, SDL_Texture *kep, int x, int y) {
-
-    SDL_Rect src = {0, 0, 128, 128};
-    SDL_Rect dest = {x, y, owl, owl};
-    SDL_RenderCopy(renderer, kep, &src, &dest);
-}
-
-void move(SDL_Event ev)
-{
-    switch (ev.type) {
-
-        case SDL_KEYDOWN:
-            if (ev.key.keysym.sym == SDLK_a) {
-                vx = -1;
-                vx *= v;
-                break;
-            }
-
-            if (ev.key.keysym.sym == SDLK_d) {
-                vx = 1;
-                vx *= v;
-                break;
-            }
-
-            if (ev.key.keysym.sym == SDLK_w) {
-                vy = -1;
-                vy *= v;
-                break;
-            }
-
-            if (ev.key.keysym.sym == SDLK_s) {
-                vy = 1;
-                vy *= v;
-                break;
-            }
-
-        case SDL_KEYUP:
-            switch (ev.key.keysym.sym) {
-
-                case SDLK_a:
-                    if (vx < 0)
-                        vx = 0;
-                    break;
-
-                case SDLK_d:
-                    if (vx > 0)
-                        vx = 0;
-                    break;
-
-                case SDLK_w:
-                    if (vy < 0)
-                        vy = 0;
-                    break;
-
-                case SDLK_s:
-                    if (vy > 0)
-                        vy = 0;
-                    break;
-                default:
-                    break;
-            }
-            break;
-    }
-}
 
-int main(int argc, char *argv[]) {
+SDL_Window *window;
+SDL_Renderer *renderer;
+
 
-    SDL_Window *window;
-    SDL_Renderer *renderer;
+int main(int argc, char *argv[]) {
 
     sdl_init(W, H, &window, &renderer);
 
-    SDL_Texture *kep = IMG_LoadTexture(renderer, "infoc.png");
-    if (kep == NULL)
-    {
-        SDL_Log("Nem nyithato meg a kepfajl: %s", IMG_GetError());
-        exit(1);
-    }
+    SDL_Texture *kep = kep_betolt(renderer, "infoc.png");
 
     SDL_RenderPresent(renderer); //az elvegzett rajzolasok a kepernyore
 
diff --git a/move.c b/move.c
new file mode 100644
index 0000000000000000000000000000000000000000..4a6c2ff5bea0e954fd1b3ba4f4e702d8e1e08acf
--- /dev/null
+++ b/move.c
@@ -0,0 +1,68 @@
+//
+// Created by blint on 2019. 11. 06..
+//
+
+#include <SDL.h>
+#include "move.h"
+
+int v = 5;
+int vx = 0;
+int vy = 0;
+
+void move(SDL_Event ev)
+{
+    switch (ev.type) {
+
+        case SDL_KEYDOWN:
+            if (ev.key.keysym.sym == SDLK_a) {
+                vx = -1;
+                vx *= v;
+                break;
+            }
+
+            if (ev.key.keysym.sym == SDLK_d) {
+                vx = 1;
+                vx *= v;
+                break;
+            }
+
+            if (ev.key.keysym.sym == SDLK_w) {
+                vy = -1;
+                vy *= v;
+                break;
+            }
+
+            if (ev.key.keysym.sym == SDLK_s) {
+                vy = 1;
+                vy *= v;
+                break;
+            }
+
+        case SDL_KEYUP:
+            switch (ev.key.keysym.sym) {
+
+                case SDLK_a:
+                    if (vx < 0)
+                        vx = 0;
+                    break;
+
+                case SDLK_d:
+                    if (vx > 0)
+                        vx = 0;
+                    break;
+
+                case SDLK_w:
+                    if (vy < 0)
+                        vy = 0;
+                    break;
+
+                case SDLK_s:
+                    if (vy > 0)
+                        vy = 0;
+                    break;
+                default:
+                    break;
+            }
+            break;
+    }
+}
\ No newline at end of file
diff --git a/move.h b/move.h
new file mode 100644
index 0000000000000000000000000000000000000000..bc02e45a699c58cada00ed414a576040f830f1dc
--- /dev/null
+++ b/move.h
@@ -0,0 +1,14 @@
+//
+// Created by blint on 2019. 11. 06..
+//
+
+#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);
\ No newline at end of file
diff --git a/view.c b/view.c
new file mode 100644
index 0000000000000000000000000000000000000000..b99afc1bbb4c4a90c1f17cfced9260ebcdd56f3b
--- /dev/null
+++ b/view.c
@@ -0,0 +1,51 @@
+//
+// Created by blint on 2019. 11. 06..
+//
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_image.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "view.h"
+
+int owl = 50;
+
+void sdl_init(int szeles, int magas, SDL_Window **pwindow, SDL_Renderer **prenderer) {
+    if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
+        SDL_Log("Nem indithato az SDL: %s", SDL_GetError());
+        exit(1);
+    }
+    SDL_Window *window = SDL_CreateWindow("InfoC Mario nhf", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, szeles, magas, 0);
+    if (window == NULL) {
+        SDL_Log("Nem hozhato letre az ablak: %s", SDL_GetError());
+        exit(1);
+    }
+    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+    if (renderer == NULL) {
+        SDL_Log("Nem hozhato letre a megjelenito: %s", SDL_GetError());
+        exit(1);
+    }
+    SDL_RenderClear(renderer);
+
+    *pwindow = window;
+    *prenderer = renderer;
+}
+
+SDL_Texture *kep_betolt(SDL_Renderer *renderer, char *filename)
+{
+    SDL_Texture *kep = IMG_LoadTexture(renderer, filename);
+    if (kep == NULL)
+    {
+        SDL_Log("Nem nyithato meg a kepfajl: %s", IMG_GetError());
+        exit(1);
+    }
+
+    return kep;
+}
+
+void kirajzol(SDL_Renderer *renderer, SDL_Texture *kep, int x, int y) {
+
+    SDL_Rect src = {0, 0, 128, 128};
+    SDL_Rect dest = {x, y, owl, owl};
+    SDL_RenderCopy(renderer, kep, &src, &dest);
+}
+
diff --git a/view.h b/view.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8f37356afe54862d3f6cb634de7aa3158682185
--- /dev/null
+++ b/view.h
@@ -0,0 +1,16 @@
+//
+// Created by blint on 2019. 11. 06..
+//
+
+#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);
+
+SDL_Texture *kep_betolt(SDL_Renderer *renderer, char *filename);
+
+void kirajzol(SDL_Renderer *renderer, SDL_Texture *kep, int x, int y);
\ No newline at end of file