r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
Common.hpp
Go to the documentation of this file.
1///
2/// @file Common.hpp
3/// @brief This file contains common definitions and constants
4/// @namespace utl
5///
6
7#pragma once
8
9#include <filesystem>
10
12
13#ifdef _WIN32
14#define NOMINMAX
15#define PLUGINS_EXTENSION ".dll"
16#elif __linux__
17#define PLUGINS_EXTENSION ".so"
18#elif __APPLE__
19#define PLUGINS_EXTENSION ".dylib"
20#endif
21
22namespace utl
23{
24 namespace Config
25 {
26 namespace Player
27 {
28 inline constexpr auto DEFAULT_PLAYER_NAME = "player";
29 } // namespace Player
30 namespace Audio
31 {
32 inline constexpr auto DEFAULT_AUDIO_VOLUME = 0.5F; // unused
33 inline constexpr auto DEFAULT_AUDIO_MUTED = false; // unused
34 } // namespace Audio
35 namespace Network
36 {
37 inline constexpr auto DEFAULT_NETWORK_HOST = "127.0.0.1";
38 inline constexpr auto DEFAULT_NETWORK_PORT = 2560;
39 } // namespace Network
40 namespace Window
41 {
42 inline constexpr auto DEFAULT_WINDOW_WIDTH = 1920;
43 inline constexpr auto DEFAULT_WINDOW_HEIGHT = 1080;
44 inline constexpr auto DEFAULT_WINDOW_FRAME_LIMIT = 240;
45 inline constexpr auto DEFAULT_WINDOW_FULLSCREEN = false;
46 } // namespace Window
47 namespace Game
48 {
49 inline constexpr auto DEFAULT_VIDEO_QUALITY = 1; // 0=Low, 1=Medium, 2=High
50 inline constexpr auto DEFAULT_CONTROL_SCHEME = 2; // 0=WASD, 1=ZQSD, 2=Arrows
51 inline constexpr auto DEFAULT_SKIN_INDEX = 0; // 0-4 different ship skins
52 } // namespace Game
53 namespace Color
54 {
55 static constexpr eng::Color DARK = {.r = 0U, .g = 0U, .b = 0U, .a = 255U};
56 static constexpr eng::Color CYAN_ELECTRIC = {.r = 0U, .g = 191U, .b = 255U, .a = 255U};
57 static constexpr eng::Color GRAY_BLUE_SUBTLE = {.r = 160U, .g = 160U, .b = 160U, .a = 255U};
58 static constexpr eng::Color STAR_BG = {.r = 100U, .g = 100U, .b = 150U, .a = 80U};
59 static constexpr eng::Color STAR_MID = {.r = 150U, .g = 150U, .b = 200U, .a = 120U};
60 static constexpr eng::Color YELLOW = {.r = 255U, .g = 255U, .b = 200U, .a = 200U};
61 static constexpr eng::Color CYAN_ELECTRIC_PARTICLES = {.r = 0U, .g = 191U, .b = 255U, .a = 100U};
62 static constexpr eng::Color CYAN_ELECTRIC_FOREGROUND = {.r = 0U, .g = 191U, .b = 255U, .a = 180U};
63 static constexpr eng::Color INFO_TEXT_COLOR = {.r = 180U, .g = 180U, .b = 180U, .a = 200U};
64 static constexpr eng::Color WHITE = {.r = 255U, .g = 255U, .b = 255U, .a = 255U};
65 static constexpr eng::Color WHITE_LOW = {.r = 255U, .g = 255U, .b = 255U, .a = 0U};
66 static constexpr eng::Color TEXT_VALUE_COLOR = {.r = 200U, .g = 200U, .b = 255U, .a = 255U};
67 static constexpr eng::Color WHITE_TRANS = {.r = 255U, .g = 255U, .b = 255U, .a = 100U};
68 static constexpr eng::Color BLUE = {.r = 200U, .g = 200U, .b = 255U, .a = 150U};
69 static constexpr eng::Color BLUE_SECOND = {.r = 50U, .g = 100U, .b = 200U, .a = 60U};
70 static constexpr eng::Color PURPLE = {.r = 100U, .g = 50U, .b = 150U, .a = 80U};
71 static constexpr eng::Color GREEN = {.r = 200U, .g = 255U, .b = 200U, .a = 180U};
72 static constexpr eng::Color GREEN_READY = {0U, 255U, 100U, 255U};
73
74 } // namespace Color
75 } // namespace Config
76 namespace Path
77 {
78 namespace Icons
79 {
80 inline constexpr auto ICON_APP = "assets/icons/icon.png";
81 } // namespace Icons
82 namespace Audio
83 {
84 inline constexpr auto AUDIO_TITLE = "assets/audio/title.mp3";
85 inline constexpr auto AUDIO_COIN = "assets/audio/coin.mp3";
86 inline constexpr auto AUDIO_BATTLE_THEME = "assets/audio/battle_theme.mp3";
87 inline constexpr auto AUDIO_INPUT = "assets/audio/input.wav";
88 inline constexpr auto AUDIO_DEATH_ALLIES = "assets/audio/deathallies.wav";
89 inline constexpr auto AUDIO_DEATH_ENEMIES = "assets/audio/deathennemies.wav";
90 inline constexpr auto AUDIO_SUPERCHARGED_SHOT = "assets/audio/shoot.wav";
91 inline constexpr auto AUDIO_BEGIN = "assets/audio/begin.wav";
92 inline constexpr auto AUDIO_GOOFY = "assets/audio/goofy.wav";
93 inline constexpr auto AUDIO_BOSS = "assets/audio/Bossmusic.mp3";
94 } // namespace Audio
95 namespace Font
96 {
97 inline constexpr auto FONTS_RTYPE = "assets/fonts/r-type.otf";
98 } // namespace Font
99 namespace Plugin
100 { // TODO(bobis33): dont use filesystem here
101 inline auto PLUGIN_AUDIO_SFML =
102 std::filesystem::path(PLUGINS_DIR) / ("audio_sfml" + std::string(PLUGINS_EXTENSION));
104 std::filesystem::path(PLUGINS_DIR) / ("network_asio_client" + std::string(PLUGINS_EXTENSION));
106 std::filesystem::path(PLUGINS_DIR) / ("renderer_sfml" + std::string(PLUGINS_EXTENSION));
107 inline auto PLUGIN_GAME_SOLO =
108 std::filesystem::path(PLUGINS_DIR) / ("game_rtype_client_solo" + std::string(PLUGINS_EXTENSION));
109 inline auto PLUGIN_GAME_MULTI =
110 std::filesystem::path(PLUGINS_DIR) / ("game_rtype_client_multi" + std::string(PLUGINS_EXTENSION));
111 } // namespace Plugin
112 namespace Texture
113 {
114 inline constexpr auto TEXTURE_PLAYER = "assets/sprites/r-typesheet42.gif";
115 inline constexpr auto TEXTURE_SHOOT = "assets/sprites/shoot.gif";
116 inline constexpr auto TEXTURE_SHOOT_CHARGED = "assets/sprites/shootcharged.gif";
117 inline constexpr auto TEXTURE_SHOOT_LOADING = "assets/sprites/shootchargedloading.gif";
118 inline constexpr auto TEXTURE_ENEMY_EASY = "assets/sprites/r-typesheet5.gif";
119 inline constexpr auto TEXTURE_ENEMY_BASIC = "assets/sprites/r-typesheet5.gif";
120 inline constexpr auto TEXTURE_ENEMY_ADVANCED = "assets/sprites/r-typesheet3.gif";
121 inline constexpr auto TEXTURE_BOSS = "assets/sprites/r-typesheet14.gif";
122 inline constexpr auto TEXTURE_ENEMY_PROJECTILE = "assets/sprites/r-typesheet20.gif";
123 inline constexpr auto TEXTURE_EXPLOSION = "assets/sprites/r-typesheet44.gif";
124 inline constexpr auto TEXTURE_STAGE1_FLOOR = "assets/sprites/floorstage1.png";
125 inline constexpr auto TEXTURE_STAGE1_CEILING = "assets/sprites/ceillingstage1.png";
126 // HUD score
127 inline constexpr auto TEXTURE_SCORE_COUNTER_BG = "assets/sprites/counter.png";
128 inline constexpr auto TEXTURE_SCORE_DIGIT_0 = "assets/sprites/counter0.png";
129 inline constexpr auto TEXTURE_SCORE_DIGIT_1 = "assets/sprites/counter1.png";
130 inline constexpr auto TEXTURE_SCORE_DIGIT_2 = "assets/sprites/counter2.png";
131 inline constexpr auto TEXTURE_SCORE_DIGIT_3 = "assets/sprites/counter3.png";
132 inline constexpr auto TEXTURE_SCORE_DIGIT_4 = "assets/sprites/counter4.png";
133 inline constexpr auto TEXTURE_SCORE_DIGIT_5 = "assets/sprites/counter5.png";
134 inline constexpr auto TEXTURE_SCORE_DIGIT_6 = "assets/sprites/counter6.png";
135 inline constexpr auto TEXTURE_SCORE_DIGIT_7 = "assets/sprites/counter7.png";
136 inline constexpr auto TEXTURE_SCORE_DIGIT_8 = "assets/sprites/counter8.png";
137 inline constexpr auto TEXTURE_SCORE_DIGIT_9 = "assets/sprites/counter9.png";
138
139 inline constexpr auto ICON_PATH = "assets/icons/icon.png";
140 } // namespace Texture
141 } // namespace Path
142} // namespace utl
This file contains the IRenderer class declaration.
#define PLUGINS_EXTENSION
constexpr auto DEFAULT_AUDIO_VOLUME
Definition Common.hpp:32
constexpr auto DEFAULT_AUDIO_MUTED
Definition Common.hpp:33
static constexpr eng::Color TEXT_VALUE_COLOR
Definition Common.hpp:66
static constexpr eng::Color PURPLE
Definition Common.hpp:70
static constexpr eng::Color GREEN_READY
Definition Common.hpp:72
static constexpr eng::Color GRAY_BLUE_SUBTLE
Definition Common.hpp:57
static constexpr eng::Color DARK
Definition Common.hpp:55
static constexpr eng::Color WHITE
Definition Common.hpp:64
static constexpr eng::Color CYAN_ELECTRIC_FOREGROUND
Definition Common.hpp:62
static constexpr eng::Color CYAN_ELECTRIC_PARTICLES
Definition Common.hpp:61
static constexpr eng::Color STAR_MID
Definition Common.hpp:59
static constexpr eng::Color CYAN_ELECTRIC
Definition Common.hpp:56
static constexpr eng::Color BLUE_SECOND
Definition Common.hpp:69
static constexpr eng::Color INFO_TEXT_COLOR
Definition Common.hpp:63
static constexpr eng::Color STAR_BG
Definition Common.hpp:58
static constexpr eng::Color WHITE_LOW
Definition Common.hpp:65
static constexpr eng::Color WHITE_TRANS
Definition Common.hpp:67
static constexpr eng::Color BLUE
Definition Common.hpp:68
static constexpr eng::Color YELLOW
Definition Common.hpp:60
static constexpr eng::Color GREEN
Definition Common.hpp:71
constexpr auto DEFAULT_VIDEO_QUALITY
Definition Common.hpp:49
constexpr auto DEFAULT_CONTROL_SCHEME
Definition Common.hpp:50
constexpr auto DEFAULT_SKIN_INDEX
Definition Common.hpp:51
constexpr auto DEFAULT_NETWORK_PORT
Definition Common.hpp:38
constexpr auto DEFAULT_NETWORK_HOST
Definition Common.hpp:37
constexpr auto DEFAULT_PLAYER_NAME
Definition Common.hpp:28
constexpr auto DEFAULT_WINDOW_FRAME_LIMIT
Definition Common.hpp:44
constexpr auto DEFAULT_WINDOW_WIDTH
Definition Common.hpp:42
constexpr auto DEFAULT_WINDOW_FULLSCREEN
Definition Common.hpp:45
constexpr auto DEFAULT_WINDOW_HEIGHT
Definition Common.hpp:43
constexpr auto AUDIO_BOSS
Definition Common.hpp:93
constexpr auto AUDIO_COIN
Definition Common.hpp:85
constexpr auto AUDIO_SUPERCHARGED_SHOT
Definition Common.hpp:90
constexpr auto AUDIO_BEGIN
Definition Common.hpp:91
constexpr auto AUDIO_DEATH_ALLIES
Definition Common.hpp:88
constexpr auto AUDIO_GOOFY
Definition Common.hpp:92
constexpr auto AUDIO_BATTLE_THEME
Definition Common.hpp:86
constexpr auto AUDIO_INPUT
Definition Common.hpp:87
constexpr auto AUDIO_DEATH_ENEMIES
Definition Common.hpp:89
constexpr auto AUDIO_TITLE
Definition Common.hpp:84
constexpr auto FONTS_RTYPE
Definition Common.hpp:97
constexpr auto ICON_APP
Definition Common.hpp:80
auto PLUGIN_RENDERER_SFML
Definition Common.hpp:105
auto PLUGIN_NETWORK_ASIO_CLIENT
Definition Common.hpp:103
constexpr auto TEXTURE_SCORE_DIGIT_3
Definition Common.hpp:131
constexpr auto TEXTURE_STAGE1_FLOOR
Definition Common.hpp:124
constexpr auto TEXTURE_SCORE_DIGIT_5
Definition Common.hpp:133
constexpr auto TEXTURE_SCORE_DIGIT_2
Definition Common.hpp:130
constexpr auto TEXTURE_SHOOT
Definition Common.hpp:115
constexpr auto ICON_PATH
Definition Common.hpp:139
constexpr auto TEXTURE_SCORE_DIGIT_9
Definition Common.hpp:137
constexpr auto TEXTURE_SCORE_DIGIT_6
Definition Common.hpp:134
constexpr auto TEXTURE_SHOOT_LOADING
Definition Common.hpp:117
constexpr auto TEXTURE_SCORE_DIGIT_1
Definition Common.hpp:129
constexpr auto TEXTURE_SCORE_DIGIT_4
Definition Common.hpp:132
constexpr auto TEXTURE_STAGE1_CEILING
Definition Common.hpp:125
constexpr auto TEXTURE_SCORE_COUNTER_BG
Definition Common.hpp:127
constexpr auto TEXTURE_SCORE_DIGIT_0
Definition Common.hpp:128
constexpr auto TEXTURE_SCORE_DIGIT_8
Definition Common.hpp:136
constexpr auto TEXTURE_ENEMY_PROJECTILE
Definition Common.hpp:122
constexpr auto TEXTURE_PLAYER
Definition Common.hpp:114
constexpr auto TEXTURE_ENEMY_ADVANCED
Definition Common.hpp:120
constexpr auto TEXTURE_ENEMY_BASIC
Definition Common.hpp:119
constexpr auto TEXTURE_EXPLOSION
Definition Common.hpp:123
constexpr auto TEXTURE_ENEMY_EASY
Definition Common.hpp:118
constexpr auto TEXTURE_SHOOT_CHARGED
Definition Common.hpp:116
constexpr auto TEXTURE_SCORE_DIGIT_7
Definition Common.hpp:135
constexpr auto TEXTURE_BOSS
Definition Common.hpp:121
unsigned char r
Definition IRenderer.hpp:17