Nimbin[12]?SDL & Graphics / mapcreator / src/character/message.hpp

mapcreator git · master

SDL3 2.5D game and engine using assets, with map editor

sdl3 c++ game engine map-editor cmake · first commit 2025-10-31 · last commit 2026-09-07 (1 month ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-spieleentwicklung/map_creator

C++ 99.3%
git clone https://git.christianimmanuel.de/sdl-graphics/mapcreator.gitwget https://git.christianimmanuel.de/sdl-graphics/mapcreator/archive/mapcreator.tar.gz
src/character/message.hpp 1.1 KB · 56 lines raw
#pragma once

#include "defaults/defaults.hpp"
#include "resource/resource_data.hpp"
#include <string>
#include <unordered_map>

class Game;
class Inventory;

enum class MessageType {
    CHARACTER,
    DISCOVERY,
    INVENTORY,
    RESOURCE,
    VEGETABLE,
    VEGETABLE_SEED,
};

struct Message_s {
    float duration = 0;
    MessageType message_type = MessageType::CHARACTER;
    std::string message = "";
    void* type_data = nullptr;
};

enum class MessageKey {
    MOIN,
    BUILDING_TOOL_REQUIRED,
    PLAYER_EXHAUSTED,
    DISCOVERED_RESOURCE,
    DISCOVERED_VEGETABLE,
    DISCOVERED_BUILDING,
    THIRST_20,
    THIRST_0,
    WATER_APPRECIATION,
    EAT_APPRECIATION,
    CRAFTED_ITEM,
    ADD_INVENTORY,
    ADD_RESOURCE,
    ADD_VEGETABLE,
    ADD_VEGETABLE_SEED,
    NOTHING_TO_INTERACT,
};

class Messages {
    public:
    std::unordered_multimap<MessageKey, Message_s> messages;
    std::unordered_map<MessageKey, Message_s> messages_data;

    Messages();
    void Add(MessageKey, void* type_data = nullptr);
    void Update();
    void Render(SDL_Renderer*, float center_x, float start_y);
    void render_InventoryMessages(Game*, Inventory* inventory);
};