Commit graph

146 commits

Author SHA1 Message Date
Ólafur Waage
fe32b18d0c Isolating SFML to the Canvas class. 2021-09-06 15:38:40 +02:00
Ólafur Waage
aa22b91e8b Adding header files to their own folder in the project. 2021-09-06 14:51:01 +02:00
Patricia Aas
d196491ea4 Rename variable and remove unneeded curlies 2021-08-25 11:26:13 +02:00
Patricia Aas
4b7015b96b Remove unneeded init 2021-08-25 11:23:54 +02:00
Corentin Jabot
af1c650727 Be more explicit about captures 2021-08-12 10:19:54 +02:00
Corentin Jabot
b3798ef2df Remove a nodiscard 2021-08-12 10:18:51 +02:00
Patricia Aas
eaf61585ea Fix Clang-Tidy warnings 2021-08-02 16:43:18 +02:00
Corentin Jabot
76c931656f Remove nodiscard 2021-08-02 15:31:32 +02:00
Patricia Aas
d3cc1d90c7 Fix warnings 2021-08-02 15:28:07 +02:00
Corentin Jabot
2cc15c6dcb add toolchain file 2021-08-02 14:46:26 +02:00
Patricia Aas
c10eb99336 Early return in Clyde 2021-08-02 14:24:11 +02:00
Patricia Aas
ab9664d07f Name changes and typos 2021-08-02 14:09:03 +02:00
Corentin Jabot
17ac48f713 Implement ghost movements 2021-07-29 11:16:08 +02:00
Patricia Aas
43ccaae3ef Rename variable 2021-07-28 19:06:35 +02:00
Patricia Aas
99cf57956c Init pos 2021-07-28 17:01:22 +02:00
Patricia Aas
4d53ccce18 Introduce scatterTarget function and inline things that should be in the ghost 2021-07-28 16:39:27 +02:00
Corentin Jabot
f31d238bd4 Rename speedy, remove starting position 2021-07-28 16:20:19 +02:00
Patricia Aas
79b78f7dc0 Remove pacman:: 2021-07-28 15:41:32 +02:00
Patricia Aas
71cb40ad18 Remove unused parameter 2021-07-28 15:30:53 +02:00
Patricia Aas
5b2b0d8e73 Make files for ghosts 2021-07-28 15:28:36 +02:00
Corentin Jabot
fe04e7d03a Cleanup PacManAnimation a bit 2021-07-19 12:06:27 +02:00
Corentin Jabot
d6a046ff47 Use the correct ghost names 2021-07-16 09:35:32 +02:00
Corentin Jabot
0428366e86 Call reserve and add uncommited code 2021-07-16 09:19:10 +02:00
Corentin Jabot
691aac978e Get rid of tuple 2021-07-15 09:14:25 +02:00
Patricia Aas
522362152d Refactor 2021-07-13 14:26:57 +02:00
Corentin Jabot
43cfecc077 Get rid of unused comparison operator 2021-07-09 10:24:24 +02:00
Patricia Aas
ee3c7c61db Simplify 2021-07-08 18:12:03 +02:00
Patricia Aas
890d061a92 Move teleport to Board 2021-07-08 18:00:39 +02:00
Corentin Jabot
370a57f454 Get rid of board class 2021-07-08 17:42:24 +02:00
Patricia Aas
e5e46a0e65 Create GameState 2021-07-08 16:57:18 +02:00
Corentin Jabot
3966987e2a Put the scaling function in a lib 2021-07-08 10:18:36 +02:00
Corentin Jabot
cbd19df739 Implement scaling.
We render pack man at twice the size that we want on screen,
which is the native resolution of the asset file.
The maze is upscaled.
We then project everything onto a view which is applies
the scale factor.

This patches also dectect the appropriate scale on OSX.
This required a bit of objective C (scaling.mm),
but students should not look at this file and there
is a comment in that direction.
Scalling.cpp provides the default implementation
for other platforms.
2021-07-07 21:32:22 +02:00
Patricia Aas
3c638c057e No need to pass Board around 2021-07-07 11:39:09 +02:00
Patricia Aas
705ea717e1 Introduce a scale function and clean up 2021-07-07 11:25:13 +02:00
Patricia Aas
ce7dd70332 Very rough stab at scaling 2021-07-07 11:25:13 +02:00
Patricia Aas
e9fb5dac77 Fix some warnings and clang tidy 2021-07-07 11:24:12 +02:00
Corentin Jabot
dac3b12dc4 Explain how the ghosts move 2021-07-07 10:38:52 +02:00
Patricia Aas
5c982228c8 More font name fixes 2021-07-06 20:48:29 +02:00
Patricia Aas
742f4ce56a Round doesn't make sense 2021-07-06 17:11:49 +02:00
Patricia Aas
9bea9fdad9 Add back comment 2021-07-06 17:11:18 +02:00
Patricia Aas
138f2df152 PacMan size is an integer 2021-07-06 17:10:17 +02:00
Patricia Aas
f7b53d9fca Don't use -> 2021-07-06 17:09:42 +02:00
Patricia Aas
a7a1565c99 Prettify 2021-07-06 16:33:33 +02:00
Patricia Aas
ab1e68a266 Add missing include 2021-07-06 12:55:58 +02:00
Patricia Aas
eb36d24b31 Make it possible use GridPosition with emplace_back 2021-07-06 12:41:50 +02:00
Patricia Aas
30f69464dd Move over to size_t 2021-07-06 12:35:23 +02:00
Corentin Jabot
510e12a921 replace push_back with emplace_back 2021-07-06 10:07:35 +02:00
Corentin Jabot
3197f334d1 Fix linux build 2021-07-05 17:19:35 +02:00
Corentin Jabot
60095363f4 Put the code in a namespace 2021-07-05 14:10:01 +02:00
Corentin Jabot
d166f552f4 Simplify board code 2021-07-05 13:54:54 +02:00
Patricia Aas
7faadda5c0 Remove unused function 2021-07-05 12:18:08 +02:00
Corentin Jabot
727a2c5e76 Create an include 2021-07-05 12:02:36 +02:00
Corentin Jabot
e4991ab1dd Rename PositionInt 2021-07-05 11:47:03 +02:00
Corentin Jabot
ba515eaca5 Replace floats by doubles 2021-07-05 11:40:10 +02:00
Corentin Jabot
b5b9d9c168 Rename ghosts 2021-07-05 11:33:02 +02:00
Patricia Aas
7081a33e35 Remove unused includes and reformat 2021-07-02 14:47:33 +02:00
Patricia Aas
a62d668ead Simplify Ghost::currentSprite 2021-07-01 14:53:52 +02:00
Patricia Aas
0e72ff8be5 Make board a static double std::array 2021-07-01 14:33:59 +02:00
Patricia Aas
fc31086ab9 Initialize timeSinceDeath 2021-07-01 10:19:46 +02:00
Corentin Jabot
b6d0bad21c Fix mac build (again) 2021-07-01 10:19:46 +02:00
Corentin Jabot
a01f93cc90 Fix mac build 2021-07-01 10:19:46 +02:00
Corentin Jabot
5b0e561afc Pacman and ghosts can eat each others 2021-07-01 10:19:46 +02:00
Corentin Jabot
ced6cd829c Put the ghosts in a tuple to reduce duplication 2021-07-01 10:19:46 +02:00
Corentin Jabot
3e84746cee Simplify ghost movement code 2021-07-01 10:19:46 +02:00
Corentin Jabot
c2cfb8c734 Implement ghost movement and scatter behavior
Each ghost is trying to reach a point beyond the
corner of the board, which make them run in circle
2021-07-01 10:19:46 +02:00
Corentin Jabot
93186dc8b9 Add ghosts
No movement for now!
2021-06-24 18:33:08 +02:00
Corentin Jabot
79506d218e Make a ghost pen 2021-06-24 18:33:08 +02:00
Corentin Jabot
a0780c7a8c Display the number of remaining lives 2021-06-24 18:33:08 +02:00
Corentin Jabot
fedbc153ae Implement score 2021-06-24 18:33:08 +02:00
Corentin Jabot
42ee04203f Make pacman mouth wide open while he doesn't move 2021-06-24 18:33:08 +02:00
Corentin Jabot
ecf2ab8b6c Try to make animation less dependant on framerate 2021-06-24 18:33:08 +02:00
Corentin Jabot
a69e66d114 Pacman should not be animated when hitting a wall 2021-06-24 18:33:08 +02:00
Patricia Aas
f51b7d65e0 Reformat and add a gitignore 2021-06-22 13:17:12 +02:00
Patricia Aas
5f0c03c1fa Clang Tidy fixes 2021-06-22 13:17:12 +02:00
Patricia Aas
d4d2e2d00d Fix animation 2021-06-22 13:17:12 +02:00
Patricia Aas
9ca1f6f12d Initialize Event object 2021-06-22 13:17:12 +02:00
Patricia Aas
1fb5f23885 Check optional before it's used 2021-06-22 13:17:12 +02:00
Patricia Aas
4e753a6024 Remove declarations of functions that no longer exist 2021-06-22 13:17:12 +02:00
Patricia Aas
493923036a Make it work on Linux again 2021-06-22 13:17:12 +02:00
Patricia Aas
32886717de Make it work on windows 2021-06-22 13:17:12 +02:00
Patricia Aas
c6191b1f5d Reformat CMakeLists.txt 2021-06-22 13:17:12 +02:00
Corentin Jabot
c7ef086d3d Migrate from SDL to SFML
This simplifies the rendering code and remove all(!) pointers.

There is a number of unresolved issues

* Windows build ?
* position delta computation: migrating to SFML seems to have modified
the frame rate.
2021-06-22 13:17:12 +02:00
Corentin Jabot
f83bf46171 Fix Debug build on ubuntu 2021-06-16 15:59:52 +02:00
Corentin Jabot
98d728fb52 Fix missing header 2021-06-16 15:31:42 +02:00
Corentin Jabot
75fd208299 Basic Text rendering
Using SDL2_ttf and fmt
2021-06-16 15:18:47 +02:00
Corentin Jabot
f911f6e2a8 Eat pellets 2021-06-16 13:59:16 +02:00
Corentin Jabot
2398bf9c36 Fix animation 2021-06-16 13:18:05 +02:00
Corentin Jabot
e16d44cd23 Run clang format 2021-06-16 13:14:47 +02:00
Patricia Aas
68f63f3f66
Canvas rewrite (#6)
* Beginning rewrite

* Move all constants to canvas, wire sprite handling code

* Make Sprite a struct and reformat

* Fix warning

Co-authored-by: Corentin Jabot <corentinjabot@gmail.com>
2021-06-16 12:52:04 +02:00
Corentin Jabot
dad36d7362 Remove comments and unused headers 2021-06-16 09:58:19 +02:00
Corentin Jabot
f6efcbbf79 Support teleporting at the edges of the map 2021-06-16 01:39:37 +02:00
Corentin Jabot
bbf3731cf4 Change window geometry for scoring.
* Add margins all around the board for better aestetics.
* Add room for scoring
* Because the texture atlas is a 32x32 grid, we can manipulate
textures as positions on that grid and only create a rectangle
for that texture in the rendering code.
* Avoid hardcoded values in the rendering code.
2021-06-15 23:55:55 +02:00
Patricia Aas
27b8d47dec Move to pragma once 2021-06-10 14:42:51 +02:00
Patricia Aas
9644229061 Give function a shorter name to fit on a slide :) 2021-06-10 14:26:03 +02:00
Corentin Jabot
335a698226 Replace float_t by float 2021-05-10 15:14:38 +02:00
Corentin Jabot
164db664ef Use VCPKG and reorganization
* Remove non-pacman exercises.
* Use vcpkg instead of conan ( make vcpkg a submodule)
* Merge the readmem these will need to be improve later
2021-05-10 14:58:00 +02:00