22 Commits

Author SHA1 Message Date
jonny-vb
778c69f67a Change file strcture: Add assets folder
Change file strcture to make creating a release easier:
- files: move all resources needed by the executable to the folder assets
- cmake: copy the assets folder to build folder after compilation
- adjust all filepaths in source files
2023-12-19 09:43:49 -08:00
jonny_l480
4ea40d99d2 Fix delay after crash (play crash sound async) 2023-12-18 14:50:47 +01:00
Hanse-14
18feb2ec62 Add Leaderboard
- it is only possible to close with clicking on 'X' with mouse
2023-12-18 07:22:01 +01:00
Hanse-14
b5e85de24c Add module 'files'
- write score after death
- read a number of scores
2023-12-18 04:47:44 +01:00
Hanse-14
7acb37824e Minor fixes 2023-12-18 03:16:36 +01:00
Hanse-14
f6619d1289 Add difficulty level and start map
- game speed(cycleDurationMs) and food placement depend on difficulty level
- start map would be chosen at the beginning
- switching maps and game speed(cycleDurationMs) is not available during playing
2023-12-18 01:42:13 +01:00
Hanse-14
c10481021f Add start start screen
- many updates in some files
2023-12-17 00:44:43 +01:00
jonny_jr9
6b4bcb09a8 Fix segfault sound-thread (mutex), Add Portal sound
Major changes to sound.c:
    - add mutex (fixes segfault, free erros)
    - allow only one sound at a time, wait for previous to finish
    - outsource init function
    - add global variables
    - return if successfully played
2023-12-15 00:01:22 +01:00
jonny_jr9
9c1ca72321 Add sounds when food eaten, FIXME: adds unwanted delay
playSound() causes approx 200ms delay before playing a sound
which now significantly lags the game when picking up food
2023-12-14 20:29:03 +01:00
jonny_jr9
bc363a9f8b Add playSound(), Reduce debug output - sound on collide works
currently plays sound when snake crashes (leaderboard shown)

- shorten example audio file
- Add sound.c: abstract function to play .wav files
- config:
    - Add config option RENDER_GAME_TO_CONSOLE
    - disable debug output
2023-12-14 18:39:20 +01:00
jonny_l480
5cd0f41123 Quit game when collided 2023-12-13 17:40:54 +01:00
jonny_l480
cc4f8f169f Add map rotate and speed change via keys (1, 2 , m) 2023-12-11 12:47:46 +01:00
jonny_jr9
f5a7a90168 Add defaultMap config option 2023-12-10 20:58:18 +01:00
jonny_jr9
a56c78e1ee Merge branch 'testing' into dev 2023-12-10 17:05:29 +01:00
Julia09055x
e66567d232 Snake bewegt sich, Fenster wird mit Portal und Food erstellt 2023-12-10 16:52:20 +01:00
jonny_jr9
3c0f837daa Add new map "empty", Increase game speed 2023-12-04 23:12:33 +01:00
jonny_jr9
cf92191177 Fix #2 random segfault after growing
see issue for more details
https://github.com/Jonny999999/snake-pp/issues/2
2023-12-04 22:58:08 +01:00
jonny_jr9
ad1dd7f5c3 Add tests, Disable collision - Game runs in console!
currently starts SDL window and repeatedly renders the game to console.
The snake can be controlled with arrow-keys while the SDL-window is focused.

main: add 3 test sections for testing certain functions that can be enabled using a macro variable
game.c: temporarily disable collision, otherwise confusing state because main and menu not implemented yet.
2023-12-03 22:16:55 +01:00
jonny_jr9
529b633c7a minor Fixes in game.c and map.c
- game: fix target position on teleport
- map: also print snake head and tail to console
2023-12-03 21:56:18 +01:00
jonny_jr9
061b4431c7 Implement game.c, food.c and map.c
- Implemented the functions in the above files
 - game and map are partially tested
 - food is extensively tested using the created test-function
- Also added DELAY(ms) macro to common.c
2023-11-11 11:14:38 +01:00
jonny_jr9
3e40be47cf Update module structure: Add map.c
=> global config and game struct changed
=> some functions were dropped/moved
- Outsourced data types and functions to map.c / map.h
- Update function and module diagram
- Adjust custom data types in source code
2023-11-10 12:46:00 +01:00
jonny_jr9
7309707a97 Change folder structure (Add folders: src, include)
Add src folder for all .c and include folder .h files
=> clearer structure, no documents mixed into code files
2023-11-08 20:41:21 +01:00