Minor Fixes
This commit is contained in:
@@ -25,15 +25,29 @@ file(GLOB_RECURSE SRC_FILES "src/JUI/*.cpp")
|
||||
file(GLOB_RECURSE HEADER_FILES "include/JUI/*.hpp")
|
||||
file(GLOB_RECURSE TEST_SRC_FILES "include/Demos/*.hpp" "src/Demos/*.cpp")
|
||||
|
||||
#Copy the assets to the build directory.
|
||||
file(COPY "content" DESTINATION "${PROJECT_BINARY_DIR}")
|
||||
|
||||
#include_directories(lib)
|
||||
# Create JUI Shared Object Library
|
||||
|
||||
add_library(JUI SHARED ${SRC_FILES})
|
||||
add_library(JUI SHARED ${SRC_FILES}
|
||||
src/Demos/CurveTool/main.cpp
|
||||
include/Demos/CurveTool/CurveToolEditor.h)
|
||||
target_sources(JUI PUBLIC ${HEADER_FILES})
|
||||
target_include_directories(JUI INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
||||
# Find GLM and add to JUI.so
|
||||
|
||||
CPMAddPackage(
|
||||
NAME luacpp
|
||||
GITHUB_REPOSITORY jordanvrtanoski/luacpp
|
||||
GIT_TAG v0.2.0
|
||||
|
||||
)
|
||||
find_package(luacpp REQUIRED)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME glm
|
||||
GITHUB_REPOSITORY g-truc/glm
|
||||
@@ -66,7 +80,7 @@ include_directories(${SDL2_IMAGE_INCLUDE_DIRS})
|
||||
find_package(SDL2_gfx REQUIRED)
|
||||
find_package(SDL2_ttf REQUIRED)
|
||||
|
||||
target_link_libraries(JUI PUBLIC SDL2::Core SDL2::Main SDL2::Image SDL2::GFX SDL2::TTF)
|
||||
target_link_libraries(JUI PUBLIC SDL2::Core SDL2::Main SDL2::Image SDL2::GFX SDL2::TTF )
|
||||
|
||||
# Add SDL_FontCache to JUI
|
||||
# TODO: Switch to upstream SDL_FontCache, as FC_DrawAlignC is no longer utilized in JUI source
|
||||
@@ -90,5 +104,6 @@ CPMAddPackage("gh:nlohmann/json#v3.11.2")
|
||||
add_subdirectory("src/Demos/MinimalSDLIntegrationDemo")
|
||||
add_subdirectory("src/Demos/MockMenu")
|
||||
add_subdirectory("src/Demos/GameInterface")
|
||||
add_subdirectory("src/Demos/CurveTool")
|
||||
|
||||
# TODO: Export JUI as static lib??
|
@@ -45,7 +45,7 @@ namespace JUI {
|
||||
protected:
|
||||
bool enabled = true;
|
||||
SDL_Color disabled_color {64, 64, 64, 255};
|
||||
SDL_Color base_color {255, 255, 255, 255};
|
||||
SDL_Color base_color {192, 192, 192, 192};
|
||||
SDL_Color hover_color {128, 128, 128, 255};
|
||||
private:
|
||||
};
|
||||
|
@@ -67,7 +67,7 @@ namespace JUI {
|
||||
#pragma region Internals
|
||||
protected:
|
||||
float border_width = 1.0f; // Pixel thickness of the border lines
|
||||
SDL_Color bg_color {255,255,255,255}; // {RGBA} format color struct
|
||||
SDL_Color bg_color {128,128,128,128}; // {RGBA} format color struct
|
||||
SDL_Color border_color{192,192,192,255}; // {RGBA} format color struct
|
||||
bool clips_descendants = false; // Controls if child objects can render outside of the rectangle bounds.
|
||||
float border_radius = 0; // Curves the rectangle corners by n degrees
|
||||
|
@@ -8,6 +8,7 @@
|
||||
namespace JUI {
|
||||
// Text Widget - Expands to fill the size of the parent Container
|
||||
// TODO: Rich Text Support
|
||||
// TODO: Implement expected behavior of padding on text layout.
|
||||
class Text : public Widget, public TextBase {
|
||||
#pragma region Interface
|
||||
public:
|
||||
|
@@ -18,8 +18,6 @@ namespace JUI {
|
||||
using v2i = glm::vec<2, int>;
|
||||
using v2d = glm::vec<2, double>;
|
||||
|
||||
|
||||
|
||||
constexpr v2f v2_zero = {0, 0};
|
||||
constexpr v2f v2_one = {1, 1};
|
||||
|
||||
@@ -66,7 +64,7 @@ namespace JUI {
|
||||
Transform2D& Skew(const v2f&);
|
||||
Transform2D& SkewX(float x);
|
||||
Transform2D& SkewY(float y);
|
||||
Transform2D& Scale(const v2f& rhs) { glm::scale(); }
|
||||
Transform2D& Scale(const v2f& rhs);
|
||||
Transform2D& Scale(float scale);
|
||||
Transform2D& Scale(float x, float y) { Scale({x, y}); }
|
||||
Transform2D& ScaleX(float x);
|
||||
@@ -99,16 +97,11 @@ namespace JUI {
|
||||
};
|
||||
|
||||
|
||||
JUI::Angle operator "" _degrees(long double dg);
|
||||
JUI::Angle operator "" _radians(long double rd);
|
||||
|
||||
JUI::Angle operator "" _degrees(long double dg)
|
||||
{ return {static_cast<float>(dg)}; }
|
||||
JUI::Angle operator "" _radians(long double rd)
|
||||
{ return {static_cast<float>(rd)}; }
|
||||
|
||||
JUI::Angle operator "" _deg(long double dg)
|
||||
{ return {static_cast<float>(dg)}; }
|
||||
JUI::Angle operator "" _rad(long double rd)
|
||||
{ return {static_cast<float>(rd)}; }
|
||||
JUI::Angle operator "" _deg(long double dg);
|
||||
JUI::Angle operator "" _rad(long double rd);
|
||||
|
||||
|
||||
enum class ButtonState {Pressed, Released};
|
||||
|
@@ -5,5 +5,5 @@ file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "*.h" "*.cpp")
|
||||
|
||||
add_executable(MinimalSDLIntegrationDemo ${SRC_FILES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC JUI)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC JUI )
|
||||
#include_directories("include")
|
@@ -10,6 +10,7 @@
|
||||
#include <JUI/Widgets/Button.hpp>
|
||||
#include <JUI/Widgets/Window.h>
|
||||
|
||||
|
||||
// This is a demo of a Minimal SDL2 rendering setup, and how to integrate JUI
|
||||
// into it as such, as opposed to the abstraction layer of SDLGame.hpp cluttering
|
||||
// the involved logic
|
||||
@@ -60,6 +61,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region Scene Construction
|
||||
JUI::Load(renderer);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
project("MockMenu")
|
||||
|
||||
set(SRC_FILES "")
|
||||
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "*.h" "*.cpp")
|
||||
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "../SDLGame.h" "../SDLGame.cpp" "*.h" "*.cpp")
|
||||
|
||||
add_executable(MockMenu ${SRC_FILES})
|
||||
|
||||
|
@@ -120,8 +120,8 @@ void JUIDemoGame::Initialize() {
|
||||
rect->SetAnchorPoint({0.5f, 0.5f});
|
||||
rect->SetParent(Gui);
|
||||
|
||||
rect->MousePressed += [rect] (MouseButtonID id) mutable { if (!rect->GetDrag()) rect->SetDrag(true); };
|
||||
rect->MouseReleased += [rect](MouseButtonID id) mutable { if (rect->GetDrag()) rect->SetDrag(false); };
|
||||
//rect->MousePressed += [rect] (MouseButtonID id) mutable { if (!rect->GetDrag()) rect->SetDrag(true); };
|
||||
//rect->MouseReleased += [rect](MouseButtonID id) mutable { if (rect->GetDrag()) rect->SetDrag(false); };
|
||||
|
||||
auto* topbar = new JUI::Rect();
|
||||
|
||||
|
@@ -1,9 +1,6 @@
|
||||
#include "Demos/MockMenu/JUIDemoGame.hpp"
|
||||
#include <chrono>
|
||||
|
||||
|
||||
// TODO: Move this file to MockMenu/
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << SDL_GetBasePath() << std::endl;
|
||||
|
@@ -75,4 +75,15 @@ namespace JUI {
|
||||
ActiveTweens.push_back(tween);
|
||||
}
|
||||
|
||||
JUI::Angle operator ""_degrees(long double dg) { return {static_cast<float>(dg)}; }
|
||||
|
||||
JUI::Angle operator ""_radians(long double rd) { return {static_cast<float>(rd)}; }
|
||||
|
||||
JUI::Angle operator ""_deg(long double dg) { return {static_cast<float>(dg)}; }
|
||||
|
||||
JUI::Angle operator ""_rad(long double rd) { return {static_cast<float>(rd)}; }
|
||||
|
||||
Transform2D &Transform2D::Scale(const v2f &rhs) {
|
||||
return *this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user