More linker issues
8
Makefile
|
@ -39,10 +39,10 @@ include $(DEVKITPRO)/libnx/switch_rules
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := $(notdir $(CURDIR))
|
TARGET := $(notdir $(CURDIR))
|
||||||
BUILD := build
|
BUILD := build
|
||||||
SOURCES := source
|
SOURCES := source source/menus/book source/menus/book-chooser
|
||||||
DATA := data
|
DATA := data
|
||||||
INCLUDES := include include/menus/book include/menus/book-chooser
|
INCLUDES := include include/menus/book include/menus/book-chooser
|
||||||
ROMFS := RomFS
|
ROMFS := romfs
|
||||||
|
|
||||||
VERSION_MAJOR := 0
|
VERSION_MAJOR := 0
|
||||||
VERSION_MINOR := 1
|
VERSION_MINOR := 1
|
||||||
|
@ -57,7 +57,7 @@ APP_VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
|
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O2 -ffunction-sections \
|
CFLAGS := -g -std=c++17 -Wall -O2 -ffunction-sections \
|
||||||
$(ARCH) $(DEFINES)
|
$(ARCH) $(DEFINES)
|
||||||
|
|
||||||
CFLAGS += -D__SWITCH__ $(INCLUDE) `sdl2-config --cflags`
|
CFLAGS += -D__SWITCH__ $(INCLUDE) `sdl2-config --cflags`
|
||||||
|
@ -70,7 +70,7 @@ LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*
|
||||||
#LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image
|
#LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image
|
||||||
#LIBS := `aarch64-none-elf-pkg-config --libs sdl2 SDL2_ttf SDL2_mixer`
|
#LIBS := `aarch64-none-elf-pkg-config --libs sdl2 SDL2_ttf SDL2_mixer`
|
||||||
#LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype -lz -lnx
|
#LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype -lz -lnx
|
||||||
LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ljpeg -lwebp -lz -lbz2 -ltwili -lnx -lmupdf -lmupdf-third
|
LIBS := -lstdc++fs `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ljpeg -lwebp -lz -lbz2 -ltwili -lnx -lmupdf -lmupdf-third
|
||||||
#LIBS := `aarch64-none-elf-pkg-config --libs sdl2` -lSDL2_ttf #-lSDL2_image -lmupdf -lmupdf-third
|
#LIBS := `aarch64-none-elf-pkg-config --libs sdl2` -lSDL2_ttf #-lSDL2_image -lmupdf -lmupdf-third
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef EBOOK_READER_SDL_HELPER_H
|
#ifndef EBOOK_READER_SDL_HELPER_H
|
||||||
#define EBOOK_READER_SDL_HELPER_H
|
#define EBOOK_READER_SDL_HELPER_H
|
||||||
|
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#include <SDL2/SDL_ttf.h>
|
||||||
|
|
||||||
static inline SDL_Color SDL_MakeColour(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
static inline SDL_Color SDL_MakeColour(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||||
{
|
{
|
||||||
SDL_Color colour = {r, g, b, a};
|
SDL_Color colour = {r, g, b, a};
|
||||||
|
@ -8,6 +11,9 @@ static inline SDL_Color SDL_MakeColour(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WHITE SDL_MakeColour(255, 255, 255, 255)
|
#define WHITE SDL_MakeColour(255, 255, 255, 255)
|
||||||
|
#define VERY_LIGHT_GRAY SDL_MakeColour(222, 222, 222, 255)
|
||||||
|
#define LIGHT_GRAY SDL_MakeColour(181, 181, 181, 255)
|
||||||
|
#define DARK_GRAY SDL_MakeColour(148, 148, 148, 255)
|
||||||
#define BLACK_BG SDL_MakeColour(48, 48, 48, 255)
|
#define BLACK_BG SDL_MakeColour(48, 48, 48, 255)
|
||||||
#define STATUS_BAR_LIGHT SDL_MakeColour(37, 79, 174, 255)
|
#define STATUS_BAR_LIGHT SDL_MakeColour(37, 79, 174, 255)
|
||||||
#define STATUS_BAR_DARK SDL_MakeColour(38, 50, 56, 255)
|
#define STATUS_BAR_DARK SDL_MakeColour(38, 50, 56, 255)
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
extern SDL_Window *WINDOW;
|
extern SDL_Window *WINDOW;
|
||||||
extern SDL_Surface *WINDOW_SURFACE;
|
extern SDL_Surface *WINDOW_SURFACE;
|
||||||
extern SDL_Renderer *RENDERER;
|
extern SDL_Renderer *RENDERER;
|
||||||
extern TTF_Font *ARIAL_UNICODE;
|
extern TTF_Font *ARIAL;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef NX_SHELL_TEXTURES_H
|
#ifndef NX_SHELL_TEXTURES_H
|
||||||
#define NX_SHELL_TEXTURES_H
|
#define NX_SHELL_TEXTURES_H
|
||||||
|
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
SDL_Texture *battery_20, *battery_20_charging, *battery_30, *battery_30_charging, *battery_50, *battery_50_charging, \
|
SDL_Texture *battery_20, *battery_20_charging, *battery_30, *battery_30_charging, *battery_50, *battery_50_charging, \
|
||||||
*battery_60, *battery_60_charging, *battery_80, *battery_80_charging, *battery_90, *battery_90_charging, \
|
*battery_60, *battery_60_charging, *battery_80, *battery_80_charging, *battery_90, *battery_90_charging, \
|
||||||
|
|
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 517 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 551 B |
|
@ -1,5 +1,5 @@
|
||||||
#include "common.h"
|
|
||||||
#include "SDL_helper.h"
|
#include "SDL_helper.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
void SDL_ClearScreen(SDL_Renderer *renderer, SDL_Color colour) {
|
void SDL_ClearScreen(SDL_Renderer *renderer, SDL_Color colour) {
|
||||||
SDL_SetRenderDrawColor(renderer, colour.r, colour.g, colour.b, colour.a);
|
SDL_SetRenderDrawColor(renderer, colour.r, colour.g, colour.b, colour.a);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "SDL_helper.h"
|
//#include "SDL_helper.h"
|
||||||
#include "textures.h"
|
#include "textures.h"
|
||||||
#include "MenuChooser.h"
|
#include "MenuChooser.h"
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ extern "C" {
|
||||||
SDL_Renderer* RENDERER;
|
SDL_Renderer* RENDERER;
|
||||||
SDL_Window* WINDOW;
|
SDL_Window* WINDOW;
|
||||||
SDL_Surface* WINDOW_SURFACE;
|
SDL_Surface* WINDOW_SURFACE;
|
||||||
TTF_Font* ARIAL_UNICODE;
|
TTF_Font* ARIAL;
|
||||||
SDL_Event EVENT;
|
SDL_Event EVENT;
|
||||||
|
|
||||||
bool run = true;
|
bool run = true;
|
||||||
|
@ -27,7 +27,8 @@ bool run = true;
|
||||||
void Term_Services() {
|
void Term_Services() {
|
||||||
std::cout << "Terminate Serices" << std::endl;
|
std::cout << "Terminate Serices" << std::endl;
|
||||||
|
|
||||||
TTF_CloseFont(ARIAL_UNICODE);
|
timeExit();
|
||||||
|
TTF_CloseFont(ARIAL);
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
|
|
||||||
Textures_Free();
|
Textures_Free();
|
||||||
|
@ -43,6 +44,7 @@ void Term_Services() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init_Services() {
|
void Init_Services() {
|
||||||
|
timeInitialize();
|
||||||
twiliInitialize();
|
twiliInitialize();
|
||||||
std::cout << "Initalize Serices" << std::endl;
|
std::cout << "Initalize Serices" << std::endl;
|
||||||
|
|
||||||
|
@ -50,29 +52,43 @@ void Init_Services() {
|
||||||
SDL_Log("SDL_Init: %s\n", SDL_GetError());
|
SDL_Log("SDL_Init: %s\n", SDL_GetError());
|
||||||
Term_Services();
|
Term_Services();
|
||||||
}
|
}
|
||||||
|
std::cout << "Initalized SDL" << std::endl;
|
||||||
|
|
||||||
TTF_Init();
|
if(TTF_Init()==-1) {
|
||||||
|
printf("TTF_Init: %s\n", TTF_GetError());
|
||||||
|
Term_Services();
|
||||||
|
}
|
||||||
|
std::cout << "Initalized TTF" << std::endl;
|
||||||
|
|
||||||
WINDOW = SDL_CreateWindow("sdl2_gles2", 0, 0, 1280, 720, 0);
|
WINDOW = SDL_CreateWindow("sdl2_gles2", 0, 0, 1280, 720, 0);
|
||||||
if (!WINDOW) {
|
if (!WINDOW) {
|
||||||
SDL_Log("SDL_CreateWindow: %s\n", SDL_GetError());
|
SDL_Log("SDL_CreateWindow: %s\n", SDL_GetError());
|
||||||
Term_Services();
|
Term_Services();
|
||||||
}
|
}
|
||||||
|
std::cout << "Initalized Window" << std::endl;
|
||||||
|
|
||||||
RENDERER = SDL_CreateRenderer(WINDOW, 0, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
RENDERER = SDL_CreateRenderer(WINDOW, 0, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
if (!RENDERER) {
|
if (!RENDERER) {
|
||||||
SDL_Log("SDL_CreateRenderer: %s\n", SDL_GetError());
|
SDL_Log("SDL_CreateRenderer: %s\n", SDL_GetError());
|
||||||
Term_Services();
|
Term_Services();
|
||||||
}
|
}
|
||||||
|
std::cout << "Initalized Renderer" << std::endl;
|
||||||
|
|
||||||
WINDOW_SURFACE = SDL_GetWindowSurface(WINDOW);
|
WINDOW_SURFACE = SDL_GetWindowSurface(WINDOW);
|
||||||
|
std::cout << "Retrevied Window Surface" << std::endl;
|
||||||
|
|
||||||
romfsInit();
|
romfsInit();
|
||||||
|
std::cout << "Initalized RomFs" << std::endl;
|
||||||
|
|
||||||
|
/*std::cout << "Loading Textures" << std::endl;
|
||||||
Textures_Load();
|
Textures_Load();
|
||||||
ARIAL_UNICODE = TTF_OpenFont("romfs:/res/font/arial.ttf", 35);
|
std::cout << "Loaded Textures" << std::endl;*/
|
||||||
if (!ARIAL_UNICODE) {
|
|
||||||
|
ARIAL = TTF_OpenFont("romfs:/arial.ttf", 35);
|
||||||
|
if (!ARIAL) {
|
||||||
Term_Services();
|
Term_Services();
|
||||||
}
|
}
|
||||||
|
std::cout << "Gotten Fonts" << std::endl;
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (SDL_JoystickOpen(i) == NULL) {
|
if (SDL_JoystickOpen(i) == NULL) {
|
||||||
|
@ -80,6 +96,7 @@ void Init_Services() {
|
||||||
Term_Services();
|
Term_Services();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "Initalized Input" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
@ -90,6 +107,7 @@ int main(int argc, char *argv[]) {
|
||||||
//Menu_OpenBook("/switch/eBookReader/books/test.epub");
|
//Menu_OpenBook("/switch/eBookReader/books/test.epub");
|
||||||
Menu_StartChoosing();
|
Menu_StartChoosing();
|
||||||
|
|
||||||
|
bool isBookReading = false;
|
||||||
while (run) {
|
while (run) {
|
||||||
while (SDL_PollEvent(&EVENT)) {
|
while (SDL_PollEvent(&EVENT)) {
|
||||||
switch (EVENT.type) {
|
switch (EVENT.type) {
|
||||||
|
@ -116,6 +134,25 @@ int main(int argc, char *argv[]) {
|
||||||
SDL_RenderClear(RENDERER);
|
SDL_RenderClear(RENDERER);
|
||||||
|
|
||||||
SDL_RenderPresent(RENDERER);*/
|
SDL_RenderPresent(RENDERER);*/
|
||||||
|
/*if (!isBookReading) {
|
||||||
|
SDL_ClearScreen(RENDERER, WHITE);
|
||||||
|
std::cout << "Cleared Screen" << std::endl;
|
||||||
|
SDL_RenderClear(RENDERER);
|
||||||
|
std::cout << "Render Clear" << std::endl;*/
|
||||||
|
|
||||||
|
/*int space_index = 0;
|
||||||
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
|
SDL_DrawText(RENDERER, ARIAL, 20, 20 + (30 * space_index), BLACK, entry->d_name);
|
||||||
|
space_index++;
|
||||||
|
//cout << entry->d_name << endl;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*SDL_DrawText(RENDERER, ARIAL, 50, 50, BLACK, "TEST");
|
||||||
|
std::cout << "Draw text" << std::endl;
|
||||||
|
|
||||||
|
SDL_RenderPresent(RENDERER);
|
||||||
|
std::cout << "Render Present" << std::endl;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
Term_Services();
|
Term_Services();
|
||||||
|
|
|
@ -1,35 +1,83 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "MenuChooser.h"
|
#include "MenuChooser.h"
|
||||||
|
#include "menu_book_reader.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "SDL_helper.h"
|
#include "SDL_helper.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <dirent.h>
|
/*#include <dirent.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>*/
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
namespace fs = filesystem;
|
||||||
//using namespace std;
|
//using namespace std;
|
||||||
|
|
||||||
|
//extern bool readingBook;
|
||||||
|
|
||||||
void Menu_StartChoosing() {
|
void Menu_StartChoosing() {
|
||||||
int choosen_index = 0;
|
int choosenIndex = 0;
|
||||||
|
bool readingBook = false;
|
||||||
|
|
||||||
struct dirent *entry;
|
string path = "/switch/eBookReader/books";
|
||||||
DIR *dir = opendir("/switch/eBookReader/books");
|
while(appletMainLoop()) {
|
||||||
|
if (readingBook) {
|
||||||
if (dir == NULL) {
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while(appletMainLoop()) {
|
|
||||||
SDL_ClearScreen(RENDERER, WHITE);
|
SDL_ClearScreen(RENDERER, WHITE);
|
||||||
SDL_RenderClear(RENDERER);
|
SDL_RenderClear(RENDERER);
|
||||||
|
|
||||||
|
hidScanInput();
|
||||||
|
|
||||||
|
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
|
||||||
|
u64 kHeld = hidKeysHeld(CONTROLLER_P1_AUTO);
|
||||||
|
|
||||||
|
if (kDown & KEY_PLUS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kDown & KEY_A) {
|
||||||
|
int bookIndex = 0;
|
||||||
|
for (const auto & entry : fs::directory_iterator(path)) {
|
||||||
|
string filename = entry.path().filename().string();
|
||||||
|
string extention = filename.substr(filename.length() - 3);
|
||||||
|
if (extention == "pdf") {
|
||||||
|
if (bookIndex == choosenIndex) {
|
||||||
|
char* book = (char *) entry.path().string().c_str();
|
||||||
|
Menu_OpenBook(book);
|
||||||
|
readingBook = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
choosenIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kDown & KEY_DUP) {
|
||||||
|
if (choosenIndex != 0) choosenIndex--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kDown & KEY_DDOWN) {
|
||||||
|
choosenIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
int space_index = 0;
|
int space_index = 0;
|
||||||
while ((entry = readdir(dir)) != NULL) {
|
for (const auto & entry : fs::directory_iterator(path)) {
|
||||||
SDL_DrawText(RENDERER, ARIAL_UNICODE, 20, 20 + (30 * space_index), BLACK, entry->d_name);
|
string filename = entry.path().filename().string();
|
||||||
|
string extention = filename.substr(filename.length() - 3);
|
||||||
|
if (extention == "pdf") {
|
||||||
|
if (choosenIndex == space_index) {
|
||||||
|
SDL_DrawRect(RENDERER, 15, 20 + (40 * space_index), 1265, 40, VERY_LIGHT_GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_DrawText(RENDERER, ARIAL, 20, 20 + (40 * space_index), BLACK, entry.path().filename().c_str());
|
||||||
|
|
||||||
space_index++;
|
space_index++;
|
||||||
//cout << entry->d_name << endl;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_RenderPresent(RENDERER);
|
SDL_RenderPresent(RENDERER);
|
||||||
|
|
|
@ -142,15 +142,13 @@ void BookReader::draw() {
|
||||||
char *title = layout->info();
|
char *title = layout->info();
|
||||||
|
|
||||||
int title_width = 0, title_height = 0;
|
int title_width = 0, title_height = 0;
|
||||||
//TTF_SizeText(Roboto, title, &title_width, &title_height);
|
TTF_SizeText(ARIAL, title, &title_width, &title_height);
|
||||||
TTF_SizeText(ARIAL_UNICODE, title, &title_width, &title_height);
|
|
||||||
|
|
||||||
//SDL_Color color = config_dark_theme ? STATUS_BAR_DARK : STATUS_BAR_LIGHT;
|
//SDL_Color color = config_dark_theme ? STATUS_BAR_DARK : STATUS_BAR_LIGHT;
|
||||||
SDL_Color color = STATUS_BAR_LIGHT;
|
SDL_Color color = STATUS_BAR_LIGHT;
|
||||||
|
|
||||||
SDL_DrawRect(RENDERER, 0, 0, 1280, 40, SDL_MakeColour(color.r, color.g, color.b , 128));
|
SDL_DrawRect(RENDERER, 0, 0, 1280, 40, SDL_MakeColour(color.r, color.g, color.b , 128));
|
||||||
//SDL_DrawText(RENDERER, Roboto, (1280 - title_width) / 2, (44 - title_height) / 2, WHITE, title);
|
SDL_DrawText(RENDERER, ARIAL, (1280 - title_width) / 2, (44 - title_height) / 2, WHITE, title);
|
||||||
SDL_DrawText(RENDERER, ARIAL_UNICODE, (1280 - title_width) / 2, (44 - title_height) / 2, WHITE, title);
|
|
||||||
|
|
||||||
StatusBar_DisplayTime();
|
StatusBar_DisplayTime();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "menu_book_reader.h"
|
#include "menu_book_reader.h"
|
||||||
|
#include "MenuChooser.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,5 +117,6 @@ void Menu_OpenBook(char *path) {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//readingBook = false;
|
||||||
delete reader;
|
delete reader;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,14 +97,14 @@ static void StatusBar_GetBatteryStatus(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, 5, "%d%%", percent);
|
snprintf(buf, 5, "%d%%", percent);
|
||||||
TTF_SizeText(ARIAL_UNICODE, buf, &width, NULL);
|
TTF_SizeText(ARIAL, buf, &width, NULL);
|
||||||
SDL_DrawText(RENDERER, ARIAL_UNICODE, (x - width - 10), y, WHITE, buf);
|
SDL_DrawText(RENDERER, ARIAL, (x - width - 10), y, WHITE, buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(buf, 5, "%d%%", percent);
|
snprintf(buf, 5, "%d%%", percent);
|
||||||
TTF_SizeText(ARIAL_UNICODE, buf, &width, NULL);
|
TTF_SizeText(ARIAL, buf, &width, NULL);
|
||||||
SDL_DrawText(RENDERER, ARIAL_UNICODE, (x - width - 10), y, WHITE, buf);
|
SDL_DrawText(RENDERER, ARIAL, (x - width - 10), y, WHITE, buf);
|
||||||
SDL_DrawImage(RENDERER, battery_unknown, x, 1);
|
SDL_DrawImage(RENDERER, battery_unknown, x, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,8 @@ static void StatusBar_GetBatteryStatus(int x, int y)
|
||||||
void StatusBar_DisplayTime(void)
|
void StatusBar_DisplayTime(void)
|
||||||
{
|
{
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
TTF_SizeText(ARIAL_UNICODE, Clock_GetCurrentTime(), &width, &height);
|
TTF_SizeText(ARIAL, Clock_GetCurrentTime(), &width, &height);
|
||||||
|
|
||||||
StatusBar_GetBatteryStatus(1260 - width - 44, (40 - height) / 2);
|
//StatusBar_GetBatteryStatus(1260 - width - 44, (40 - height) / 2);
|
||||||
SDL_DrawText(RENDERER, ARIAL_UNICODE, 1260 - width, (40 - height) / 2, WHITE, Clock_GetCurrentTime());
|
SDL_DrawText(RENDERER, ARIAL, 1260 - width, (40 - height) / 2, WHITE, Clock_GetCurrentTime());
|
||||||
}
|
}
|
|
@ -1,80 +1,27 @@
|
||||||
|
#include "textures.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "SDL_helper.h"
|
#include "SDL_helper.h"
|
||||||
#include "textures.h"
|
|
||||||
|
|
||||||
void Textures_Load(void) {
|
void Textures_Load(void) {
|
||||||
/*SDL_LoadImage(RENDERER, &icon_app, "romfs:/res/images/ic_fso_type_executable.png");
|
SDL_LoadImage(RENDERER, &battery_20, "romfs:/battery_20.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_archive, "romfs:/res/images/ic_fso_type_compress.png");
|
SDL_LoadImage(RENDERER, &battery_20_charging, "romfs:/battery_20_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_audio, "romfs:/res/images/ic_fso_type_audio.png");
|
SDL_LoadImage(RENDERER, &battery_30, "romfs:/battery_30.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_dir, "romfs:/res/images/ic_fso_folder.png");
|
SDL_LoadImage(RENDERER, &battery_30_charging, "romfs:/battery_30_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_dir_dark, "romfs:/res/images/ic_fso_folder_dark.png");
|
SDL_LoadImage(RENDERER, &battery_50, "romfs:/battery_50.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_doc, "romfs:/res/images/ic_fso_type_document.png");
|
SDL_LoadImage(RENDERER, &battery_50_charging, "romfs:/battery_50_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_file, "romfs:/res/images/ic_fso_default.png");
|
SDL_LoadImage(RENDERER, &battery_60, "romfs:/battery_60.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_image, "romfs:/res/images/ic_fso_type_image.png");
|
SDL_LoadImage(RENDERER, &battery_60_charging, "romfs:/battery_60_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_text, "romfs:/res/images/ic_fso_type_text.png");
|
SDL_LoadImage(RENDERER, &battery_80, "romfs:/battery_80.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_check, "romfs:/res/images/btn_material_light_check_on_normal.png");
|
SDL_LoadImage(RENDERER, &battery_80_charging, "romfs:/battery_80_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_check_dark, "romfs:/res/images/btn_material_light_check_on_normal_dark.png");
|
SDL_LoadImage(RENDERER, &battery_90, "romfs:/battery_90.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_uncheck, "romfs:/res/images/btn_material_light_check_off_normal.png");
|
SDL_LoadImage(RENDERER, &battery_90_charging, "romfs:/battery_90_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &icon_uncheck_dark, "romfs:/res/images/btn_material_light_check_off_normal_dark.png");
|
SDL_LoadImage(RENDERER, &battery_full, "romfs:/battery_full.png");
|
||||||
SDL_LoadImage(RENDERER, &dialog, "romfs:/res/images/ic_material_dialog.png");
|
SDL_LoadImage(RENDERER, &battery_full_charging, "romfs:/battery_full_charging.png");
|
||||||
SDL_LoadImage(RENDERER, &options_dialog, "romfs:/res/images/ic_material_options_dialog.png");
|
SDL_LoadImage(RENDERER, &battery_low, "romfs:/battery_low.png");
|
||||||
SDL_LoadImage(RENDERER, &properties_dialog, "romfs:/res/images/ic_material_properties_dialog.png");
|
SDL_LoadImage(RENDERER, &battery_unknown, "romfs:/battery_unknown.png");
|
||||||
SDL_LoadImage(RENDERER, &dialog_dark, "romfs:/res/images/ic_material_dialog_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &options_dialog_dark, "romfs:/res/images/ic_material_options_dialog_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &properties_dialog_dark, "romfs:/res/images/ic_material_properties_dialog_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &bg_header, "romfs:/res/images/bg_header.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_settings, "romfs:/res/images/ic_material_light_settings.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_sd, "romfs:/res/images/ic_material_light_sdcard.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_secure, "romfs:/res/images/ic_material_light_secure.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_settings_dark, "romfs:/res/images/ic_material_light_settings_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_sd_dark, "romfs:/res/images/ic_material_light_sdcard_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_secure_dark, "romfs:/res/images/ic_material_light_secure_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_radio_off, "romfs:/res/images/btn_material_light_radio_off_normal.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_radio_on, "romfs:/res/images/btn_material_light_radio_on_normal.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_radio_dark_off, "romfs:/res/images/btn_material_light_radio_off_normal_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_radio_dark_on, "romfs:/res/images/btn_material_light_radio_on_normal_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_toggle_on, "romfs:/res/images/btn_material_light_toggle_on_normal.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_toggle_dark_on, "romfs:/res/images/btn_material_light_toggle_on_normal_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_toggle_off, "romfs:/res/images/btn_material_light_toggle_off_normal.png");
|
|
||||||
SDL_LoadImage(RENDERER, &default_artwork, "romfs:/res/images/default_artwork.png");
|
|
||||||
SDL_LoadImage(RENDERER, &default_artwork_blur, "romfs:/res/images/default_artwork_blur.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_play, "romfs:/res/images/btn_playback_play.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_pause, "romfs:/res/images/btn_playback_pause.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_rewind, "romfs:/res/images/btn_playback_rewind.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_forward, "romfs:/res/images/btn_playback_forward.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_repeat, "romfs:/res/images/btn_playback_repeat.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_shuffle, "romfs:/res/images/btn_playback_shuffle.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_repeat_overlay, "romfs:/res/images/btn_playback_repeat_overlay.png");
|
|
||||||
SDL_LoadImage(RENDERER, &btn_shuffle_overlay, "romfs:/res/images/btn_playback_shuffle_overlay.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_nav_drawer, "romfs:/res/images/ic_material_light_navigation_drawer.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_actions, "romfs:/res/images/ic_material_light_contextual_action.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_back, "romfs:/res/images/ic_arrow_back_normal.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_accept, "romfs:/res/images/ic_material_light_accept.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_accept_dark, "romfs:/res/images/ic_material_light_accept_dark.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_remove, "romfs:/res/images/ic_material_light_remove.png");
|
|
||||||
SDL_LoadImage(RENDERER, &icon_remove_dark, "romfs:/res/images/ic_material_light_remove_dark.png");*/
|
|
||||||
SDL_LoadImage(RENDERER, &battery_20, "romfs:/res/images/battery_20.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_20_charging, "romfs:/res/images/battery_20_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_30, "romfs:/res/images/battery_30.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_30_charging, "romfs:/res/images/battery_30_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_50, "romfs:/res/images/battery_50.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_50_charging, "romfs:/res/images/battery_50_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_60, "romfs:/res/images/battery_60.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_60_charging, "romfs:/res/images/battery_60_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_80, "romfs:/res/images/battery_80.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_80_charging, "romfs:/res/images/battery_80_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_90, "romfs:/res/images/battery_90.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_90_charging, "romfs:/res/images/battery_90_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_full, "romfs:/res/images/battery_full.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_full_charging, "romfs:/res/images/battery_full_charging.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_low, "romfs:/res/images/battery_low.png");
|
|
||||||
SDL_LoadImage(RENDERER, &battery_unknown, "romfs:/res/images/battery_unknown.png");
|
|
||||||
//SDL_LoadImage(RENDERER, &icon_lock, "romfs:/res/images/ic_material_dialog_fs_locked.png");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Textures_Free(void)
|
void Textures_Free(void) {
|
||||||
{
|
|
||||||
//SDL_DestroyTexture(icon_lock);
|
|
||||||
SDL_DestroyTexture(battery_unknown);
|
SDL_DestroyTexture(battery_unknown);
|
||||||
SDL_DestroyTexture(battery_low);
|
SDL_DestroyTexture(battery_low);
|
||||||
SDL_DestroyTexture(battery_full_charging);
|
SDL_DestroyTexture(battery_full_charging);
|
||||||
|
@ -90,54 +37,4 @@ void Textures_Free(void)
|
||||||
SDL_DestroyTexture(battery_30);
|
SDL_DestroyTexture(battery_30);
|
||||||
SDL_DestroyTexture(battery_20_charging);
|
SDL_DestroyTexture(battery_20_charging);
|
||||||
SDL_DestroyTexture(battery_20);
|
SDL_DestroyTexture(battery_20);
|
||||||
/*SDL_DestroyTexture(icon_remove_dark);
|
|
||||||
SDL_DestroyTexture(icon_remove);
|
|
||||||
SDL_DestroyTexture(icon_accept_dark);
|
|
||||||
SDL_DestroyTexture(icon_accept);
|
|
||||||
SDL_DestroyTexture(icon_back);
|
|
||||||
SDL_DestroyTexture(icon_actions);
|
|
||||||
SDL_DestroyTexture(icon_nav_drawer);
|
|
||||||
SDL_DestroyTexture(btn_shuffle_overlay);
|
|
||||||
SDL_DestroyTexture(btn_repeat_overlay);
|
|
||||||
SDL_DestroyTexture(btn_shuffle);
|
|
||||||
SDL_DestroyTexture(btn_repeat);
|
|
||||||
SDL_DestroyTexture(btn_forward);
|
|
||||||
SDL_DestroyTexture(btn_rewind);
|
|
||||||
SDL_DestroyTexture(btn_pause);
|
|
||||||
SDL_DestroyTexture(btn_play);
|
|
||||||
SDL_DestroyTexture(default_artwork_blur);
|
|
||||||
SDL_DestroyTexture(default_artwork);
|
|
||||||
SDL_DestroyTexture(icon_toggle_off);
|
|
||||||
SDL_DestroyTexture(icon_toggle_dark_on);
|
|
||||||
SDL_DestroyTexture(icon_toggle_on);
|
|
||||||
SDL_DestroyTexture(icon_radio_dark_on);
|
|
||||||
SDL_DestroyTexture(icon_radio_dark_off);
|
|
||||||
SDL_DestroyTexture(icon_radio_on);
|
|
||||||
SDL_DestroyTexture(icon_radio_off);
|
|
||||||
SDL_DestroyTexture(icon_secure_dark);
|
|
||||||
SDL_DestroyTexture(icon_sd_dark);
|
|
||||||
SDL_DestroyTexture(icon_settings_dark);
|
|
||||||
SDL_DestroyTexture(icon_secure);
|
|
||||||
SDL_DestroyTexture(icon_sd);
|
|
||||||
SDL_DestroyTexture(icon_settings);
|
|
||||||
SDL_DestroyTexture(bg_header);
|
|
||||||
SDL_DestroyTexture(properties_dialog_dark);
|
|
||||||
SDL_DestroyTexture(options_dialog_dark);
|
|
||||||
SDL_DestroyTexture(dialog_dark);
|
|
||||||
SDL_DestroyTexture(properties_dialog);
|
|
||||||
SDL_DestroyTexture(options_dialog);
|
|
||||||
SDL_DestroyTexture(dialog);
|
|
||||||
SDL_DestroyTexture(icon_uncheck_dark);
|
|
||||||
SDL_DestroyTexture(icon_uncheck);
|
|
||||||
SDL_DestroyTexture(icon_check_dark);
|
|
||||||
SDL_DestroyTexture(icon_check);
|
|
||||||
SDL_DestroyTexture(icon_text);
|
|
||||||
SDL_DestroyTexture(icon_image);
|
|
||||||
SDL_DestroyTexture(icon_file);
|
|
||||||
SDL_DestroyTexture(icon_doc);
|
|
||||||
SDL_DestroyTexture(icon_dir_dark);
|
|
||||||
SDL_DestroyTexture(icon_dir);
|
|
||||||
SDL_DestroyTexture(icon_audio);
|
|
||||||
SDL_DestroyTexture(icon_archive);
|
|
||||||
SDL_DestroyTexture(icon_app);*/
|
|
||||||
}
|
}
|