mirror of
https://github.com/XorTroll/hb-appstore.git
synced 2025-03-01 14:57:31 +00:00
fix font cache and switch to libcurl
This commit is contained in:
parent
f8ee41423c
commit
023373a600
@ -3,7 +3,7 @@ sudo: required
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -12,5 +12,5 @@ addons:
|
||||
- libsdl2-gfx-dev
|
||||
- libsdl2-ttf-dev
|
||||
- zlib1g-dev
|
||||
|
||||
|
||||
script: make -f Makefile.pc
|
||||
|
2
Makefile
2
Makefile
@ -55,7 +55,7 @@ CFLAGS := -g -Wall -O2 \
|
||||
-ffast-math \
|
||||
$(ARCH) $(DEFINES)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DSWITCH -D__LIBNX__ -DNOSTYLUS -DUSE_FILE32API -DNOCURL
|
||||
CFLAGS += $(INCLUDE) -DSWITCH -D__LIBNX__ -DNOSTYLUS -DUSE_FILE32API
|
||||
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
@ -6,11 +6,11 @@ MINIZIP_O := zip.o ioapi.o unzip.o
|
||||
|
||||
all:
|
||||
gcc -c $(MINIZIP)/*.c
|
||||
g++ -g -std=gnu++11 *.cpp ./console/*.cpp ./gui/*.cpp -lSDL2 -lSDL2main -lSDL2_image -lSDL2_ttf -lSDL2_gfx ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lz -o appstore.bin -fstack-protector-all -DNOCURL
|
||||
g++ -g -std=gnu++11 *.cpp ./console/*.cpp ./gui/*.cpp -lSDL2 -lSDL2main -lSDL2_image -lSDL2_ttf -lSDL2_gfx ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lz -o appstore.bin -fstack-protector-all
|
||||
|
||||
macos:
|
||||
gcc -c $(MINIZIP)/*.c
|
||||
g++ -g -std=gnu++11 *.cpp -lSDL2 -lSDL2main -lSDL2_gfx -lSDL2_image -lSDL2_ttf -framework Cocoa ./console/*.cpp ./gui/*.cpp ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lcurl -lz -o appstore.exe -fstack-protector-all -DNOCURL
|
||||
g++ -g -std=gnu++11 *.cpp -lSDL2 -lSDL2main -lSDL2_gfx -lSDL2_image -lSDL2_ttf -framework Cocoa ./console/*.cpp ./gui/*.cpp ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lcurl -lz -o appstore.exe -fstack-protector-all
|
||||
|
||||
clean:
|
||||
rm *.o *.bin
|
||||
|
@ -229,9 +229,13 @@ void AppPopup::render(Element* parent)
|
||||
this->subscreen->render(this);
|
||||
}
|
||||
|
||||
void AppPopup::updateCurrentlyDisplayedPopup(float amount)
|
||||
int AppPopup::updateCurrentlyDisplayedPopup(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
AppPopup* popup = AppPopup::frontmostPopup;
|
||||
|
||||
if (dltotal == 0) dltotal = 1;
|
||||
|
||||
double amount = dlnow / dltotal;
|
||||
|
||||
// update the amount
|
||||
if (popup != NULL)
|
||||
@ -254,4 +258,6 @@ void AppPopup::updateCurrentlyDisplayedPopup(float amount)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
DetailsPopup* subscreen = NULL;
|
||||
|
||||
// the callback method to update the currently displayed pop up (and variables it needs)
|
||||
static void updateCurrentlyDisplayedPopup(float amount);
|
||||
static int updateCurrentlyDisplayedPopup(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
static AppPopup* frontmostPopup;
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,11 @@ TextElement::TextElement(const char* text, int size, SDL_Color* color, bool mono
|
||||
this->color = *color;
|
||||
|
||||
this->textSurface = this->renderText(*(this->text), size, monospaced, wrapped_width);
|
||||
|
||||
int w, h;
|
||||
SDL_QueryTexture(this->textSurface, NULL, NULL, &w, &h);
|
||||
this->width = w;
|
||||
this->height = h;
|
||||
}
|
||||
|
||||
void TextElement::render(Element* parent)
|
||||
@ -37,9 +42,8 @@ SDL_Texture* TextElement::renderText(std::string& message, int size, bool monosp
|
||||
std::string key = message + std::to_string(size);
|
||||
|
||||
// try to find it in the cache first
|
||||
// TODO: fix cache?
|
||||
// if (ImageCache::cache.count(key))
|
||||
// return ImageCache::cache[key];
|
||||
if (ImageCache::cache.count(key))
|
||||
return ImageCache::cache[key];
|
||||
|
||||
// not found, make/render it
|
||||
|
||||
@ -61,10 +65,7 @@ SDL_Texture* TextElement::renderText(std::string& message, int size, bool monosp
|
||||
surf = TTF_RenderText_Blended_Wrapped(font, message.c_str(), this->color, wrapped_width);
|
||||
|
||||
SDL_Texture* texture = SDL_CreateTextureFromSurface(MainDisplay::mainRenderer, surf);
|
||||
|
||||
this->width = surf->w;
|
||||
this->height = surf->h;
|
||||
SDL_FreeSurface(surf);
|
||||
SDL_FreeSurface(surf);
|
||||
|
||||
// SDL_FreeSurface(surf);
|
||||
TTF_CloseFont(font);
|
||||
|
2
libs/get
2
libs/get
@ -1 +1 @@
|
||||
Subproject commit 4bec7d9ced7be36c4f3f6d58150e24a34fe0b2eb
|
||||
Subproject commit 2338da592f3e874cda1f6bd6d060c06327d8dcd7
|
Loading…
x
Reference in New Issue
Block a user