Compare commits
No commits in common. "adf62d4c81048b5b04a938d14e2591a835f753fc" and "780f18727b0321cb1d23a25b462807745755fea4" have entirely different histories.
adf62d4c81
...
780f18727b
114
CMakeLists.txt
114
CMakeLists.txt
@ -1,65 +1,95 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.24)
|
||||||
|
project(RaylibDmx) # Project Name: RaylibDmx
|
||||||
|
|
||||||
# Set the project name
|
# nvim/fleet users (ONLY WORKS WITH MINGW/NINJA BUILDERS)
|
||||||
project(RaylibDmx)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
# Set the C++ standard
|
# Dependencies
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
## - Raylib
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
## - rlImGui
|
||||||
|
#### - ImGui
|
||||||
|
|
||||||
|
# Use FetchContent to download and build raylib
|
||||||
|
# This is a faster alternative to using a git repo, since this just downloads the source
|
||||||
|
# while the git repo pull takes a lot longer. Not sure why, other repos don't seem to have this issue
|
||||||
|
|
||||||
|
# If you would like to use git instead, use this:
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
#FetchContent_Declare(
|
||||||
|
# raylib
|
||||||
|
# GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
|
||||||
|
# GIT_TAG "master"
|
||||||
|
# GIT_SHALLOW TRUE
|
||||||
|
# GIT_PROGRESS TRUE
|
||||||
|
#)
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
# Include FetchContent module
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
set(FETCHCONTENT_QUIET FALSE)
|
||||||
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
|
||||||
|
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games
|
||||||
|
|
||||||
# Download and configure raylib
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
raylib
|
raylib
|
||||||
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
URL https://github.com/raysan5/raylib/archive/refs/tags/4.5.0.tar.gz
|
||||||
GIT_TAG 4.5.0 # or the latest version you want to use
|
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(raylib)
|
FetchContent_MakeAvailable(raylib)
|
||||||
|
|
||||||
# Download and configure ImGui
|
# Raylib conf
|
||||||
|
set(raylib_VERBOSE 1) # Not 100% sure if this does anything...
|
||||||
|
|
||||||
|
# Download and build Dear ImGui
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
imgui
|
imgui
|
||||||
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
||||||
GIT_TAG v1.89.2 # or the latest version you want to use
|
GIT_SHALLOW TRUE
|
||||||
|
GIT_TAG v1.89.4
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(imgui)
|
FetchContent_MakeAvailable(imgui)
|
||||||
|
|
||||||
# Build ImGui as a static library
|
# Download and build rlImGui
|
||||||
add_library(ImGui STATIC
|
|
||||||
${imgui_SOURCE_DIR}/imgui.cpp
|
|
||||||
${imgui_SOURCE_DIR}/imgui_demo.cpp
|
|
||||||
${imgui_SOURCE_DIR}/imgui_draw.cpp
|
|
||||||
${imgui_SOURCE_DIR}/imgui_tables.cpp
|
|
||||||
${imgui_SOURCE_DIR}/imgui_widgets.cpp
|
|
||||||
)
|
|
||||||
target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR})
|
|
||||||
|
|
||||||
# Download and configure rlImGui (raylib backend for ImGui)
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
rlimgui
|
rlImGui
|
||||||
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
|
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
|
||||||
GIT_TAG main # Use the correct branch name
|
GIT_TAG main
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(rlimgui)
|
FetchContent_MakeAvailable(rlImGui)
|
||||||
|
|
||||||
# Add executable target with the source files
|
# Add rlImGui library
|
||||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
add_library(rlImGui STATIC
|
||||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
${rlImGui_SOURCE_DIR}/rlImGui.cpp
|
||||||
|
${rlImGui_SOURCE_DIR}/imgui_impl_raylib.cpp
|
||||||
# Link raylib to your project
|
|
||||||
target_link_libraries(${PROJECT_NAME} raylib)
|
|
||||||
|
|
||||||
# Add rlImGui to the project
|
|
||||||
set(RLIMGUI_SOURCES
|
|
||||||
${rlimgui_SOURCE_DIR}/rlImGui.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the rlImGui library
|
# Include directories for rlImGui
|
||||||
add_library(rlImGui STATIC ${RLIMGUI_SOURCES})
|
target_include_directories(rlImGui PRIVATE
|
||||||
target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_DIR})
|
${imgui_SOURCE_DIR}
|
||||||
target_link_libraries(rlImGui raylib ImGui)
|
${raylib_SOURCE_DIR}/src
|
||||||
|
${rlImGui_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
# Link ImGui and rlImGui to your project
|
# Link rlImGui with Raylib
|
||||||
target_link_libraries(${PROJECT_NAME} ImGui rlImGui)
|
target_link_libraries(rlImGui PRIVATE raylib)
|
||||||
|
|
||||||
|
# add source code
|
||||||
|
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp") # Define PROJECT_SOURCES as a list of all source files
|
||||||
|
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src")
|
||||||
|
|
||||||
|
# exe
|
||||||
|
add_executable(${PROJECT_NAME})
|
||||||
|
target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES})
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE raylib rlImGui)
|
||||||
|
|
||||||
|
# Web Configurations
|
||||||
|
if (${PLATFORM} STREQUAL "Web")
|
||||||
|
# Tell Emscripten to build an example.html file.
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(${PROJECT_NAME} "-framework IOKit")
|
||||||
|
target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
|
||||||
|
target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
|
||||||
|
endif()
|
||||||
|
15
src/main.cpp
15
src/main.cpp
@ -1,8 +1,5 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "rlImGui.h"
|
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "imgui.h"
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
const int screenWidth = 1920;
|
const int screenWidth = 1920;
|
||||||
@ -11,23 +8,19 @@ int main() {
|
|||||||
InitWindow(screenWidth, screenHeight, "DMX Raylib UI");
|
InitWindow(screenWidth, screenHeight, "DMX Raylib UI");
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
||||||
rlImGuiSetup(true); // Use true for dark theme, false for light theme
|
// Create the timeline and properties panels
|
||||||
|
|
||||||
Panel timelinePanel = {{0, 0, screenWidth * 0.75f, screenHeight * 0.6f}, "Timeline", LIGHTGRAY, DARKGRAY, true};
|
Panel timelinePanel = {{0, 0, screenWidth * 0.75f, screenHeight * 0.6f}, "Timeline", LIGHTGRAY, DARKGRAY, true};
|
||||||
Panel propertiesPanel = {{screenWidth * 0.75f, 0, screenWidth * 0.25f, screenHeight}, "Properties", LIGHTGRAY, DARKGRAY, true};
|
Panel propertiesPanel = {{screenWidth * 0.75f, 0, screenWidth * 0.25f, screenHeight}, "Properties", LIGHTGRAY, DARKGRAY, true};
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
|
// Update panels
|
||||||
timelinePanel.Update();
|
timelinePanel.Update();
|
||||||
propertiesPanel.Update();
|
propertiesPanel.Update();
|
||||||
|
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
rlImGuiBegin();
|
// Draw panels
|
||||||
bool open = true;
|
|
||||||
ImGui::ShowDemoWindow(&open);
|
|
||||||
rlImGuiEnd();
|
|
||||||
|
|
||||||
if (timelinePanel.isVisible) timelinePanel.Draw();
|
if (timelinePanel.isVisible) timelinePanel.Draw();
|
||||||
if (propertiesPanel.isVisible) propertiesPanel.Draw();
|
if (propertiesPanel.isVisible) propertiesPanel.Draw();
|
||||||
|
|
||||||
@ -35,8 +28,6 @@ int main() {
|
|||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
rlImGuiShutdown();
|
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user