Permalink
Browse files

[FIX] #995 for All platforms and removed the icons folder in source p…

…ackage (#1057)

* Fixed the icon file not found error for windows and linux.

* Optimized distribution of icons and removed CSW dependency while running GUI

* Font and icons are now loaded directly from memory

* Added source icons and icons to C array convertor
  • Loading branch information...
ShouryaAggarwal authored and cfsmp3 committed Dec 25, 2018
1 parent ebcd2bc commit fbf99e8a5e305bfdc596693dd475d9215f3b1c00
Showing with 27,879 additions and 39 deletions.
  1. +26 −38 src/GUI/ccextractorGUI.c
  2. +1 −1 src/GUI/file_browser.h
  3. +27,786 −0 src/GUI/icon_data.c
  4. +66 −0 tools/icons2c.c
@@ -8,7 +8,7 @@
#include <assert.h>
#include <math.h>
#include <limits.h>
#include <time.h>
#include <time.h>

#include <GL/glew.h>
#include <GLFW/glfw3.h>
@@ -31,6 +31,8 @@
#include "nuklear_lib/nuklear.h"
#include "nuklear_lib/nuklear_glfw_gl2.h"

#include "icon_data.c"


//#define WINDOW_WIDTH 1200
//#define WINDOW_HEIGHT 800
@@ -202,15 +204,9 @@ int main(void)
ctx = nk_glfw3_init(win, NK_GLFW3_INSTALL_CALLBACKS);
struct nk_font_atlas *font_atlas;
nk_glfw3_font_stash_begin(&font_atlas);
#ifdef _WIN32
struct nk_font *droid = nk_font_atlas_add_from_file(font_atlas, "../../fonts/Roboto-Regular.ttf", 16, 0);
struct nk_font *droid_big = nk_font_atlas_add_from_file(font_atlas, "../../fonts/Roboto-Regular.ttf", 25, 0);
struct nk_font *droid_head = nk_font_atlas_add_from_file(font_atlas, "../../fonts/Roboto-Regular.ttf", 20, 0);
#else
struct nk_font *droid = nk_font_atlas_add_from_file(font_atlas, "../fonts/Roboto-Regular.ttf", 16, 0);
struct nk_font *droid_big = nk_font_atlas_add_from_file(font_atlas, "../fonts/Roboto-Regular.ttf", 25, 0);
struct nk_font *droid_head = nk_font_atlas_add_from_file(font_atlas, "../fonts/Roboto-Regular.ttf", 20, 0);
#endif
struct nk_font *droid = nk_font_atlas_add_from_memory(font_atlas, roboto_regular_font, sizeof(roboto_regular_font), 16, 0);
struct nk_font *droid_big = nk_font_atlas_add_from_memory(font_atlas, roboto_regular_font, sizeof(roboto_regular_font), 25, 0);
struct nk_font *droid_head = nk_font_atlas_add_from_memory(font_atlas, roboto_regular_font, sizeof(roboto_regular_font), 20, 0);
nk_glfw3_font_stash_end();
nk_style_set_font(ctx, &droid->handle);

@@ -247,30 +243,20 @@ int main(void)

/* icons */

#ifdef _WIN32
media.icons.home = icon_load("../../icon/home.png");
media.icons.directory = icon_load("../../icon/directory.png");
media.icons.computer = icon_load("../../icon/computer.png");
media.icons.drives = icon_load("../../icon/drive.png");
media.icons.desktop = icon_load("../../icon/desktop.png");
media.icons.default_file = icon_load("../../icon/default.png");
media.icons.text_file = icon_load("../../icon/text.png");
media.icons.music_file = icon_load("../../icon/music.png");
media.icons.font_file = icon_load("../../icon/font.png");
media.icons.img_file = icon_load("../../icon/img.png");
media.icons.movie_file = icon_load("../../icon/movie.png");
#else
media.icons.home = icon_load("../icon/home.png");
media.icons.directory = icon_load("../icon/directory.png");
media.icons.computer = icon_load("../icon/computer.png");
media.icons.desktop = icon_load("../icon/desktop.png");
media.icons.default_file = icon_load("../icon/default.png");
media.icons.text_file = icon_load("../icon/text.png");
media.icons.music_file = icon_load("../icon/music.png");
media.icons.font_file = icon_load("../icon/font.png");
media.icons.img_file = icon_load("../icon/img.png");
media.icons.movie_file = icon_load("../icon/movie.png");
#endif
media.icons.home = icon_load(home_icon_data, sizeof(home_icon_data));
media.icons.directory = icon_load(directory_icon_data, sizeof(directory_icon_data));
media.icons.computer = icon_load(computer_icon_data, sizeof(computer_icon_data));
#ifdef _WIN32
media.icons.drives = icon_load(drive_icon_data, sizeof(drive_icon_data));
#endif
media.icons.desktop = icon_load(desktop_icon_data, sizeof(desktop_icon_data));
media.icons.default_file = icon_load(default_icon_data, sizeof(default_icon_data));
media.icons.text_file = icon_load(text_icon_data, sizeof(text_icon_data));
media.icons.music_file = icon_load(music_icon_data, sizeof(music_icon_data));
media.icons.font_file = icon_load(font_icon_data, sizeof(font_icon_data));
media.icons.img_file = icon_load(img_icon_data, sizeof(img_icon_data));
media.icons.movie_file = icon_load(movie_icon_data, sizeof(movie_icon_data));


media_init(&media);

@@ -898,13 +884,15 @@ void remove_path_entry(struct main_tab *main_settings, int indexToRemove)

}


struct nk_image
icon_load(const char *filename)
icon_load(char icon_data[], int len)
{
int x,y,n;
GLuint tex;
unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
if (!data) die("[SDL]: failed to load image: %s", filename);

unsigned char *data = stbi_load_from_memory(icon_data, len, &x, &y, &n, 0);
if (!data) die("[SDL]: failed to load icons");

glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
@@ -926,4 +914,4 @@ char* concat(char* string1, char *string2)
strcpy(prefix, string1);
strcpy(suffix, string2);
return strcat(prefix, suffix);
}
}
@@ -154,6 +154,6 @@ file_browser_run(struct file_browser *browser,
struct hd_homerun_tab *hd_homerun);

struct nk_image
icon_load(const char *filename);
icon_load(char icon_data[], int len);

#endif
Oops, something went wrong.

0 comments on commit fbf99e8

Please sign in to comment.