Add unit testing version of olcPGEX_Gamepad. Revert changes made to CMakelists and olcPGEX_TTF. Remove freetype dependency
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 1m0s
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 1m0s
This commit is contained in:
parent
5e06032db2
commit
522e58d5d7
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 13418
|
||||
#define VERSION_BUILD 13424
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
@ -318,6 +318,7 @@ namespace olc {
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#ifndef UNIT_TESTING
|
||||
#ifdef OLC_PGE_GAMEPAD
|
||||
#undef OLC_PGE_GAMEPAD
|
||||
|
||||
@ -1403,4 +1404,165 @@ std::vector<olc::GamePad *> olc::GamePad::gamepads;
|
||||
|
||||
#endif // OLC_PGE_GAMEPAD
|
||||
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
#else
|
||||
#ifdef OLC_PGE_GAMEPAD
|
||||
#undef OLC_PGE_GAMEPAD
|
||||
#pragma region Platform Dependent
|
||||
|
||||
#pragma region Windows
|
||||
#ifdef WIN32
|
||||
BOOL IsXInputDevice(const GUID *pGuidProductFromDirectInput) {
|
||||
return false;
|
||||
}
|
||||
void olc::GamePad::init() {}
|
||||
|
||||
void olc::GamePad::updateGamepads() {}
|
||||
|
||||
inline olc::GamePad::GamePad(LPCDIDEVICEINSTANCEA lpddi) {}
|
||||
|
||||
inline olc::GamePad::GamePad(DWORD xId) : xId(xId), xInput(true) {}
|
||||
|
||||
void olc::GamePad::poll() {}
|
||||
|
||||
void olc::GamePad::startVibration(float strength) const {}
|
||||
|
||||
void olc::GamePad::stopVibration() const {}
|
||||
|
||||
olc::GamePad::~GamePad() {}
|
||||
|
||||
std::string olc::GamePad::getId() {return {};}
|
||||
|
||||
#endif
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Linux
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
olc::GamePad *olc::GamePad::openGamepad(const std::string &path) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Create a gamepad from a path to the event file
|
||||
olc::GamePad::GamePad(std::string path, int fd)
|
||||
: path{std::move(path)}, availableAxes{false},
|
||||
availableButtons{false}, effect{}, fd{fd} {
|
||||
|
||||
}
|
||||
|
||||
bool olc::GamePad::readEvent(input_event &event) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
void olc::GamePad::poll() {
|
||||
}
|
||||
|
||||
void olc::GamePad::updateGamepads() {
|
||||
}
|
||||
|
||||
void olc::GamePad::enumerateGamepads() {
|
||||
}
|
||||
|
||||
std::string olc::GamePad::getId() { return {}; }
|
||||
|
||||
void olc::GamePad::startVibration(float strength) const {}
|
||||
|
||||
void olc::GamePad::stopVibration() const {
|
||||
}
|
||||
|
||||
olc::GamePad::~GamePad() {
|
||||
}
|
||||
|
||||
void olc::GamePad::reconnect() {
|
||||
}
|
||||
|
||||
void olc::GamePad::init() {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
olc::GamePad::GamePad(long id, std::string name) : name{name}, id{id} {}
|
||||
|
||||
void olc::GamePad::poll() {
|
||||
}
|
||||
|
||||
void olc::GamePad::updateGamepads() { }
|
||||
|
||||
std::string olc::GamePad::getId() { return {}; }
|
||||
|
||||
void olc::GamePad::startVibration(float strength) const {}
|
||||
|
||||
void olc::GamePad::stopVibration() const {}
|
||||
|
||||
olc::GamePad::~GamePad() {}
|
||||
|
||||
void olc::GamePad::init() {
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Common
|
||||
|
||||
olc::GamePad *olc::GamePad::selectWithButton(olc::GPButtons b) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
olc::GamePad *olc::GamePad::selectWithAnyButton() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
float olc::GamePad::getAxis(olc::GPAxes a) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const float olc::GamePad::getDeadZone()const{
|
||||
return {};
|
||||
}
|
||||
const float olc::GamePad::getDeadZoneOuter()const{
|
||||
return {};
|
||||
}
|
||||
|
||||
void olc::GamePad::setDeadZone(const float deadZone){
|
||||
}
|
||||
void olc::GamePad::setDeadZoneOuter(const float deadZoneOuter){
|
||||
}
|
||||
|
||||
olc::HWButton olc::GamePad::getButton(olc::GPButtons b) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string olc::GamePad::getName() { return {}; }
|
||||
|
||||
int olc::GamePad::getAxisCount() const { return {}; }
|
||||
|
||||
int olc::GamePad::getButtonCount() const { return {}; }
|
||||
|
||||
void olc::GamePad::handleButton(int id, bool value) {
|
||||
}
|
||||
|
||||
bool olc::GamePad::hasAxis(GPAxes a) { return {}; }
|
||||
|
||||
bool olc::GamePad::hasButton(GPButtons b) {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool olc::GamePad::OnBeforeUserUpdate(float &fElapsedTime) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<olc::GamePad *> &olc::GamePad::getGamepads() { return gamepads; }
|
||||
|
||||
std::vector<olc::GamePad *> olc::GamePad::gamepads;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#endif // OLC_PGE_GAMEPAD
|
||||
|
||||
#pragma endregion
|
||||
#endif
|
||||
@ -42,11 +42,15 @@ All rights reserved.
|
||||
#include "olcPixelGameEngine.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <ft2build.h>
|
||||
#pragma comment(lib, "freetype.lib")
|
||||
#else
|
||||
#ifdef OLC_PGE_HEADLESS
|
||||
#include <ft2build.h>
|
||||
#else
|
||||
#include <freetype2/ft2build.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "ft2build.h"
|
||||
#include "freetype/freetype.h"
|
||||
#include "freetype/ftglyph.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
@ -54,6 +58,10 @@ All rights reserved.
|
||||
#include <vector>
|
||||
#include "Error.h"
|
||||
|
||||
#ifndef UNIT_TESTING
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
namespace olc {
|
||||
struct FontRect {
|
||||
olc::vi2d offset;
|
||||
@ -478,4 +486,79 @@ FT_Library olc::Font::library;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
namespace olc {
|
||||
struct FontRect {
|
||||
olc::vi2d offset;
|
||||
olc::vi2d size;
|
||||
};
|
||||
|
||||
class Font : public olc::PGEX {
|
||||
public:
|
||||
Font() = default;
|
||||
|
||||
~Font() {
|
||||
}
|
||||
|
||||
Font(std::string path, int fontSize){
|
||||
}
|
||||
|
||||
Font(const Font &other) = delete;
|
||||
Font(Font &&other)noexcept{ }
|
||||
|
||||
Font &operator=(const Font &other) = delete;
|
||||
Font &operator=(Font &&other)noexcept{
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
FontRect _GetStringBounds(std::u32string string, float angle = 0.0f) {
|
||||
return olc::FontRect{};
|
||||
}
|
||||
|
||||
public:
|
||||
FontRect GetStringBounds(std::u32string string, float angle = 0.0f) {
|
||||
return {};
|
||||
}
|
||||
|
||||
olc::Sprite *RenderStringToSprite(std::u32string string,
|
||||
olc::Pixel color) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
olc::Decal *RenderStringToDecal(std::u32string string,
|
||||
olc::Pixel color) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
olc::Renderable RenderStringToRenderable(std::u32string string,
|
||||
olc::Pixel color) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void AddFallbackFont(std::string path) {
|
||||
}
|
||||
|
||||
std::u32string GetFontName(){
|
||||
return {};
|
||||
}
|
||||
|
||||
static bool init() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
void DrawBitmap(int x, int y, int bmp, int color) {
|
||||
}
|
||||
void DrawBitmapTo(int x, int y, int bmp, int color,
|
||||
int *sprite) {
|
||||
}
|
||||
|
||||
uint8_t GetCharIndex(char32_t charCode) {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
} // namespace olc
|
||||
#endif
|
||||
#endif
|
||||
@ -97,13 +97,8 @@ if (NOT EMSCRIPTEN)
|
||||
"${SOURCE_CXX_SRC_DIR}/discord-files/*.cpp"
|
||||
)
|
||||
endif()
|
||||
file(
|
||||
GLOB FREETYPE_INCLUDE_FILES
|
||||
"${SOURCE_CXX_SRC_DIR}/include/*.h"
|
||||
)
|
||||
|
||||
list(APPEND SOURCE_CXX_FILES ${SOURCE_CXX_FILES2})
|
||||
list(APPEND SOURCE_CXX_FILES ${FREETYPE_INCLUDE_FILES})
|
||||
|
||||
# Search in the "cmake" directory for additional CMake modules.
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
@ -260,7 +255,6 @@ if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT TEST_ONLY)
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
target_link_libraries(${OutputExecutable} ${FREETYPE_LIBRARIES})
|
||||
target_include_directories(${OutputExecutable} PRIVATE "${SOURCE_CXX_INCLUDE_DIR}/include")
|
||||
target_include_directories(${OutputExecutable} PRIVATE ${FREETYPE_INCLUDE_DIRS})
|
||||
|
||||
target_include_directories(${OutputExecutable} PRIVATE "${C_CXX_SOURCES_DIR}/discord-files")
|
||||
@ -296,15 +290,10 @@ if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND TEST_ONLY)
|
||||
target_link_libraries(AiL_test Threads::Threads)
|
||||
include_directories(${Threads_INCLUDE_DIRS})
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
target_link_libraries(AiL_test ${FREETYPE_LIBRARIES})
|
||||
target_include_directories(AiL_test PRIVATE ${FREETYPE_INCLUDE_FILES})
|
||||
target_include_directories(AiL_test PRIVATE ${FREETYPE_INCLUDE_DIRS})
|
||||
|
||||
target_include_directories(AiL_test PRIVATE "${C_CXX_SOURCES_DIR}/discord-files")
|
||||
target_include_directories(AiL_test PRIVATE "${C_CXX_SOURCES_DIR}/steam")
|
||||
link_directories("Adventures in Lestoria")
|
||||
link_directories("${SOURCE_CXX_INCLUDE_DIR}/include")
|
||||
|
||||
find_package(PNG REQUIRED)
|
||||
target_link_libraries(AiL_test PNG::PNG)
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
cd "Adventures in Lestoria"
|
||||
"..\x64\Release\Adventures in Lestoria.scr" nosteam
|
||||
"..\x64\Release\Adventures in Lestoria.exe" nosteam
|
||||
set /p DUMMY=Hit ENTER to exit...
|
||||
Loading…
x
Reference in New Issue
Block a user