2020-09-20 00:19:39 +02:00
|
|
|
#include <gui/icons.h>
|
2020-10-07 22:44:54 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <GL/glew.h>
|
|
|
|
#include <config.h>
|
2020-12-22 14:50:26 +01:00
|
|
|
#include <options.h>
|
2020-07-19 15:59:44 +02:00
|
|
|
|
|
|
|
#define STB_IMAGE_IMPLEMENTATION
|
|
|
|
#include <imgui/stb_image.h>
|
|
|
|
|
|
|
|
namespace icons {
|
2020-07-19 18:09:59 +02:00
|
|
|
ImTextureID LOGO;
|
2020-07-19 15:59:44 +02:00
|
|
|
ImTextureID PLAY;
|
|
|
|
ImTextureID STOP;
|
2020-08-21 15:34:50 +02:00
|
|
|
ImTextureID MENU;
|
2020-11-30 16:05:51 +01:00
|
|
|
ImTextureID MUTED;
|
|
|
|
ImTextureID UNMUTED;
|
2020-12-08 16:27:52 +01:00
|
|
|
ImTextureID NORMAL_TUNING;
|
|
|
|
ImTextureID CENTER_TUNING;
|
2020-07-19 15:59:44 +02:00
|
|
|
|
2020-09-06 15:39:09 +02:00
|
|
|
GLuint loadTexture(std::string path) {
|
2020-07-19 15:59:44 +02:00
|
|
|
int w,h,n;
|
2020-09-20 01:36:25 +02:00
|
|
|
stbi_uc* data = stbi_load(path.c_str(), &w, &h, &n, 0);
|
2020-07-19 15:59:44 +02:00
|
|
|
GLuint texId;
|
|
|
|
glGenTextures(1, &texId);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, texId);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (uint8_t*)data);
|
|
|
|
stbi_image_free(data);
|
|
|
|
return texId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void load() {
|
2020-12-22 14:50:26 +01:00
|
|
|
LOGO = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/sdrpp.png");
|
|
|
|
PLAY = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/play.png");
|
|
|
|
STOP = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/stop.png");
|
|
|
|
MENU = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/menu.png");
|
|
|
|
MUTED = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/muted.png");
|
|
|
|
UNMUTED = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/unmuted.png");
|
|
|
|
NORMAL_TUNING = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/normal_tuning.png");
|
|
|
|
CENTER_TUNING = (ImTextureID)(uintptr_t)loadTexture(options::opts.root + "/res/icons/center_tuning.png");
|
2020-07-19 15:59:44 +02:00
|
|
|
}
|
|
|
|
}
|