Restructured the ogfx module
This commit is contained in:
parent
01a77d722d
commit
6f1899b1a6
29 changed files with 301 additions and 155 deletions
|
|
@ -79,14 +79,21 @@ list(APPEND OSTD_SOURCE_FILES
|
|||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/Time.cpp
|
||||
)
|
||||
list(APPEND OGFX_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/FontUtils.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/WindowBase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/BasicRenderer.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/RawTextInput.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/Image.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/WindowBaseOutputHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/PixelRenderer.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/Animation.cpp
|
||||
# gui
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/gui/RawTextInput.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/gui/WindowBase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/gui/WindowBaseOutputHandler.cpp
|
||||
|
||||
# render
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/render/BasicRenderer.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/render/FontUtils.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/render/PixelRenderer.cpp
|
||||
|
||||
# resources
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/resources/Image.cpp
|
||||
|
||||
# utils
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/utils/Animation.cpp
|
||||
)
|
||||
list(APPEND TEST_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/test.cpp
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 251 KiB |
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
2031
|
||||
2034
|
||||
|
|
|
|||
|
|
@ -42,16 +42,23 @@ mkdir -p $RELEASE_DIR/include/ostd/io
|
|||
mkdir -p $RELEASE_DIR/include/ostd/math
|
||||
mkdir -p $RELEASE_DIR/include/ostd/string
|
||||
mkdir -p $RELEASE_DIR/include/ostd/utils
|
||||
mkdir -p $RELEASE_DIR/include/ogfx/
|
||||
mkdir -p $RELEASE_DIR/include/ogfx/gui
|
||||
mkdir -p $RELEASE_DIR/include/ogfx/render
|
||||
mkdir -p $RELEASE_DIR/include/ogfx/resources
|
||||
mkdir -p $RELEASE_DIR/include/ogfx/utils
|
||||
find ../src/ostd -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd \;
|
||||
find ../src/ostd/data -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/data \;
|
||||
find ../src/ostd/io -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/io \;
|
||||
find ../src/ostd/math -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/math \;
|
||||
find ../src/ostd/string -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/string \;
|
||||
find ../src/ostd/utils -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/utils \;
|
||||
find ../src/ogfx -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ogfx \;
|
||||
find ../src/ostd/vendor -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/vendor \;
|
||||
find ../src/ostd/vendor/midifile -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/vendor/midifile \;
|
||||
find ../src/ogfx -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ogfx \;
|
||||
find ../src/ogfx/gui -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ogfx/gui \;
|
||||
find ../src/ogfx/render -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ogfx/render \;
|
||||
find ../src/ogfx/resources -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ogfx/resources \;
|
||||
find ../src/ogfx/utils -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ogfx/utils \;
|
||||
cp -r ../src/ostd/vendor/nlohmann $RELEASE_DIR/include/ostd/vendor/
|
||||
cp -r ../licences $RELEASE_DIR
|
||||
cp ../LICENSE $RELEASE_DIR/licences/OmniaFramework-LICENCE.txt
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
#include "Image.hpp"
|
||||
#include "io/Logger.hpp"
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include <ogfx/BasicRenderer.hpp>
|
||||
#include <ogfx/WindowBase.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
void Image::destroy(void)
|
||||
{
|
||||
SDL_DestroyTexture(m_sdl_texture);
|
||||
m_loaded = false;
|
||||
m_sdl_texture = nullptr;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
}
|
||||
|
||||
Image& Image::loadFromFile(const ostd::String& filePath, BasicRenderer2D& gfx)
|
||||
{
|
||||
if (!gfx.isInitialized())
|
||||
return *this; //TODO: Error
|
||||
m_sdl_texture = IMG_LoadTexture(gfx.getWindow().getSDLRenderer(), filePath.c_str());
|
||||
if (!m_sdl_texture)
|
||||
{
|
||||
OX_ERROR("Failed to load Image: %s", IMG_GetError());
|
||||
return *this;
|
||||
}
|
||||
SDL_QueryTexture(m_sdl_texture, nullptr, nullptr, &m_width, &m_height);
|
||||
m_loaded = true;
|
||||
setTypeName("ogfx::Image");
|
||||
validate();
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,26 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "RawTextInput.hpp"
|
||||
#include <ogfx/WindowBase.hpp>
|
||||
#include <ostd/io/Logger.hpp>
|
||||
#include "../gui/WindowBase.hpp"
|
||||
#include "../../io/Logger.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ogfx/BasicRenderer.hpp>
|
||||
#include <ogfx/render/BasicRenderer.hpp>
|
||||
#include <ostd/utils/Time.hpp>
|
||||
|
||||
namespace ogfx
|
||||
|
|
@ -1,7 +1,25 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WindowBase.hpp"
|
||||
#include "../ostd/utils/Time.hpp"
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL2/SDL_surface.h>
|
||||
#include "../../ostd/utils/Time.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -12,7 +30,7 @@ namespace ogfx
|
|||
SDL_FreeCursor(m_cursor_Arrow);
|
||||
SDL_DestroyRenderer(m_renderer);
|
||||
SDL_DestroyWindow(m_window);
|
||||
// IMG_Quit();
|
||||
IMG_Quit();
|
||||
SDL_Quit();
|
||||
TTF_Quit();
|
||||
}
|
||||
|
|
@ -20,8 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL_surface.h>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ogfx/utils/SDLInclude.hpp>
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
#include <ostd/utils/Time.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
|
|
@ -1,6 +1,26 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WindowBaseOutputHandler.hpp"
|
||||
#include "BasicRenderer.hpp"
|
||||
#include "../string/TextStyleParser.hpp"
|
||||
#include "../render/BasicRenderer.hpp"
|
||||
#include "../../string/TextStyleParser.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/string/TextStyleParser.hpp>
|
||||
#include <ogfx/BasicRenderer.hpp>
|
||||
#include <ogfx/render/BasicRenderer.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
35
src/ogfx/ogfx.hpp
Normal file
35
src/ogfx/ogfx.hpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/ostd.hpp>
|
||||
|
||||
#include <ogfx/gui/RawTextInput.hpp>
|
||||
#include <ogfx/gui/WindowBase.hpp>
|
||||
#include <ogfx/gui/WindowBaseOutputHandler.hpp>
|
||||
|
||||
#include <ogfx/render/BasicRenderer.hpp>
|
||||
#include <ogfx/render/PixelRenderer.hpp>
|
||||
|
||||
#include <ogfx/resources/Image.hpp>
|
||||
|
||||
#include <ogfx/utils/Animation.hpp>
|
||||
#include <ogfx/utils/SDLInclude.hpp>
|
||||
|
|
@ -1,6 +1,25 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BasicRenderer.hpp"
|
||||
#include "WindowBase.hpp"
|
||||
#include <SDL2/SDL_rect.h>
|
||||
#include "../gui/WindowBase.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Animation.hpp"
|
||||
#include <ogfx/FontUtils.hpp>
|
||||
#include <ogfx/render/FontUtils.hpp>
|
||||
#include <ogfx/utils/Animation.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ogfx/Image.hpp>
|
||||
#include <ogfx/resources/Image.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "FontUtils.hpp"
|
||||
|
||||
namespace ogfx
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ogfx/utils/SDLInclude.hpp>
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
|
||||
|
|
@ -1,6 +1,26 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PixelRenderer.hpp"
|
||||
#include "WindowBase.hpp"
|
||||
#include "../ostd/io/Memory.hpp"
|
||||
#include "../gui/WindowBase.hpp"
|
||||
#include "../../ostd/io/Memory.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/data/Color.hpp>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ogfx/utils/SDLInclude.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ogfx
|
||||
53
src/ogfx/resources/Image.cpp
Normal file
53
src/ogfx/resources/Image.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Image.hpp"
|
||||
#include "../../io/Logger.hpp"
|
||||
#include "../render/BasicRenderer.hpp"
|
||||
#include "../gui/WindowBase.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
void Image::destroy(void)
|
||||
{
|
||||
SDL_DestroyTexture(m_sdl_texture);
|
||||
m_loaded = false;
|
||||
m_sdl_texture = nullptr;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
}
|
||||
|
||||
Image& Image::loadFromFile(const ostd::String& filePath, BasicRenderer2D& gfx)
|
||||
{
|
||||
if (!gfx.isInitialized())
|
||||
return *this; //TODO: Error
|
||||
m_sdl_texture = IMG_LoadTexture(gfx.getWindow().getSDLRenderer(), filePath.c_str());
|
||||
if (!m_sdl_texture)
|
||||
{
|
||||
OX_ERROR("Failed to load Image: %s", IMG_GetError());
|
||||
return *this;
|
||||
}
|
||||
SDL_QueryTexture(m_sdl_texture, nullptr, nullptr, &m_width, &m_height);
|
||||
m_loaded = true;
|
||||
setTypeName("ogfx::Image");
|
||||
validate();
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ogfx/utils/SDLInclude.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
|
||||
namespace ogfx
|
||||
|
|
@ -1,5 +1,25 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Animation.hpp"
|
||||
#include <ostd/math/Random.hpp>
|
||||
#include "../../ostd/math/Random.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -1,8 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ogfx/Image.hpp>
|
||||
#include <ogfx/resources/Image.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -29,3 +29,6 @@
|
|||
#include <SDL2/SDL2_gfxPrimitives.h>
|
||||
#include <SDL2/SDL_ttf.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL2/SDL_surface.h>
|
||||
#include <SDL2/SDL_rect.h>
|
||||
#include <SDL2/SDL_render.h>
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostd/utils/Defines.hpp>
|
||||
|
||||
#define get_bit(__bit_field, __bit_n ) __bit_field.bits.b##__bit_n
|
||||
#define set_bit(__bit_field, __bit_n ) __bit_field.bits.b##__bit_n = true
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <ostd/utils/Defines.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <optional>
|
||||
#include <ostd/utils/Defines.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <unordered_map>
|
||||
#include <deque>
|
||||
#include <cstdint>
|
||||
#include <ostd/utils/Defines.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
|
|||
87
src/test.cpp
87
src/test.cpp
|
|
@ -18,16 +18,7 @@
|
|||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// #include <ostd/String.hpp>
|
||||
// #include <ostd/IOHandlers.hpp>
|
||||
// #include <ostd/Logger.hpp>
|
||||
// #include <ostd/Console.hpp>
|
||||
|
||||
#include "Image.hpp"
|
||||
#include "utils/Hash.hpp"
|
||||
#include <ogfx/WindowBase.hpp>
|
||||
#include <ogfx/RawTextInput.hpp>
|
||||
#include <ostd/ostd.hpp>
|
||||
#include <ogfx/ogfx.hpp>
|
||||
|
||||
ostd::ConsoleOutputHandler out;
|
||||
|
||||
|
|
@ -50,10 +41,6 @@ class Window : public ogfx::WindowBase
|
|||
m_textInput.setEventListener(m_sigHandler);
|
||||
// m_textInput.setCharacterFilter(m_numCharFilter);
|
||||
m_textInput.getTheme().extraPaddingTop = 3;
|
||||
|
||||
m_testImg.loadFromFile("res/test.png", m_gfx);
|
||||
out.p("Image loaded: ").p(STR_BOOL(m_testImg.isLoaded())).nl();
|
||||
out.p(" ").p(m_testImg.getSize().x).nl();
|
||||
}
|
||||
|
||||
inline void handleSignal(ostd::tSignal& signal) override
|
||||
|
|
@ -85,7 +72,6 @@ class Window : public ogfx::WindowBase
|
|||
inline void onRender(void) override
|
||||
{
|
||||
m_textInput.render(m_gfx);
|
||||
// m_gfx.drawImage(m_testImg, { 0, 0 });´
|
||||
}
|
||||
|
||||
inline void onFixedUpdate(double frameTime_s) override
|
||||
|
|
@ -103,20 +89,10 @@ class Window : public ogfx::WindowBase
|
|||
ogfx::BasicRenderer2D m_gfx;
|
||||
ogfx::gui::RawTextInputEventListener m_sigHandler;
|
||||
ogfx::gui::RawTextInputNumberCharacterFilter m_numCharFilter;
|
||||
|
||||
ogfx::Image m_testImg;
|
||||
};
|
||||
|
||||
// void test2(const std::string& str) {}
|
||||
// void test3(const ostd::String& str) {}
|
||||
// void test4(const char* str) {}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
out.p(STR_BOOL(ostd::Hash::md5("") == "d41d8cd98f00b204e9800998ecf8427e")).nl();
|
||||
out.p(STR_BOOL(ostd::Hash::md5("abc") == "900150983cd24fb0d6963f7d28e17f72")).nl();
|
||||
out.p(STR_BOOL(ostd::Hash::md5("message digest") == "f96b697d7cb7938d525a2f31aaf161d0")).nl();
|
||||
|
||||
Window window;
|
||||
window.initialize(1280, 720, "OmniaFramework - Test Window");
|
||||
window.setClearColor({ 0, 2 , 15 });
|
||||
|
|
@ -125,66 +101,5 @@ int main(int argc, char** argv)
|
|||
{
|
||||
window.update();
|
||||
}
|
||||
|
||||
|
||||
// out.fg(ostd::ConsoleColors::Red).p("Hello World!!").reset().nl();
|
||||
|
||||
// ostd::String str1, str2 = "Hello";
|
||||
// bool b = str1 == str2;
|
||||
// const ostd::String str3 = "CIAO";
|
||||
// b = str2 == str1;
|
||||
// b = str3 == "CICCIO";
|
||||
// // b = "ciao" == str2;
|
||||
// str2 = str3;
|
||||
// std::string str = "cc";
|
||||
// str1 = str;
|
||||
// test2(str1);
|
||||
// test3(str);
|
||||
// str1 = str2 + str;
|
||||
// str1 = str2 + "str";
|
||||
// str1 = str2 + str3;
|
||||
// str1 = str2 + str1;
|
||||
// test4(str1);
|
||||
// test4(str3);
|
||||
|
||||
// str1 += "ciao";
|
||||
// str1 += str;
|
||||
// str1 += str1;
|
||||
// str1 += str3;
|
||||
// str1 += 'c';
|
||||
|
||||
// OX_FATAL(str2);
|
||||
|
||||
// ostd::RegexRichString rgxrstr("Hello World");
|
||||
// rgxrstr.fg("Hello", "Blue");
|
||||
// std::cout << rgxrstr << "\n";
|
||||
|
||||
// out.nl().nl();
|
||||
// ostd::String test_str = "Hello World, my love";
|
||||
// ostd::String test_str_2 = "HEELO";
|
||||
// ostd::String test_str_3 = "0123456789";
|
||||
// out.p("==========\n");
|
||||
// test_str.fixedLength(10, ' ', "..........");
|
||||
// test_str_2.fixedLength(10);
|
||||
// test_str_3.fixedLength(10);
|
||||
// out.p(test_str).p("|").nl();
|
||||
// out.p(test_str_2).p("|").nl();
|
||||
// out.p(test_str_3).p("|").nl();
|
||||
|
||||
// ostd::KeyboardController keyboard;
|
||||
// keyboard.disableCommandBuffer();
|
||||
|
||||
// out.p("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n");
|
||||
// out.p("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH");
|
||||
// out.p("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
||||
// out.p(" ");
|
||||
// out.p("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
||||
|
||||
// ostd::eKeys k = ostd::eKeys::NoKeyPressed;
|
||||
// do
|
||||
// {
|
||||
// k = keyboard.waitForKeyPress();
|
||||
// } while (k != ostd::eKeys::Escape);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue