43 lines
951 B
C++
43 lines
951 B
C++
// joc_asteroides.hpp - Lògica principal del joc
|
|
// © 1999 Visente i Sergi (versió Pascal)
|
|
// © 2025 Port a C++20 amb SDL3
|
|
|
|
#ifndef JOC_ASTEROIDES_HPP
|
|
#define JOC_ASTEROIDES_HPP
|
|
|
|
#include "core/types.hpp"
|
|
#include "game/constants.hpp"
|
|
#include "game/entities/bala.hpp"
|
|
#include "game/entities/enemic.hpp"
|
|
#include "game/entities/nau.hpp"
|
|
#include <SDL3/SDL.h>
|
|
#include <array>
|
|
#include <cstdint>
|
|
|
|
// Classe principal del joc
|
|
class JocAsteroides {
|
|
public:
|
|
JocAsteroides(SDL_Renderer *renderer);
|
|
~JocAsteroides() = default;
|
|
|
|
void inicialitzar();
|
|
void actualitzar(float delta_time);
|
|
void dibuixar();
|
|
void processar_input(const SDL_Event &event);
|
|
|
|
private:
|
|
SDL_Renderer *renderer_;
|
|
|
|
// Estat del joc
|
|
Nau nau_;
|
|
std::array<Enemic, Constants::MAX_ORNIS> orni_;
|
|
std::array<Bala, Constants::MAX_BALES> bales_;
|
|
Poligon chatarra_cosmica_;
|
|
uint16_t itocado_;
|
|
|
|
// Funcions privades
|
|
void tocado();
|
|
};
|
|
|
|
#endif // JOC_ASTEROIDES_HPP
|