initial commit

This commit is contained in:
MrLetsplay 2023-09-09 16:57:42 +02:00
commit 78b0343067
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
6 changed files with 108 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build/
.vscode/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "dependencies/kekengine"]
path = dependencies/kekengine
url = https://github.com/MrLetsplay2003/KekEngineV2.git

68
CMakeLists.txt Normal file
View File

@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.13)
project(Kekrooms VERSION 1.0)
option(KEKROOMS_DEBUG "Build with debug information" OFF)
if(UNIX)
set(KEKROOMS_TARGET_PLATFORM Linux)
endif()
if(WIN32)
set(KEKROOMS_TARGET_PLATFORM Windows)
endif()
message("Debug: ${KEKROOMS_DEBUG}")
message("Target platform: ${KEKROOMS_TARGET_PLATFORM}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(KEKROOMS_RESOURCE_DIR "${PROJECT_SOURCE_DIR}/src/kekrooms/res")
file(GLOB_RECURSE KEKROOMS_SOURCE_FILES "src/kekrooms/cpp/*.cpp")
file(GLOB_RECURSE KEKROOMS_RESOURCE_FILES "${KEKROOMS_RESOURCE_DIR}/*")
file(GLOB_RECURSE KEKROOMS_RELATIVE_RESOURCE_FILES RELATIVE ${KEKROOMS_RESOURCE_DIR} "${KEKROOMS_RESOURCE_DIR}/*")
if(${KEKROOMS_DEBUG})
add_compile_options(-Wall -g)
else()
add_compile_options(-Wall -O3)
endif()
add_subdirectory(dependencies/kekengine)
# kekrooms resources
add_custom_target(kekrooms_res ALL DEPENDS ${KEKENGINE_RESOURCE_FILES})
add_dependencies(kekrooms_res kekengine_static)
get_target_property(KEKENGINE_BINARY_DIR kekengine "RUNTIME_OUTPUT_DIRECTORY")
add_custom_command(TARGET kekrooms_res PRE_BUILD
BYPRODUCTS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMMAND ${CMAKE_COMMAND} -E
copy "${KEKENGINE_BINARY_DIR}/resources.tar" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar"
COMMAND ${CMAKE_COMMAND} -E
chdir ${KEKROOMS_RESOURCE_DIR}
tar rf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar ${KEKROOMS_RELATIVE_RESOURCE_FILES})
# kekrooms
add_executable(kekrooms ${KEKROOMS_SOURCE_FILES})
add_dependencies(kekrooms kekrooms_res)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FREETYPE REQUIRED freetype2)
target_include_directories(kekrooms PUBLIC ${FREETYPE_INCLUDE_DIRS})
pkg_check_modules(BULLET REQUIRED bullet)
target_include_directories(kekrooms PUBLIC ${BULLET_INCLUDE_DIRS})
if(WIN32)
target_link_options(kekrooms PUBLIC -static-libgcc -static-libstdc++ -static)
endif()
target_link_libraries(kekrooms PUBLIC kekengine_static)

1
dependencies/kekengine vendored Submodule

@ -0,0 +1 @@
Subproject commit 3d9dd14fd00d978c49ae591110756a4100f1b307

View File

@ -0,0 +1,34 @@
#include <kekengine.h>
#include <ui.h>
#include <iostream>
using namespace kek;
void buttonClicked(void *) {
std::cout << "Someone clicked me! :O" << std::endl;
}
int main() {
if(Engine::init() != KEK_SUCCESS) return 1;
Scene *scene = new Scene();
Engine::setActiveScene(scene);
ButtonElement *button = new ButtonElement(uiPx(10), uiPx(50), uiPx(300), uiPx(100));
//button->origin = Origin::BOTTOM_LEFT;
button->color = Colors::CYAN;
button->hoverColor = Colors::WHITE;
//button->text->origin = Origin::BOTTOM_LEFT;
button->text->color = Colors::RED;
button->text->setText("Click me pls uwu!");
button->onClick = Callable(buttonClicked, nullptr);
//TextElement *element = new TextElement(uiPx(10), uiSh(1) - uiPx(10));
//element->origin = Origin::BOTTOM_LEFT;
//element->setText("Hello World!");
UI::addElement(button);
if(Engine::start() != KEK_SUCCESS) return 1;
Engine::exit();
}

0
src/kekrooms/res/file Normal file
View File