Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gamedev/fggl
  • onuralpsezer/fggl
2 results
Show changes
Showing
with 868 additions and 65 deletions
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 04/09/22.
//
#ifndef FGGL_DEMO_INCLUDE_ROBOT_PROGRAMMER_HPP
#define FGGL_DEMO_INCLUDE_ROBOT_PROGRAMMER_HPP
#include <functional>
#include "fggl/gui/containers.hpp"
namespace demo::robot {
struct Instruction {
const char* name;
std::function<void(void)> m_func;
};
struct Program {
std::vector<Instruction> m_instructions;
uint32_t m_currInstruction;
bool playing = false;
inline std::size_t size() {
return m_instructions.size();
}
inline void step() {
m_instructions[ m_currInstruction ].m_func();
m_currInstruction++;
}
inline void stop() {
playing = false;
m_currInstruction = 0;
}
};
class Timeline : public fggl::gui::Panel {
public:
explicit Timeline(Program& program);
void update(float deltaTime) override;
void render(fggl::gfx::Paint& paint) override;
protected:
void renderInstructions(fggl::gfx::Paint& paint);
private:
std::vector<std::reference_wrapper<Program>> m_tracks;
};
}
#endif //FGGL_DEMO_INCLUDE_ROBOT_PROGRAMMER_HPP
......@@ -26,18 +26,46 @@
#define DEMO_ROLLBALL_HPP
#include "fggl/scenes/game.hpp"
#include "fggl/phys/service.hpp"
#include "fggl/script/engine.hpp"
namespace demo {
enum class DebugMode {
NORMAL = 0,
DISTANCE = 1,
VISION = 2
};
struct RollState {
fggl::entity::EntityID player = fggl::entity::INVALID;
fggl::entity::EntityID closestPickup;
DebugMode mode = DebugMode::NORMAL;
std::vector<fggl::entity::EntityID> collectables;
float time = 0.0f;
};
class RollBall : public fggl::scenes::Game {
public:
explicit RollBall(fggl::App& app);
void activate() override;
void deactivate() override;
void update() override;
void update(float dt) override;
void render(fggl::gfx::Graphics& gfx) override;
private:
constexpr static fggl::math::vec3 HINT_COLOUR{0.5f, 0.0f, 0.0f};
RollState state;
fggl::phys::PhysicsEngine* m_phys;
fggl::script::ScriptEngine* m_scripts;
fggl::math::vec3 cameraOffset = {-15.0F, 15.0F, 0.0F};
void closestPickup(fggl::entity::EntityManager& world);
void spinCubes(fggl::entity::EntityManager& world, float dt);
};
}
......
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 03/07/22.
//
#ifndef DEMO_TOPDOWN_HPP
#define DEMO_TOPDOWN_HPP
#include "fggl/scenes/game.hpp"
namespace demo {
class TopDown : public fggl::scenes::Game {
public:
explicit TopDown(fggl::App& app);
void activate() override;
void update(float dt) override;
void render(fggl::gfx::Graphics& gfx) override;
private:
constexpr static fggl::math::vec3 HINT_COLOUR{0.5f, 0.0f, 0.0f};
fggl::math::vec3 cameraOffset = {-15.0F, 15.0F, 0.0F};
void pick_object();
};
}
#endif //DEMO_TOPDOWN_HPP
......@@ -979,7 +979,7 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = "YAML" "glm" "dd"
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
......
# headers
file(GLOB_RECURSE HEADER_LIST CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/include/fggl/**.hpp")
# the fggl library itself
# Should be shared linkage for legal reasons (LGPL)
add_library(fggl ${HEADER_LIST})
target_link_libraries(fggl PUBLIC entt)
# we need to tell people using the library about our headers
target_include_directories(fggl
PUBLIC
......@@ -12,8 +14,8 @@ target_include_directories(fggl
$<INSTALL_INTERFACE:include>
)
# users of this library need at least C++17
target_compile_features(fggl PUBLIC cxx_std_17)
# users of this library need at least C++20
target_compile_features(fggl PUBLIC cxx_std_20)
# IDE support for nice header files
source_group(
......@@ -31,6 +33,14 @@ if (CLANG_TIDY_FOUND)
set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=*,-llvmlibc-*,-fuchsia-*,-cppcoreguidelines-*,-android-*,-llvm-*,-altera-*,-modernize-use-trailing-return-type)
endif ()
# the important stuff everything else uses
add_subdirectory(math)
add_subdirectory(util)
add_subdirectory(grid)
add_subdirectory(assets)
add_subdirectory(phys)
target_sources(${PROJECT_NAME}
PRIVATE
app.cpp
......@@ -38,11 +48,7 @@ target_sources(${PROJECT_NAME}
data/model.cpp
data/procedural.cpp
data/heightmap.cpp
ecs/ecs.cpp
ecs3/module/module.cpp
ecs3/fast/Container.cpp
ecs3/prototype/world.cpp
data/module.cpp
scenes/menu.cpp
scenes/game.cpp
......@@ -50,27 +56,35 @@ target_sources(${PROJECT_NAME}
input/input.cpp
input/mouse.cpp
input/camera_input.cpp
)
gui/widget.cpp
gui/widgets.cpp
gui/containers.cpp
gui/fonts.cpp
math/triangulation.cpp
math/shapes.cpp
)
# GUI support
add_subdirectory(gui)
# spdlog for cleaner logging
find_package(spdlog)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog)
# yaml-cpp for configs and storage
find_package(yaml-cpp)
target_link_libraries(fggl PUBLIC yaml-cpp)
find_package(freetype)
target_link_libraries(${PROJECT_NAME} PUBLIC freetype)
# model loading
add_subdirectory(data/assimp)
# Graphics backend
add_subdirectory(gfx)
add_subdirectory(audio)
# physics integration
# Debug backend
add_subdirectory(debug)
# platform integrations
add_subdirectory(platform)
add_subdirectory(entity)
##
# begin windows support
##
if (MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC "/ZI")
target_link_options(${PROJECT_NAME} PUBLIC "/INCREMENTAL")
endif ()
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
// the configured options and settings for Tutorial
#define FGGL_VERSION_MAJOR @FGGL_VERSION_MAJOR@
#define FGGL_VERSION_MINOR @FGGL_VERSION_MINOR@
This diff is collapsed.
target_sources(fggl PRIVATE
module.cpp
types.cpp
packed/module.cpp
)
\ No newline at end of file
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 20/08/22.
//
#include "fggl/assets/module.hpp"
namespace fggl::assets {
auto AssetFolders::factory(modules::ServiceName service, modules::Services &services) -> bool {
if (service == Loader::service) {
auto *storage = services.get<data::Storage>();
auto *checkin = services.get<CheckinAdapted>();
services.create<Loader>(storage, checkin);
return true;
}
if (service == AssetManager::service) {
services.create<AssetManager>();
return true;
}
return false;
}
} // namespace fggl::assets
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
target_sources(fggl
PRIVATE
types.cpp
)
add_subdirectory(openal)
add_subdirectory(fallback)
\ No newline at end of file
target_sources(fggl
PRIVATE
audio.cpp
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.