# SLOVENSKO:

# Končni Projekt za 3. Letnik - PRAP

## Uporabljene knjižnice
- SDL3
- SDL3_image
- SDL3_ttf
- SDL3_mixer
- stdc++23

## Build
gcc compiler + cmake

```bash
mkdir build
cd build
cmake ..
make -j
```

(Za Windows uporabite MSYS2 MINGW64 terminal)

## Delovanje

### Master Thread (Rendering Thread)
Ta nit/thread ustvari glavno okno in kliče metode za renderiranje. Prav tako obdeluje dogodke (events) in posodablja stanje igre.

### Game Thread (Slave Thread)
Ta nit/thread izvaja glavno zanko igre, posodablja stanje igre in entitete. Odgovarja za logiko igre, medtem ko master thread skrbi za renderiranje in dogodke.

### Sinhronizacija
Med tema dvema nitoma se uporablja `std::shared_mutex` za sinhronizacijo dostopa do skupnih virov, kot so entitete v `GameState`. Master thread uporablja `std::shared_lock` za branje entitet med renderiranjem, medtem ko game thread uporablja `std::unique_lock` za posodabljanje entitet.

## Licenca
Vsa izvorna koda (razen kadar je drugače navedeno ali uporabljeno) je licencirana pod "Lesser General Public License v2.1" edino (okrajšano na "LGPL v2.1-only"). Več informacij o licenci najdete v datoteki LICENSE.
Vse slike (v direktorijo resources/) so podane pod "Creative Commons Attribution-ShareAlike" (CC BY-SA) licenco.
Font "Roboto" je licenciran pod "SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007" (Na voljo na spletu).

## Avtorske pravice
Vse avtorske pravice (copyright) so rezervirane k avtorju te izvorne kode/slik.

<hr>
<hr>

# ENGLISH:

# Finals Project for Junior Year - PRAP

## Uporabljene knjižnice
- SDL3
- SDL3_image
- SDL3_ttf
- SDL3_mixer
- stdc++23

## Build
gcc compiler + cmake

```bash
mkdir build
cd build
cmake ..
make -j
```

(For Windows, use MSYS2 with the MINGW64 terminal)

## Operation

### Master Thread (Rendering Thread)
This thread creates the main window and calls rendering methods. It also handles events and updates the game state.

### Game Thread (Slave Thread)
This thread runs the main game loop, updating the game state and entities. It is responsible for game logic, while the master thread handles rendering and events.

### Synchronization
A `std::shared_mutex` is used between the two threads to synchronize access to shared resources, such as entities in `GameState`. The master thread uses `std::shared_lock` to read entities during rendering, while the game thread uses `std::unique_lock` to update entities.

## License
All source code (unless otherwise stated or used) is licensed under the "Lesser General Public License v2.1 only" (abbreviated as "LGPL v2.1-only"). More information about the license can be found in the LICENSE file.

All images (in the `resources/` directory) are provided under the "Creative Commons Attribution-ShareAlike" (CC BY-SA) license.

The font "Roboto" is licensed under the "SIL Open Font License Version 1.1 - 26 February 2007" (available online).

## Copyright
All copyrights are reserved by the author of this source code/images.