Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
efafcd6
Create cmake-multi-platform.yml
Dequilla Jul 4, 2025
037ae60
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
714aa3d
Update install_deps.sh
Dequilla Jul 4, 2025
0a452d2
Removed SDL, whoops
Dequilla Jul 4, 2025
cf4b5a5
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
78059b2
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
96c182a
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
5c21f7f
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
fd266f8
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
4fa823b
Changed SDL3 to clone instead via git, more cross-distro and platform…
Dequilla Jul 4, 2025
45cf7e6
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
5cf9b18
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
a3f655a
Update cmake-multi-platform.yml
Dequilla Jul 4, 2025
ee97983
Update install_deps.sh
Dequilla Jul 4, 2025
a9435db
Update CMakeLists.txt
Dequilla Jul 4, 2025
45c2b51
Update CMakeLists.txt
Dequilla Jul 4, 2025
3b0248c
Added include_directories for SDL3 even though locally it still works.
Dequilla Jul 4, 2025
9a6b657
Added compiler output to confirm it in github actions.
Dequilla Jul 4, 2025
3e35991
Commented windows CI paths for now.
Dequilla Jul 4, 2025
e27c6d1
Rename cmake-multi-platform.yml to Lucent Build.yml
Dequilla Jul 4, 2025
a17d9de
Update and rename Lucent Build.yml to lucent_cross_platform_build.yml
Dequilla Jul 4, 2025
6ca183f
Whoops, no cl.exe on ubuntu..
Dequilla Jul 4, 2025
a5813c0
Build badge in readme.
Dequilla Jul 4, 2025
7bbec11
Merge branch 'ci' of github.com:Dequilla/Lucent into ci
Dequilla Jul 4, 2025
1670d33
Viewport updates with window now.
Dequilla Jul 7, 2025
38aeca7
Merge branch 'master' into ci
Dequilla Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ make

# Now move resources files
echo "-LU- Moving resources..."
cd src/
cd Release

if [ -d "$Resources/" ]; then
rm -rf Resources/
Expand Down
7 changes: 7 additions & 0 deletions include/Core/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ namespace lu
void display(); /**< Changes buffer behind the scene essentially
displaying all that has been rendered */

/**
* \brief Notify the window of incoming events
*
* @param e The incoming event.
*/
void notify(const SDL_Event &e);

/**
* \brief Sets the window size
*
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ lu::core::Application::initInternal()
// Retrieve SDL_Versions
lu::core::log("SDL3 version: " + std::to_string(SDL_VERSION));

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD |
SDL_INIT_EVENTS) < 0)
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD |
SDL_INIT_EVENTS))
{
lu::core::log(LU_AT,
"Failed to initialize SDL with error:\n" +
Expand Down
22 changes: 21 additions & 1 deletion src/Core/Window.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Core/Window.h"

#include "Core/Application.h"

void
lu::core::Window::initVideoComponents()
{
Expand Down Expand Up @@ -108,6 +110,23 @@ lu::core::Window::display()
SDL_GL_SwapWindow(m_window);
}

void
lu::core::Window::notify(const SDL_Event &e)
{
switch (e.type)
{
case SDL_EVENT_WINDOW_RESIZED:
{
std::cout << e.window.data1 << "-" << e.window.data2 << std::endl;
setSize(e.window.data1, e.window.data2);
lu::core::Application::setScreenBufferSize(e.window.data1,
e.window.data2);
glViewport(0, 0, e.window.data1, e.window.data2);
}
break;
}
}

void
lu::core::Window::setSize(int width, int height)
{
Expand Down Expand Up @@ -136,6 +155,7 @@ glm::vec2
lu::core::Window::getSize()
{
int width, height;
SDL_GetWindowSize(m_window, &width, &height);
// SDL_GetWindowSize(m_window, &width, &height);
SDL_GetWindowSizeInPixels(m_window, &width, &height);
return glm::vec2(width, height);
}
13 changes: 7 additions & 6 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
#include "GL/glew.h"
#include <SDL3/SDL.h>

#include "GLM/glm.hpp"

#include "Graphics/Text/Font.h"

#include "Core/Application.h"
#include "Core/Time.h"
#include "Core/Window.h"
#include "GLM/glm.hpp"
#include "Graphics/Text/Font.h"

#include "Game/GameMode/ExampleGameMode.h"

Expand Down Expand Up @@ -45,6 +43,9 @@ main(int argc, char *argv[])
lu::core::Application::enableVSYNC(true);
window.setWindowGrab(true);

auto size = window.getSize();
std::cout << "Size: " << size.x << "x" << size.y << std::endl;

lu::game::ExampleGameMode exGameMode;
exGameMode.init();

Expand Down Expand Up @@ -77,13 +78,13 @@ main(int argc, char *argv[])
while (SDL_PollEvent(&e) != 0)
{
exGameMode.checkInput(e);
window.notify(e);

if (e.type == SDL_EVENT_QUIT)
{
running = false;
}

if (e.type == SDL_EVENT_KEY_DOWN)
else if (e.type == SDL_EVENT_KEY_DOWN)
{
// TOGGLE FULLSCREEN
if (e.key.key == SDLK_F11)
Expand Down