diff --git a/examples_for_PC/CMake_SDL/CMakeSettings.json b/examples_for_PC/CMake_SDL/CMakeSettings.json index 944b5676..ff73fb74 100644 --- a/examples_for_PC/CMake_SDL/CMakeSettings.json +++ b/examples_for_PC/CMake_SDL/CMakeSettings.json @@ -5,8 +5,19 @@ "generator": "Ninja", "configurationType": "Debug", "inheritEnvironments": [ "clang_cl_x64_x64" ], - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", + "buildRoot": "${projectDir}\\.out\\build\\${name}", + "installRoot": "${projectDir}\\.out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "Release", + "inheritEnvironments": [ "clang_cl_x64_x64" ], + "buildRoot": "${projectDir}\\.out\\build\\${name}", + "installRoot": "${projectDir}\\.out\\install\\${name}", "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "" diff --git a/library.json b/library.json index 139bafa0..27a9e08e 100644 --- a/library.json +++ b/library.json @@ -12,8 +12,8 @@ "url": "https://github.com/lovyan03/LovyanGFX.git" }, "version": "1.1.7", - "frameworks": ["arduino", "espidf"], - "platforms": ["espressif32", "espressif8266", "atmelsam"], + "frameworks": ["arduino", "espidf", "*"], + "platforms": ["espressif32", "espressif8266", "atmelsam", "native"], "headers": "LovyanGFX.hpp", "build": { "libArchive": false diff --git a/src/lgfx/Fonts/IPA/lgfx_font_japan.c b/src/lgfx/Fonts/IPA/lgfx_font_japan.c index 92469cf6..b14ba7e7 100644 --- a/src/lgfx/Fonts/IPA/lgfx_font_japan.c +++ b/src/lgfx/Fonts/IPA/lgfx_font_japan.c @@ -1,4 +1,4 @@ -#include +#include "lgfx_font_japan.h" #if defined ( ARDUINO ) && !defined ( PROGMEM ) #if __has_include() #include diff --git a/src/lgfx/Fonts/efont/lgfx_efont_cn.c b/src/lgfx/Fonts/efont/lgfx_efont_cn.c index 28341f6c..8a3b509c 100644 --- a/src/lgfx/Fonts/efont/lgfx_efont_cn.c +++ b/src/lgfx/Fonts/efont/lgfx_efont_cn.c @@ -1,4 +1,4 @@ -#include +#include "lgfx_efont_cn.h" #if defined ( ARDUINO ) && !defined ( PROGMEM ) #if __has_include() #include diff --git a/src/lgfx/Fonts/efont/lgfx_efont_ja.c b/src/lgfx/Fonts/efont/lgfx_efont_ja.c index 93ba25fc..277faf15 100644 --- a/src/lgfx/Fonts/efont/lgfx_efont_ja.c +++ b/src/lgfx/Fonts/efont/lgfx_efont_ja.c @@ -1,4 +1,4 @@ -#include +#include "lgfx_efont_ja.h" #if defined ( ARDUINO ) && !defined ( PROGMEM ) #if __has_include() #include diff --git a/src/lgfx/Fonts/efont/lgfx_efont_kr.c b/src/lgfx/Fonts/efont/lgfx_efont_kr.c index 0345a6d7..c18d2b94 100644 --- a/src/lgfx/Fonts/efont/lgfx_efont_kr.c +++ b/src/lgfx/Fonts/efont/lgfx_efont_kr.c @@ -1,4 +1,4 @@ -#include +#include "lgfx_efont_kr.h" #if defined ( ARDUINO ) && !defined ( PROGMEM ) #if __has_include() #include diff --git a/src/lgfx/Fonts/efont/lgfx_efont_tw.c b/src/lgfx/Fonts/efont/lgfx_efont_tw.c index 11690427..dd296bef 100644 --- a/src/lgfx/Fonts/efont/lgfx_efont_tw.c +++ b/src/lgfx/Fonts/efont/lgfx_efont_tw.c @@ -1,4 +1,4 @@ -#include +#include "lgfx_efont_tw.h" #if defined ( ARDUINO ) && !defined ( PROGMEM ) #if __has_include() #include diff --git a/src/lgfx/v1/Panel.hpp b/src/lgfx/v1/Panel.hpp index 698542ae..49ede767 100644 --- a/src/lgfx/v1/Panel.hpp +++ b/src/lgfx/v1/Panel.hpp @@ -23,8 +23,10 @@ Original Source: #include #else #include +#ifndef alloca #define alloca _alloca #endif +#endif #include "misc/enum.hpp" #include "misc/colortype.hpp" diff --git a/src/lgfx/v1/lgfx_filesystem_support.hpp b/src/lgfx/v1/lgfx_filesystem_support.hpp index bae6e0fa..5fadf95f 100644 --- a/src/lgfx/v1/lgfx_filesystem_support.hpp +++ b/src/lgfx/v1/lgfx_filesystem_support.hpp @@ -31,7 +31,9 @@ Original Source: #include #else #include + #ifndef alloca #define alloca _alloca + #endif #endif namespace lgfx diff --git a/src/lgfx/v1/misc/colortype.hpp b/src/lgfx/v1/misc/colortype.hpp index fb35f7d4..c3d7786f 100644 --- a/src/lgfx/v1/misc/colortype.hpp +++ b/src/lgfx/v1/misc/colortype.hpp @@ -417,7 +417,7 @@ namespace lgfx static constexpr color_depth_t depth = argb8888_4Byte; constexpr bgra8888_t(void) : raw{0} {}; constexpr bgra8888_t(const bgra8888_t&) = default; - constexpr bgra8888_t(uint8_t r8, uint8_t g8, uint8_t b8) : r(r8), g(g8), b(b8) {} + constexpr bgra8888_t(uint8_t r8, uint8_t g8, uint8_t b8) : a(255), r(r8), g(g8), b(b8) {} constexpr bgra8888_t(uint8_t a8, uint8_t r8, uint8_t g8, uint8_t b8) : a(a8), r(r8), g(g8), b(b8) {} constexpr bgra8888_t(uint32_t bgra8888) : raw(bgra8888) {} inline bgra8888_t& operator=(uint32_t rhs) { *reinterpret_cast(this) = rhs; return *this; } diff --git a/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp b/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp index a577b0ec..b69930f0 100644 --- a/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp +++ b/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp @@ -59,7 +59,7 @@ namespace lgfx uint32_t readData(uint_fast8_t, uint_fast8_t) override { return 0; } void readRect(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, void* dst, pixelcopy_t* param) override; - void copyRect(uint_fast16_t dst_x, uint_fast16_t dst_y, uint_fast16_t w, uint_fast16_t h, uint_fast16_t src_x, uint_fast16_t src_y); + void copyRect(uint_fast16_t dst_x, uint_fast16_t dst_y, uint_fast16_t w, uint_fast16_t h, uint_fast16_t src_x, uint_fast16_t src_y) override; protected: uint8_t** _lines_buffer = nullptr; diff --git a/src/lgfx/v1/platforms/sdl/Panel_sdl.cpp b/src/lgfx/v1/platforms/sdl/Panel_sdl.cpp index ba0ea1ce..a16bd54c 100644 --- a/src/lgfx/v1/platforms/sdl/Panel_sdl.cpp +++ b/src/lgfx/v1/platforms/sdl/Panel_sdl.cpp @@ -87,15 +87,32 @@ namespace lgfx int quit_filter(void * userdata, SDL_Event * event) { - Panel_sdl *sdl = (Panel_sdl *)userdata; +// Panel_sdl *sdl = (Panel_sdl *)userdata; if(event->type == SDL_WINDOWEVENT) { if(event->window.event == SDL_WINDOWEVENT_CLOSE) { - sdl->sdl_quit(); + auto monitor = getMonitorByWindowID(event->window.windowID); + if (monitor) { + SDL_DestroyTexture(monitor->texture); + SDL_DestroyRenderer(monitor->renderer); + SDL_DestroyWindow(monitor->window); + _list_monitor.remove(monitor); + if (_list_monitor.empty()) { + SDL_Quit(); + exit(0); + } + } } } else if(event->type == SDL_QUIT) { - sdl->sdl_quit(); + for (auto& m : _list_monitor) + { + SDL_DestroyTexture(m->texture); + SDL_DestroyRenderer(m->renderer); + SDL_DestroyWindow(m->window); + } + SDL_Quit(); + exit(0); } return 1; @@ -672,15 +689,6 @@ namespace lgfx SDL_RenderPresent(m->renderer); } - void Panel_sdl::sdl_quit(void) - { - SDL_DestroyTexture(monitor.texture); - SDL_DestroyRenderer(monitor.renderer); - SDL_DestroyWindow(monitor.window); - - SDL_Quit(); - exit(0); - } //---------------------------------------------------------------------------- } } diff --git a/src/lgfx/v1/platforms/sdl/Panel_sdl.hpp b/src/lgfx/v1/platforms/sdl/Panel_sdl.hpp index 9fc942ec..9f8ea4f1 100644 --- a/src/lgfx/v1/platforms/sdl/Panel_sdl.hpp +++ b/src/lgfx/v1/platforms/sdl/Panel_sdl.hpp @@ -43,6 +43,17 @@ namespace lgfx bool touched = false; int touch_x, touch_y; }; +//---------------------------------------------------------------------------- + + struct Touch_sdl : public ITouch + { + bool init(void) override { return true; } + void wakeup(void) override {} + void sleep(void) override {} + bool isEnable(void) override { return true; }; + uint_fast8_t getTouchRaw(touch_point_t* tp, uint_fast8_t count) override { return 0; } + }; + //---------------------------------------------------------------------------- struct Panel_sdl : public Panel_Device @@ -82,8 +93,6 @@ namespace lgfx void copyRect(uint_fast16_t dst_x, uint_fast16_t dst_y, uint_fast16_t w, uint_fast16_t h, uint_fast16_t src_x, uint_fast16_t src_y) override; uint_fast8_t getTouchRaw(touch_point_t* tp, uint_fast8_t count) override; - void sdl_quit(void); - void setScaling(uint_fast8_t scaling_x, uint_fast8_t scaling_y); diff --git a/src/lgfx/v1/platforms/sdl/common.hpp b/src/lgfx/v1/platforms/sdl/common.hpp index 6d94da22..95af9118 100644 --- a/src/lgfx/v1/platforms/sdl/common.hpp +++ b/src/lgfx/v1/platforms/sdl/common.hpp @@ -77,7 +77,7 @@ namespace lgfx need_transaction = false; } FILE* _fp; - bool open(const char* path) override { return (_fp = fopen(path, "rb")); } + bool open(const char* path) override { return (0 == fopen_s(&_fp, path, "rb")); } int read(uint8_t *buf, uint32_t len) override { return fread((char*)buf, 1, len, _fp); } void skip(int32_t offset) override { seek(offset, SEEK_CUR); } bool seek(uint32_t offset) override { return seek(offset, SEEK_SET); }