g
This commit is contained in:
parent
90ac688f3d
commit
42764b5dd6
4 changed files with 175 additions and 81 deletions
|
@ -127,7 +127,7 @@ source_group(TREE ${PROJECT_SOURCE_DIR}/src/ PREFIX "Source" FILES ${SVA_GUI_FIL
|
|||
# RAYLIB
|
||||
# ---------------
|
||||
# Dependencies
|
||||
set(RAYLIB_VERSION 5.0)
|
||||
set(RAYLIB_VERSION 5.5)
|
||||
find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED
|
||||
|
||||
if (NOT raylib_FOUND) # If there's none, fetch and build raylib
|
||||
|
@ -145,7 +145,22 @@ if (NOT raylib_FOUND) # If there's none, fetch and build raylib
|
|||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(${GUI_TARGET_NAME} PRIVATE raylib)
|
||||
# raylib-cpp
|
||||
find_package(raylib_cpp QUIET)
|
||||
if (NOT raylib_cpp_FOUND)
|
||||
if (NOT DEFINED RAYLIB_CPP_VERSION)
|
||||
set(RAYLIB_CPP_VERSION next)
|
||||
endif()
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
raylib_cpp
|
||||
GIT_REPOSITORY https://github.com/RobLoach/raylib-cpp.git
|
||||
GIT_TAG ${RAYLIB_CPP_VERSION}
|
||||
)
|
||||
FetchContent_MakeAvailable(raylib_cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${GUI_TARGET_NAME} PRIVATE raylib raylib_cpp)
|
||||
|
||||
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
||||
if (APPLE)
|
||||
|
@ -161,7 +176,7 @@ set_common_properties(${GUI_TARGET_NAME})
|
|||
put_targets_into_folder(
|
||||
FOLDER "ThirdParty/raylib"
|
||||
TARGETS
|
||||
raylib uninstall
|
||||
raylib raylib_cpp uninstall
|
||||
)
|
||||
|
||||
put_targets_into_folder(
|
||||
|
|
80
include/raylibs/raylib-cpp.hpp
Normal file
80
include/raylibs/raylib-cpp.hpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* [raylib-cpp](https://github.com/RobLoach/raylib-cpp) is a C++ wrapper library for raylib, a simple and easy-to-use library to enjoy videogames programming. This C++ header provides object-oriented wrappers around raylib's struct interfaces.
|
||||
*
|
||||
* @see raylib namespace for a list of all available classes.
|
||||
* @mainpage raylib-cpp
|
||||
* @include core_basic_window.cpp
|
||||
* @author Rob Loach (RobLoach)
|
||||
* @copyright zlib/libpng
|
||||
*
|
||||
* raylib-cpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
* BSD-like license that allows static linking with closed source software:
|
||||
*
|
||||
* Copyright 2020 Rob Loach (RobLoach)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef RAYLIB_CPP_INCLUDE_RAYLIB_CPP_HPP_
|
||||
#define RAYLIB_CPP_INCLUDE_RAYLIB_CPP_HPP_
|
||||
|
||||
#include "./AudioDevice.hpp"
|
||||
#include "./AudioStream.hpp"
|
||||
#include "./AutomationEventList.hpp"
|
||||
#include "./BoundingBox.hpp"
|
||||
#include "./Camera2D.hpp"
|
||||
#include "./Camera3D.hpp"
|
||||
#include "./Color.hpp"
|
||||
#include "./FileData.hpp"
|
||||
#include "./FileText.hpp"
|
||||
#include "./Font.hpp"
|
||||
#include "./Functions.hpp"
|
||||
#include "./Gamepad.hpp"
|
||||
#include "./Image.hpp"
|
||||
#include "./Keyboard.hpp"
|
||||
#include "./Material.hpp"
|
||||
#include "./Matrix.hpp"
|
||||
#include "./Mesh.hpp"
|
||||
#include "./Model.hpp"
|
||||
#include "./ModelAnimation.hpp"
|
||||
#include "./Mouse.hpp"
|
||||
#include "./Music.hpp"
|
||||
#include "./Ray.hpp"
|
||||
#include "./RayCollision.hpp"
|
||||
#include "./RaylibException.hpp"
|
||||
#include "./Rectangle.hpp"
|
||||
#include "./RenderTexture.hpp"
|
||||
#include "./Shader.hpp"
|
||||
#include "./Sound.hpp"
|
||||
#include "./Text.hpp"
|
||||
#include "./Texture.hpp"
|
||||
#include "./TextureUnmanaged.hpp"
|
||||
#include "./Touch.hpp"
|
||||
#include "./Vector2.hpp"
|
||||
#include "./Vector3.hpp"
|
||||
#include "./Vector4.hpp"
|
||||
#include "./VrStereoConfig.hpp"
|
||||
#include "./Wave.hpp"
|
||||
#include "./Window.hpp"
|
||||
|
||||
/**
|
||||
* All raylib-cpp classes and functions appear in the raylib namespace.
|
||||
*/
|
||||
namespace raylib {
|
||||
// Nothing.
|
||||
} // namespace raylib
|
||||
|
||||
#endif // RAYLIB_CPP_INCLUDE_RAYLIB_CPP_HPP_
|
|
@ -3,16 +3,10 @@
|
|||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
|
||||
#define RL_COLOR(COLOR) rl::##COLOR
|
||||
|
||||
namespace rl {
|
||||
#include <raylib.h>
|
||||
}
|
||||
|
||||
Sortiva::Sortiva()
|
||||
Sortiva::Sortiva() : wnd(1280, 720, "Sortiva", rl::FLAG_WINDOW_RESIZABLE | rl::FLAG_WINDOW_TRANSPARENT)
|
||||
{
|
||||
rl::InitWindow(1280, 720, "Sortiva");
|
||||
if (!rl::IsWindowReady())
|
||||
if (!wnd.IsWindowReady())
|
||||
{
|
||||
printf("Window could not be initialized\n");
|
||||
exit(-1);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
#include <raylib-cpp.hpp>
|
||||
|
||||
namespace rl = raylib;
|
||||
|
||||
class Sortiva final
|
||||
{
|
||||
|
@ -10,6 +14,7 @@ public:
|
|||
|
||||
void run();
|
||||
private:
|
||||
rl::Window wnd;
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
bool m_Running;
|
||||
|
|
Loading…
Reference in a new issue