handle custom platform

This commit is contained in:
Yan Pujante 2023-12-01 11:24:37 -08:00
commit 30ccc969de
2 changed files with 3514 additions and 10 deletions

View file

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.0)
# This should be absolute to where raylib lives
set(RAYLIB_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
if(PLATFORM STREQUAL "Custom")
# custom_platform_2 requires GLFW_ROOT_DIR to be set
set(GLFW_ROOT_DIR "${RAYLIB_ROOT_DIR}/src/external/glfw")
set(PLATFORM_CUSTOM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../custom_platforms/custom_platform_2")
endif()
project(example_for_custom_platform_2 LANGUAGES CXX)
set(target "example_for_custom_platform_2")
set(CMAKE_CXX_STANDARD 17)
#######################################################
# adding raylib
# Note: raylib is bundled in this project but could
# easily be fetched instead
#######################################################
add_subdirectory("${RAYLIB_ROOT_DIR}" raylib EXCLUDE_FROM_ALL)
#######################################################
# Main executable
#######################################################
add_executable(${target} main.cpp)
target_link_libraries(${target} PUBLIC raylib)

View file

@ -0,0 +1,28 @@
#include "raylib.h"
static char BUF[1024];
int main()
{
double width = 850;
double height = 450;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow((int) width, (int) height, "raylib custom platform 1 (web)");
SetTargetFPS(60);
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 10, 40, 20, LIGHTGRAY);
DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), RED);
DrawFPS(10, 70);
EndDrawing();
}
CloseWindow();
return 0;
}