Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 56dba32

Browse files
authored
refactor: remove 'usa' namespace (#18)
1 parent 7a6a093 commit 56dba32

23 files changed

+178
-257
lines changed

src/Engine/include/Engine/Application.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "Engine/Settings/Settings.hpp"
1818
#include "Scene.hpp"
1919

20-
namespace usa {
2120
namespace Engine {
2221

2322
class Application {
@@ -69,4 +68,3 @@ namespace Engine {
6968
};
7069

7170
} // namespace Engine
72-
} // namespace usa

src/Engine/include/Engine/Scene.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <SFML/Graphics/RenderWindow.hpp>
1111

12-
namespace usa {
1312
namespace Engine {
1413

1514
class Application;
@@ -35,4 +34,3 @@ namespace Engine {
3534
};
3635

3736
} // namespace Engine
38-
} // namespace usa

src/Engine/include/Engine/Settings/Settings.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "Engine/Json.hpp"
1313

14-
namespace usa {
1514
namespace Engine {
1615

1716
struct Settings {
@@ -30,4 +29,3 @@ namespace Engine {
3029
void to_json(Json &json, const Settings &settings);
3130
void from_json(const Json &json, Settings &settings);
3231
} // namespace Engine
33-
} // namespace usa

src/Engine/include/Engine/UI/AWidget.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#include <functional>
1818

19-
namespace usa {
20-
2119
namespace Engine {
2220

2321
/**
@@ -88,5 +86,3 @@ class AWidget
8886
};
8987

9088
}
91-
92-
}

src/Engine/include/Engine/UI/UiWindow.hpp

+32-36
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88

99
#include "AWidget.hpp"
1010

11-
namespace usa {
12-
1311
namespace Engine {
1412

1513
/**
1614
* @class UiWindow
17-
*
15+
*
1816
* @brief Window base class
19-
*
17+
*
2018
*/
2119
class UiWindow
2220
{
@@ -33,115 +31,115 @@ namespace Engine {
3331
public:
3432
/**
3533
* @brief Construct a new Ui Window object
36-
*
34+
*
3735
*/
3836
UiWindow() = default;
3937

4038
/**
4139
* @brief Construct a new Ui Window object
42-
*
40+
*
4341
* @param name The name of the window, the name may be rendered
4442
* @param flags The flags parameters of the window
4543
*/
4644
UiWindow(const std::string_view &name, ImGuiWindowFlags flags = 0) : m_window_flags(flags), m_name(name) {}
4745

4846
/**
4947
* @brief Destroy the Ui Window object
50-
*
48+
*
5149
*/
5250
virtual ~UiWindow() = default;
5351

5452
/**
5553
* @brief Open the window
56-
*
54+
*
5755
*/
5856
auto open() -> void { m_isOpen = true; }
5957

6058
/**
6159
* @brief Close the window
62-
*
60+
*
6361
*/
6462
auto close() -> void { m_isOpen = false; }
6563

6664
/**
6765
* @brief Render the window and everything it contains
68-
*
66+
*
6967
*/
7068
virtual auto render() -> void;
7169

7270
/**
7371
* @brief Set the Window Flags
74-
*
72+
*
7573
* @param flags The value of the flags, different value will trigger different options
7674
*/
7775
auto setWindowFlags(ImGuiWindowFlags flags) noexcept -> void { m_window_flags = flags; }
7876

7977
/**
8078
* @brief Set the position of the object
81-
*
79+
*
8280
* @param pos The new postion of the object
8381
*/
8482
auto setPosition(const ImVec2 &pos) noexcept -> void { m_position = pos; }
8583

8684
/**
8785
* @brief Set the size of the object
88-
*
86+
*
8987
* @param size The new size of the object
9088
*/
9189
auto setSize(const ImVec2 &size) noexcept -> void { m_size = size; }
9290

9391
/**
9492
* @brief Set the name of the object
95-
*
93+
*
9694
* @param name The new name of the object
9795
*/
9896
auto setName(const std::string_view &name) noexcept -> void { m_name = name; }
9997

10098
/**
10199
* @brief Get the Flags object
102-
*
103-
* @return ImGuiWindowFlags&
100+
*
101+
* @return ImGuiWindowFlags&
104102
*/
105103
auto getFlags() -> ImGuiWindowFlags &{ return m_window_flags; }
106104

107105
/**
108106
* @brief Get the position of the object
109-
*
110-
* @return const ImVec2&
107+
*
108+
* @return const ImVec2&
111109
*/
112110
auto getPosition() -> const ImVec2 & { return m_position; }
113111
/**
114112
* @brief Get the size of the object
115-
*
116-
* @return const ImVec2&
113+
*
114+
* @return const ImVec2&
117115
*/
118116
auto getSize() -> const ImVec2 & { return m_size; }
119117
/**
120118
* @brief Get the name of the object
121-
*
122-
* @return const std::string_view&
119+
*
120+
* @return const std::string_view&
123121
*/
124122
auto getName() -> const std::string_view & { return m_name; }
125123

126124
/**
127125
* @brief Add a new widget to the window
128-
*
129-
* @param widget The new widget to add
126+
*
127+
* @param widget The new widget to add
130128
*/
131129
auto addWidget(std::shared_ptr<AWidget> widget) -> void { m_WidgetList.emplace_back(widget); }
132-
130+
133131
/**
134132
* @brief Delete a widget stored in the window
135-
*
133+
*
136134
* @param name The name of the widget to delete
137135
* @return true Return true if a widget was delete
138136
* @return false Return false if no widget was found
139137
*/
140138
auto deleteWidget(const std::string_view &name) -> bool;
141-
139+
142140
/**
143141
* @brief Get the Widget object
144-
*
142+
*
145143
* @param name The name of the widget to get
146144
* @return std::shared_ptr<AWidget> Return a widget smart pointer if found
147145
* @return nullptr Return nullptr if the widget was not found
@@ -150,29 +148,27 @@ namespace Engine {
150148

151149
/**
152150
* @brief Add a new sub Window in the current window
153-
*
154-
* @param win The new window to add
151+
*
152+
* @param win The new window to add
155153
*/
156154
auto addWindow(std::shared_ptr<UiWindow> win) -> void { m_WindowList.emplace_back(win); }
157-
155+
158156
/**
159157
* @brief Delete a sub-window stored in the window
160-
*
158+
*
161159
* @param name the name of the sub-window to delete
162160
* @return true return true if a window was deleted
163161
* @return false return false otherwise
164162
*/
165163
auto deleteWindow(const std::string_view &name) -> bool;
166-
164+
167165
/**
168166
* @brief Get the Window object
169-
*
167+
*
170168
* @param name The name of the window object to get
171169
* @return std::shared_ptr<UiWindow> return a UiWindow smart pointer
172170
* @return nullptr return nullptr otherwise
173171
*/
174172
auto getWindow(const std::string_view &name) -> std::shared_ptr<UiWindow>;
175173
};
176174
}
177-
178-
}

src/Engine/include/Engine/UI/Widget/WButton.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <functional>
55
#include <string_view>
66

7-
namespace usa {
8-
97
namespace Engine {
108

119
/**
@@ -48,5 +46,3 @@ namespace Engine {
4846
};
4947

5048
}
51-
52-
}

src/Engine/include/Engine/UI/Widget/WMenuItem.hpp

+45-48
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,49 @@
44
#include <functional>
55
#include <string_view>
66

7-
namespace usa
8-
{
9-
10-
namespace Engine
7+
namespace Engine {
8+
9+
/**
10+
* @class WMenuItem
11+
*
12+
* @brief Widget class representing a Menu Item
13+
*
14+
*/
15+
class WMenuItem : public AWidget {
16+
private:
17+
std::string_view m_shortcut{};
18+
std::function<void()> f;
19+
20+
public:
21+
/**
22+
* @brief Construct a new WMenuItem object
23+
*
24+
* @param name The name of the menu item
25+
* @param shortcut The sub name of the menu item
26+
*/
27+
WMenuItem(const std::string_view &name, const std::string_view &shortcut = "") :
28+
AWidget(name, ImVec2()), m_shortcut(shortcut)
1129
{
12-
13-
/**
14-
* @class WMenuItem
15-
*
16-
* @brief Widget class representing a Menu Item
17-
*
18-
*/
19-
class WMenuItem : public AWidget
20-
{
21-
private:
22-
std::string_view m_shortcut{};
23-
std::function<void()> f;
24-
public:
25-
/**
26-
* @brief Construct a new WMenuItem object
27-
*
28-
* @param name The name of the menu item
29-
* @param shortcut The sub name of the menu item
30-
*/
31-
WMenuItem(const std::string_view &name, const std::string_view &shortcut = "") : AWidget(name, ImVec2()), m_shortcut(shortcut) {}
32-
33-
/**
34-
* @brief Destroy the WMenuItem object
35-
*
36-
*/
37-
virtual ~WMenuItem() = default;
38-
39-
/**
40-
* @brief Bind an action to the menu item
41-
*
42-
* @param func The function action to bind
43-
*/
44-
auto bindAction(std::function<void()> func) -> void override;
45-
46-
/**
47-
* @brief Render the menu item and check if it's triggered. If it is, call the bound function
48-
*
49-
*/
50-
auto render() -> void override;
51-
};
52-
53-
} // namespace Engine
54-
55-
} // namespace usa
30+
}
31+
32+
/**
33+
* @brief Destroy the WMenuItem object
34+
*
35+
*/
36+
virtual ~WMenuItem() = default;
37+
38+
/**
39+
* @brief Bind an action to the menu item
40+
*
41+
* @param func The function action to bind
42+
*/
43+
auto bindAction(std::function<void()> func) -> void override;
44+
45+
/**
46+
* @brief Render the menu item and check if it's triggered. If it is, call the bound function
47+
*
48+
*/
49+
auto render() -> void override;
50+
};
51+
52+
} // namespace Engine

0 commit comments

Comments
 (0)