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 1124 additions and 362 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 27/08/22.
//
#ifndef FGGL_DEMO_INCLUDE_GRID_HPP
#define FGGL_DEMO_INCLUDE_GRID_HPP
#include <memory>
#include "fggl/scenes/game.hpp"
#include "fggl/entity/gridworld/zone.hpp"
#include "fggl/animation/animator.hpp"
#include "fggl/gui/gui.hpp"
#include "robot/programmer.hpp"
namespace demo {
constexpr int GRID_SIZE = 255;
using DemoGrid = fggl::entity::grid::Area2D<GRID_SIZE, GRID_SIZE>;
struct LevelRules {
fggl::math::vec2i startingPos;
uint32_t startingDirection;
uint32_t startingPower;
};
struct CellPos {
fggl::math::vec2i pos;
uint8_t direction;
fggl::math::vec2f drawOffset{0.0F, 0.0F};
float rotationOffset{0.0F};
};
struct RobotState {
uint32_t power = 64;
};
class GridScene : public fggl::scenes::GameBase {
public:
explicit GridScene(fggl::App& app);
void activate() override;
void deactivate() override;
void update(float dt) override;
void render(fggl::gfx::Graphics& gfx) override;
private:
// level
LevelRules m_levelRules;
fggl::entity::grid::TileSet m_tiles;
std::unique_ptr<DemoGrid> m_grid;
// control
fggl::entity::EntityID m_player = fggl::entity::INVALID;
robot::Program m_program;
// UI
fggl::gui::Container m_canvas;
fggl::animation::FrameAnimator m_animator;
void resetPuzzle();
void tickPlayer();
void checkVictory();
inline void forward() {
auto& cell = m_grid->entities().get<CellPos>(m_player);
fggl::math::vec2i moveDir{0,0};
if ( cell.direction == 0) {
moveDir.y = 1;
} else if (cell.direction == 1) {
moveDir.x = 1;
} else if (cell.direction == 2) {
moveDir.y = -1;
} else if (cell.direction == 3) {
moveDir.x = -1;
}
if ( m_grid->canMove(cell.pos, moveDir) ) {
cell.pos += moveDir;
}
}
inline void rotate(bool clockwise) {
auto& cell = m_grid->entities().get<CellPos>(m_player);
int direction = clockwise ? +1 : -1;
cell.direction = (cell.direction + 4 + direction) % 4;
}
};
}
#endif //FGGL_DEMO_INCLUDE_GRID_HPP
/*
* 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 10/12/22.
//
#ifndef FGGL_DEMO_INCLUDE_HEXBOARD_BOARD_HPP
#define FGGL_DEMO_INCLUDE_HEXBOARD_BOARD_HPP
#include <cstdint>
namespace demo::hexboard {
constexpr uint64_t NO_SELECTION{0};
struct SelectionModel {
uint64_t m_hover = NO_SELECTION;
};
} // namespace demo::hexboard
#endif //FGGL_DEMO_INCLUDE_HEXBOARD_BOARD_HPP
/*
* 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 02/01/23.
//
#ifndef FGGL_DEMO_INCLUDE_HEXBOARD_CAMERA_HPP
#define FGGL_DEMO_INCLUDE_HEXBOARD_CAMERA_HPP
#include "fggl/math/types.hpp"
namespace demo::hexboard {
constexpr float TRAUMA_DECAY = 0.01F;
constexpr float TRAUMA_LARGE = 0.5F;
constexpr float TRAUMA_SMALL = 0.1F;
constexpr float SPEED_SLOW = 0.01F;
constexpr float SPEED_MEDIUM = 0.1F;
constexpr float SPEED_FAST = 0.5F;
constexpr fggl::math::vec2 ndc_to_screen(fggl::math::vec2 ndcPos, fggl::math::vec2 screenSize) {
return fggl::math::vec2(
fggl::math::rescale_ndc(ndcPos.x, 0, screenSize.x),
fggl::math::rescale_ndc(ndcPos.y, 0, screenSize.y)
);
}
/**
* A 2D 'juiced' camera for grid worlds.
*
* This camera is based on HexBoard, and the GDC talk around this concept. Many of the ideas implemented here
* come from that source.
*
* @see https://www.youtube.com/watch?v=tu-Qe66AvtY
*/
class Camera2D {
public:
using Point = fggl::math::vec2;
/**
* Apply active camera effects.
*
* This method must be called once per frame of the camera's visual effects are to be animated.
*
* @param delta the amount of time that has passed
*/
void update(float delta);
inline fggl::math::vec2 unproject(fggl::math::vec2 screenPos) const {
auto location = screenPos;
location.x += 1920/2.0F;
location.y += 1080/2.0F;
return location + m_location;
// return screenPos + m_location;
}
inline fggl::math::vec2 project(fggl::math::vec2 worldPos) const {
return worldPos - m_location;
}
/**
* Move the camera to a new location.
*
* This will apply any movement effects the camera has applied to it. As a result movement to the location
* will not be instantaneous.
*
* @param newTarget the new target location
*/
inline void moveTo(Point newTarget) {
m_target = newTarget;
}
/**
* Move the camera by a defined amount.
*
* This will apply any movement effects the camera has applied to it. As a result movement to the location
* will not be instantaneous.
*
* @param delta the amount to add to the target, negative values will subject from the target location
*/
inline void moveBy(Point delta) {
m_target += delta;
}
/**
* Instantaneously move the camera to a new location.
*
* @param the new camera location
*/
inline void teleportTo(Point newTarget) {
m_location = newTarget;
m_target = newTarget;
}
/**
* Instantaneously adjust the camera location.
*
* @param delta the amount to adjust the camera location by
*/
inline void teleportBy(Point delta) {
m_location += delta;
m_target = m_location;
}
/**
* Get the current view offset of this camera.
*
* @return the current location this camera is pointing at
*/
inline Point getFocusLocation() const {
auto offset = m_location;
offset.x += 1920/2.0F;
offset.y += 1080/2.0F;
return -offset;
}
private:
Point m_location;
Point m_target;
float m_trauma;
float m_scale = SPEED_MEDIUM;
};
}
#endif //FGGL_DEMO_INCLUDE_HEXBOARD_CAMERA_HPP
/*
* 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 10/12/22.
//
#ifndef FGGL_DEMO_INCLUDE_HEXBOARD_SCENE_H
#define FGGL_DEMO_INCLUDE_HEXBOARD_SCENE_H
#include <memory>
#include <optional>
#include "fggl/scenes/game.hpp"
#include "fggl/grid/hexgrid.hpp"
#include "fggl/grid/layout.hpp"
#include "camera.hpp"
namespace demo::hexboard {
struct SelectionModel {
std::optional<fggl::grid::IntHex> selected;
std::optional<fggl::grid::IntHex> hover;
};
class Scene : public fggl::scenes::GameBase {
public:
explicit Scene(fggl::App& app);
void activate() override;
void deactivate() override;
void update(float delta) override;
void render(fggl::gfx::Graphics& gfx) override;
private:
std::unique_ptr<fggl::grid::HexGrid> m_board;
std::unique_ptr<fggl::grid::Layout> m_layout;
std::unique_ptr<SelectionModel> m_selections;
std::unique_ptr<Camera2D> m_camera;
fggl::math::vec2 m_screen;
std::optional<fggl::math::vec2> m_dragging;
void drawGrid(fggl::gfx::Paint&);
void drawSelections(fggl::gfx::Paint&);
};
} // namespace demo::hexboard
#endif //FGGL_DEMO_INCLUDE_HEXBOARD_SCENE_H
/*
* 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 18/10/22.
//
#ifndef FGGL_DEMO_INCLUDE_MODELS_VIEWER_HPP
#define FGGL_DEMO_INCLUDE_MODELS_VIEWER_HPP
#include "fggl/scenes/game.hpp"
#include "fggl/assets/types.hpp"
namespace demo {
class Viewer : public fggl::scenes::Game {
public:
explicit Viewer(fggl::App& app);
void activate() override;
void deactivate() override;
void update(float dt) override;
void render(fggl::gfx::Graphics& gfx) override;
private:
fggl::entity::EntityID m_model = fggl::entity::INVALID;
std::vector< fggl::assets::AssetID> m_assets;
uint64_t m_lastAsset = 0;
bool m_debug = false;
void cycleAsset(uint64_t asset);
};
}
#endif //FGGL_DEMO_INCLUDE_MODELS_VIEWER_HPP
/*
* 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
/*
* ${license.title}
* Copyright (C) 2022 ${license.owner}
* ${license.mailto}
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//
// Created by webpigeon on 23/04/22.
//
#ifndef DEMO_ROLLBALL_HPP
#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(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);
};
}
#endif //DEMO_ROLLBALL_HPP
/*
* 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
This diff is collapsed.
set(DOXYGEN_EXTRACT_ALL YES)
set(DOXYGEN_BUILDIN_STL_SUPPORT YES)
doxygen_add_docs(docs
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/include"
)
......@@ -158,7 +158,7 @@ INLINE_INHERITED_MEMB = NO
# shortest path that makes the file name unique will be used
# The default value is: YES.
FULL_PATH_NAMES = YES
FULL_PATH_NAMES = NO
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
# Stripping is only done if one of the specified strings matches the left-hand
......@@ -195,7 +195,7 @@ SHORT_NAMES = NO
# description.)
# The default value is: NO.
JAVADOC_AUTOBRIEF = NO
JAVADOC_AUTOBRIEF = YES
# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
# such as
......@@ -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
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# 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(
TREE "${PROJECT_SOURCE_DIR}/include"
PREFIX "Header Files"
FILES ${HEADER_LIST}
)
# Generation of configuration header
configure_file(FgglConfig.h.in FgglConfig.h)
set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=*,-llvmlibc-*,-fuchsia-*,-cppcoreguidelines-*,-llvm-*)
add_library(fggl fggl.cpp
ecs/ecs.cpp
data/model.cpp
data/procedural.cpp
ecs3/fast/Container.cpp
ecs3/prototype/world.cpp
scenes/Scene.cpp
ecs3/module/module.cpp
input/camera_input.cpp
# clang tidy
find_program(CLANG_TIDY_FOUND clang-tidy)
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
data/model.cpp
data/procedural.cpp
data/heightmap.cpp
data/module.cpp
scenes/menu.cpp
scenes/game.cpp
input/input.cpp
input/mouse.cpp
input/camera_input.cpp
)
target_include_directories(fggl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
# GUI support
add_subdirectory(gui)
# yaml-cpp for configs and storage
find_package(yaml-cpp)
target_link_libraries(fggl PUBLIC yaml-cpp)
# model loading
add_subdirectory(data/assimp)
# Graphics backend
add_subdirectory(gfx)
target_link_libraries(fggl glfw)
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 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/>.
*/
#include <cstdlib>
#include <spdlog/spdlog.h>
#include <fggl/app.hpp>
namespace fggl {
App::App(modules::Manager *services, const Identifer &name) : App::App(services, name, name) {
}
App::App(modules::Manager *services, const Identifer & /*name*/, const Identifer & /*folder*/ ) :
m_running(true),
m_window(nullptr),
m_states(),
m_subsystems(services) {}
auto App::run(int /*argc*/, const char **/*argv*/) -> int {
auto *windowing = m_subsystems->get<display::WindowService>();
{
// activate the first state
auto &state = m_states.active();
m_expectedScene = m_states.activeID();
state.activate();
}
auto lastTime = glfwGetTime();
while (m_running) {
auto currTime = glfwGetTime();
auto delta = currTime - lastTime;
lastTime = currTime;
// trigger a state change if expected
if (m_expectedScene != m_states.activeID()) {
auto result = m_states.change(m_expectedScene);
if (!result) {
m_expectedScene = m_states.activeID();
}
}
// process window events
if (windowing != nullptr) {
windowing->pollEvents();
}
//m_modules->onUpdate();
auto &state = m_states.active();
state.update((float)delta);
// window rendering to frame buffer
if (m_window != nullptr) {
// m_modules->onFrameStart();
m_window->frameStart();
// get draw instructions
auto &graphics = m_window->graphics();
state.render(graphics);
m_window->frameEnd();
// m_modules->onFrameEnd();
m_running = m_running && !m_window->wantClose();
}
}
{
// shutdown last state
auto &state = m_states.active();
state.deactivate();
}
return EXIT_SUCCESS;
}
} //namespace fggl
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 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/packed/module.hpp"
namespace fggl::assets {
auto PackedAssets::factory(modules::ServiceName service, modules::Services &services) -> bool {
if (service == RawCheckin::service) {
services.create<RawCheckin>();
return true;
}
if (service == CheckinAdapted::service) {
auto* storage = services.get<data::Storage>();
auto* rawCheckin = services.get<RawCheckin>();
services.create<CheckinAdapted>(storage, rawCheckin);
return true;
}
return false;
}
} // namespace fggl::assets
\ No newline at end of file
File moved
This diff is collapsed.
This diff is collapsed.