mirror of
https://github.com/JesseTG/melonds-ds.git
synced 2024-11-23 06:29:46 +00:00
Changed my mind about nuklear
This commit is contained in:
parent
fc65914513
commit
476c231e17
@ -43,7 +43,6 @@ fetch_dependency("embed-binaries" "https://github.com/andoalon/embed-binaries.gi
|
||||
fetch_dependency(glm "https://github.com/g-truc/glm.git" "47585fd")
|
||||
fetch_dependency(libslirp "https://github.com/JesseTG/libslirp-mirror.git" "44e7877")
|
||||
fetch_dependency(pntr "https://github.com/robloach/pntr.git" "d2b451c")
|
||||
fetch_dependency(pntr_nuklear "https://github.com/robloach/pntr_nuklear.git" "43294ce")
|
||||
|
||||
# We build zlib from source because some distributions (e.g. Ubuntu) ship a static library
|
||||
# that wasn't compiled with -fPIC, which causes linking errors when building a shared library.
|
||||
@ -57,7 +56,7 @@ set(CMAKE_MODULE_PATH "${FETCHCONTENT_BASE_DIR}/melonds-src/cmake" "${FETCHCONTE
|
||||
set(BUILD_STATIC ON)
|
||||
set(BUILD_STATIC_LIBS ON)
|
||||
set(BUILD_QT_SDL OFF)
|
||||
FetchContent_MakeAvailable(melonDS libretro-common embed-binaries glm zlib libslirp pntr pntr_nuklear)
|
||||
FetchContent_MakeAvailable(melonDS libretro-common embed-binaries glm zlib libslirp pntr)
|
||||
|
||||
if (TRACY_ENABLE)
|
||||
FetchContent_MakeAvailable(tracy)
|
||||
|
@ -70,7 +70,7 @@ add_library(libretro MODULE
|
||||
tracy.hpp
|
||||
utils.cpp
|
||||
utils.hpp
|
||||
../pntr/pntr_nuklear.c
|
||||
../pntr/pntr.c
|
||||
)
|
||||
|
||||
target_include_directories(libretro SYSTEM PUBLIC
|
||||
@ -202,7 +202,7 @@ target_compile_definitions(libretro PUBLIC
|
||||
PNTR_PIXELFORMAT_ARGB
|
||||
)
|
||||
|
||||
target_link_libraries(libretro PUBLIC libretro-common core libretro-assets glm::glm_static pntr pntr_nuklear)
|
||||
target_link_libraries(libretro PUBLIC libretro-common core libretro-assets glm::glm_static pntr)
|
||||
|
||||
if (HAVE_NETWORKING)
|
||||
target_compile_definitions(libretro PUBLIC BUILDING_LIBSLIRP)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <pntr.h>
|
||||
#include <pntr_nuklear.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "buffer.hpp"
|
||||
@ -64,9 +63,6 @@ melonds::error::ErrorScreen::ErrorScreen(const config_exception& e) noexcept : e
|
||||
);
|
||||
assert(bodyFont != nullptr);
|
||||
|
||||
nk_context* context = pntr_load_nuklear(bodyFont);
|
||||
assert(context != nullptr);
|
||||
|
||||
topScreen = pntr_gen_image_color(NDS_SCREEN_WIDTH, NDS_SCREEN_HEIGHT, BACKGROUND_COLOR_TOP);
|
||||
assert(topScreen != nullptr);
|
||||
|
||||
@ -74,10 +70,9 @@ melonds::error::ErrorScreen::ErrorScreen(const config_exception& e) noexcept : e
|
||||
assert(bottomScreen != nullptr);
|
||||
|
||||
// Y coordinates go down, and the origin for all images is in their top-left corner.
|
||||
DrawTopScreen(context, titleFont, bodyFont);
|
||||
DrawBottomScreen(context, titleFont, bodyFont);
|
||||
DrawTopScreen(titleFont, bodyFont);
|
||||
DrawBottomScreen(titleFont, bodyFont);
|
||||
|
||||
pntr_unload_nuklear(context);
|
||||
pntr_unload_font(titleFont);
|
||||
pntr_unload_font(bodyFont);
|
||||
}
|
||||
@ -87,7 +82,7 @@ melonds::error::ErrorScreen::~ErrorScreen() {
|
||||
pntr_unload_image(bottomScreen);
|
||||
}
|
||||
|
||||
void melonds::error::ErrorScreen::DrawTopScreen(nk_context* context, pntr_font* titleFont, pntr_font* bodyFont) const noexcept {
|
||||
void melonds::error::ErrorScreen::DrawTopScreen(pntr_font* titleFont, pntr_font* bodyFont) const noexcept {
|
||||
ZoneScopedN("melonds::error::ErrorScreen::DrawTopScreen");
|
||||
assert(titleFont != nullptr);
|
||||
|
||||
@ -101,15 +96,12 @@ void melonds::error::ErrorScreen::DrawTopScreen(nk_context* context, pntr_font*
|
||||
assert(errorIcon->width < NDS_SCREEN_WIDTH);
|
||||
|
||||
// draw a little watermelon emoji in the bottom-right corner
|
||||
nk_begin(context, "Error", nk_rect(0, 0, NDS_SCREEN_WIDTH, NDS_SCREEN_HEIGHT), NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_NO_INPUT);
|
||||
pntr_draw_image(
|
||||
topScreen,
|
||||
errorIcon,
|
||||
NDS_SCREEN_WIDTH - errorIcon->width - MARGIN,
|
||||
NDS_SCREEN_HEIGHT - errorIcon->height - MARGIN
|
||||
);
|
||||
nk_end(context);
|
||||
pntr_draw_nuklear(topScreen, context);
|
||||
pntr_unload_image(errorIcon);
|
||||
|
||||
// now draw the title
|
||||
@ -148,7 +140,7 @@ void melonds::error::ErrorScreen::DrawTopScreen(nk_context* context, pntr_font*
|
||||
);
|
||||
}
|
||||
|
||||
void melonds::error::ErrorScreen::DrawBottomScreen(nk_context* context, pntr_font* titleFont, pntr_font* bodyFont) const noexcept {
|
||||
void melonds::error::ErrorScreen::DrawBottomScreen(pntr_font* titleFont, pntr_font* bodyFont) const noexcept {
|
||||
ZoneScopedN("melonds::error::ErrorScreen::DrawBottomScreen");
|
||||
assert(titleFont != nullptr);
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "exceptions.hpp"
|
||||
|
||||
struct nk_context;
|
||||
struct pntr_font;
|
||||
struct pntr_image;
|
||||
|
||||
@ -40,8 +39,8 @@ namespace melonds::error {
|
||||
|
||||
void Render(ScreenLayoutData& screenLayout) const noexcept;
|
||||
private:
|
||||
void DrawTopScreen(nk_context* context, pntr_font* titleFont, pntr_font* bodyFont) const noexcept;
|
||||
void DrawBottomScreen(nk_context* context, pntr_font* titleFont, pntr_font* bodyFont) const noexcept;
|
||||
void DrawTopScreen(pntr_font* titleFont, pntr_font* bodyFont) const noexcept;
|
||||
void DrawBottomScreen(pntr_font* titleFont, pntr_font* bodyFont) const noexcept;
|
||||
config_exception exception;
|
||||
pntr_image* bottomScreen = nullptr;
|
||||
pntr_image* topScreen = nullptr;
|
||||
|
@ -16,6 +16,3 @@
|
||||
|
||||
#define PNTR_IMPLEMENTATION
|
||||
#include "pntr.h"
|
||||
|
||||
#define PNTR_NUKLEAR_IMPLEMENTATION
|
||||
#include "pntr_nuklear.h"
|
Loading…
Reference in New Issue
Block a user