Skip to content

Commit e6b7836

Browse files
committed
Application can now be named from client (and size set), changed unsigned int to uint32_t in codebase
1 parent dd455b2 commit e6b7836

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

OpenGL-Core/src/GLCore/Core/Application.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace GLCore {
1313

1414
Application* Application::s_Instance = nullptr;
1515

16-
Application::Application()
16+
Application::Application(const std::string& name, uint32_t width, uint32_t height)
1717
{
1818
if (!s_Instance)
1919
{
@@ -24,7 +24,7 @@ namespace GLCore {
2424
GLCORE_ASSERT(!s_Instance, "Application already exists!");
2525
s_Instance = this;
2626

27-
m_Window = std::unique_ptr<Window>(Window::Create());
27+
m_Window = std::unique_ptr<Window>(Window::Create({ name, width, height }));
2828
m_Window->SetEventCallback(BIND_EVENT_FN(OnEvent));
2929

3030
// Renderer::Init();

OpenGL-Core/src/GLCore/Core/Application.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace GLCore {
1616
class Application
1717
{
1818
public:
19-
Application();
19+
Application(const std::string& name = "OpenGL Sandbox", uint32_t width = 1280, uint32_t height = 720);
2020
virtual ~Application() = default;
2121

2222
void Run();

OpenGL-Core/src/GLCore/Core/LayerStack.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace GLCore {
2222
std::vector<Layer*>::iterator end() { return m_Layers.end(); }
2323
private:
2424
std::vector<Layer*> m_Layers;
25-
unsigned int m_LayerInsertIndex = 0;
25+
uint32_t m_LayerInsertIndex = 0;
2626
};
2727

2828
}

OpenGL-Core/src/GLCore/Core/Window.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace GLCore {
1010
struct WindowProps
1111
{
1212
std::string Title;
13-
unsigned int Width;
14-
unsigned int Height;
13+
uint32_t Width;
14+
uint32_t Height;
1515

1616
WindowProps(const std::string& title = "OpenGL Sandbox",
17-
unsigned int width = 1280,
18-
unsigned int height = 720)
17+
uint32_t width = 1280,
18+
uint32_t height = 720)
1919
: Title(title), Width(width), Height(height)
2020
{
2121
}
@@ -31,8 +31,8 @@ namespace GLCore {
3131

3232
virtual void OnUpdate() = 0;
3333

34-
virtual unsigned int GetWidth() const = 0;
35-
virtual unsigned int GetHeight() const = 0;
34+
virtual uint32_t GetWidth() const = 0;
35+
virtual uint32_t GetHeight() const = 0;
3636

3737
// Window attributes
3838
virtual void SetEventCallback(const EventCallbackFn& callback) = 0;

OpenGL-Core/src/GLCore/Events/ApplicationEvent.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ namespace GLCore {
77
class WindowResizeEvent : public Event
88
{
99
public:
10-
WindowResizeEvent(unsigned int width, unsigned int height)
10+
WindowResizeEvent(uint32_t width, uint32_t height)
1111
: m_Width(width), m_Height(height) {}
1212

13-
inline unsigned int GetWidth() const { return m_Width; }
14-
inline unsigned int GetHeight() const { return m_Height; }
13+
inline uint32_t GetWidth() const { return m_Width; }
14+
inline uint32_t GetHeight() const { return m_Height; }
1515

1616
std::string ToString() const override
1717
{
@@ -23,7 +23,7 @@ namespace GLCore {
2323
EVENT_CLASS_TYPE(WindowResize)
2424
EVENT_CLASS_CATEGORY(EventCategoryApplication)
2525
private:
26-
unsigned int m_Width, m_Height;
26+
uint32_t m_Width, m_Height;
2727
};
2828

2929
class WindowCloseEvent : public Event

OpenGL-Core/src/Platform/Windows/WindowsWindow.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ namespace GLCore {
105105
}
106106
});
107107

108-
glfwSetCharCallback(m_Window, [](GLFWwindow* window, unsigned int keycode)
108+
glfwSetCharCallback(m_Window, [](GLFWwindow* window, uint32_t keycode)
109109
{
110110
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
111111

OpenGL-Core/src/Platform/Windows/WindowsWindow.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ namespace GLCore {
1414

1515
void OnUpdate() override;
1616

17-
inline unsigned int GetWidth() const override { return m_Data.Width; }
18-
inline unsigned int GetHeight() const override { return m_Data.Height; }
17+
inline uint32_t GetWidth() const override { return m_Data.Width; }
18+
inline uint32_t GetHeight() const override { return m_Data.Height; }
1919

2020
// Window attributes
2121
inline void SetEventCallback(const EventCallbackFn& callback) override { m_Data.EventCallback = callback; }
@@ -32,7 +32,7 @@ namespace GLCore {
3232
struct WindowData
3333
{
3434
std::string Title;
35-
unsigned int Width, Height;
35+
uint32_t Width, Height;
3636
bool VSync;
3737

3838
EventCallbackFn EventCallback;

0 commit comments

Comments
 (0)