mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Merge branch 'master' into kiosk-mode-setting
This commit is contained in:
commit
cc3d2b0084
2
.gitignore
vendored
2
.gitignore
vendored
@ -110,3 +110,5 @@ obj-unix/
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.obj
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.res
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.pdb
|
||||
|
||||
retroarch.cfg
|
||||
|
@ -5,6 +5,7 @@
|
||||
- GUI: (XMB) Skip drawing the fading list when it is already transparent. Optimization.
|
||||
- GUI: (XMB) Comment out visible item calculation in xmb_draw_items().
|
||||
- GUI: (RGUI) Prevent crashes when using a non-English language reliant on UTF8.
|
||||
- GUI: Add option for OSD background color.
|
||||
- INPUT: Always show the controls menu even if descriptors are not set
|
||||
- INPUT: Fix input descriptors not being set on cores that don't implement the controllers interface
|
||||
- INPUT: Apply descriptors only for the amount of cores the core supports
|
||||
@ -111,7 +112,7 @@ Skipped this one.
|
||||
- VITA: Add cheevos support
|
||||
- VITA: Add support for external USB if mounted
|
||||
- WAYLAND: Fix menu mouse input
|
||||
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter'
|
||||
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter
|
||||
|
||||
# 1.6.0
|
||||
- ANDROID: Allow remotes to retain OK/Cancel position when menu_swap_ok_cancel is enabled
|
||||
|
@ -729,10 +729,7 @@ endif
|
||||
ifeq ($(HAVE_NUKLEAR), 1)
|
||||
OBJ += menu/drivers/nuklear/nk_common.o
|
||||
OBJ += menu/drivers/nuklear/nk_menu.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_main.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_file_picker.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_shader_parameters.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_settings.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_debug.o
|
||||
OBJ += menu/drivers/nuklear.o
|
||||
DEFINES += -DHAVE_NUKLEAR
|
||||
endif
|
||||
|
@ -375,6 +375,12 @@ static const float message_pos_offset_y = 0.05;
|
||||
* RGB hex value. */
|
||||
static const uint32_t message_color = 0xffff00;
|
||||
|
||||
static const bool message_bgcolor_enable = false;
|
||||
static const uint32_t message_bgcolor_red = 0;
|
||||
static const uint32_t message_bgcolor_green = 0;
|
||||
static const uint32_t message_bgcolor_blue = 0;
|
||||
static const float message_bgcolor_opacity = 1.0f;
|
||||
|
||||
/* Record post-filtered (CPU filter) video,
|
||||
* rather than raw game output. */
|
||||
static const bool post_filter_record = false;
|
||||
|
@ -1295,6 +1295,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("systemfiles_in_content_dir", &settings->bools.systemfiles_in_content_dir, true, default_systemfiles_in_content_dir, false);
|
||||
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false);
|
||||
|
||||
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
|
||||
|
||||
if (global)
|
||||
{
|
||||
SETTING_BOOL("custom_bgm_enable", &global->console.sound.system_bgm_enable, true, false, false);
|
||||
@ -1333,6 +1335,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
|
||||
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, fastforward_ratio, false);
|
||||
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, slowmotion_ratio, false);
|
||||
SETTING_FLOAT("input_axis_threshold", input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD), true, axis_threshold, false);
|
||||
SETTING_FLOAT("video_msg_bgcolor_opacity", &settings->floats.video_msg_bgcolor_opacity, true, message_bgcolor_opacity, false);
|
||||
|
||||
*size = count;
|
||||
|
||||
@ -1408,6 +1411,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
|
||||
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
|
||||
SETTING_UINT("input_overlay_show_physical_inputs_port", &settings->uints.input_overlay_show_physical_inputs_port, true, 0, false);
|
||||
SETTING_UINT("video_msg_bgcolor_red", &settings->uints.video_msg_bgcolor_red, true, message_bgcolor_red, false);
|
||||
SETTING_UINT("video_msg_bgcolor_green", &settings->uints.video_msg_bgcolor_green, true, message_bgcolor_green, false);
|
||||
SETTING_UINT("video_msg_bgcolor_blue", &settings->uints.video_msg_bgcolor_blue, true, message_bgcolor_blue, false);
|
||||
|
||||
*size = count;
|
||||
|
||||
|
@ -83,6 +83,7 @@ typedef struct settings
|
||||
bool video_shared_context;
|
||||
bool video_force_srgb_disable;
|
||||
bool video_fps_show;
|
||||
bool video_msg_bgcolor_enable;
|
||||
|
||||
/* Audio */
|
||||
bool audio_enable;
|
||||
@ -253,6 +254,7 @@ typedef struct settings
|
||||
float video_msg_color_r;
|
||||
float video_msg_color_g;
|
||||
float video_msg_color_b;
|
||||
float video_msg_bgcolor_opacity;
|
||||
|
||||
float menu_wallpaper_opacity;
|
||||
float menu_framebuffer_opacity;
|
||||
@ -321,6 +323,9 @@ typedef struct settings
|
||||
unsigned video_viwidth;
|
||||
unsigned video_aspect_ratio_idx;
|
||||
unsigned video_rotation;
|
||||
unsigned video_msg_bgcolor_red;
|
||||
unsigned video_msg_bgcolor_green;
|
||||
unsigned video_msg_bgcolor_blue;
|
||||
|
||||
unsigned menu_thumbnails;
|
||||
unsigned menu_dpi_override_value;
|
||||
|
3245
deps/nuklear/nuklear.h
vendored
3245
deps/nuklear/nuklear.h
vendored
File diff suppressed because it is too large
Load Diff
130
gfx/drivers/gl.c
130
gfx/drivers/gl.c
@ -941,6 +941,129 @@ static void gl_set_texture_enable(void *data, bool state, bool full_screen)
|
||||
gl->menu_texture_full_screen = full_screen;
|
||||
}
|
||||
|
||||
static void gl_render_osd_background(
|
||||
gl_t *gl, video_frame_info_t *video_info,
|
||||
const char *msg)
|
||||
{
|
||||
video_shader_ctx_mvp_t mvp;
|
||||
video_shader_ctx_coords_t coords_data;
|
||||
video_coords_t coords;
|
||||
video_coord_array_t ca;
|
||||
video_shader_ctx_info_t shader_info;
|
||||
struct uniform_info uniform_param;
|
||||
const unsigned vertices_total = 6;
|
||||
float colors[4];
|
||||
float *dummy = (float*)calloc(4 * vertices_total, sizeof(float));
|
||||
float *verts = (float*)malloc(2 * vertices_total * sizeof(float));
|
||||
int msg_width;
|
||||
float x, x2, y, y2, width, height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!gl || !settings)
|
||||
goto end;
|
||||
|
||||
msg_width = font_driver_get_message_width(NULL, msg, strlen(msg), 1.0f);
|
||||
|
||||
/* shader driver expects vertex coords as 0..1 */
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
width = msg_width / (float)video_info->width;
|
||||
height = settings->floats.video_font_size / (float)video_info->height;
|
||||
|
||||
x2 = 0.005f; /* extend background around text */
|
||||
y2 = 0.005f;
|
||||
|
||||
x -= x2;
|
||||
y -= y2;
|
||||
width += x2;
|
||||
height += y2;
|
||||
|
||||
colors[0] = settings->uints.video_msg_bgcolor_red / 255.0f;
|
||||
colors[1] = settings->uints.video_msg_bgcolor_green / 255.0f;
|
||||
colors[2] = settings->uints.video_msg_bgcolor_blue / 255.0f;
|
||||
colors[3] = settings->floats.video_msg_bgcolor_opacity;
|
||||
|
||||
/* triangle 1 */
|
||||
verts[0] = x;
|
||||
verts[1] = y; /* bottom-left */
|
||||
|
||||
verts[2] = x;
|
||||
verts[3] = y + height; /* top-left */
|
||||
|
||||
verts[4] = x + width;
|
||||
verts[5] = y + height; /* top-right */
|
||||
|
||||
/* triangle 2 */
|
||||
verts[6] = x;
|
||||
verts[7] = y; /* bottom-left */
|
||||
|
||||
verts[8] = x + width;
|
||||
verts[9] = y + height; /* top-right */
|
||||
|
||||
verts[10] = x + width;
|
||||
verts[11] = y; /* bottom-right */
|
||||
|
||||
coords.color = dummy;
|
||||
coords.vertex = verts;
|
||||
coords.tex_coord = dummy;
|
||||
coords.lut_tex_coord = dummy;
|
||||
coords.vertices = vertices_total;
|
||||
|
||||
coords_data.handle_data = NULL;
|
||||
coords_data.data = &coords;
|
||||
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_driver_set_viewport(video_info->width, video_info->height, true, false);
|
||||
|
||||
video_shader_driver_use(shader_info);
|
||||
video_shader_driver_set_coords(coords_data);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
mvp.data = gl;
|
||||
mvp.matrix = &gl->mvp_no_rot;
|
||||
|
||||
video_shader_driver_set_mvp(mvp);
|
||||
|
||||
uniform_param.type = UNIFORM_4F;
|
||||
uniform_param.enabled = true;
|
||||
uniform_param.location = 0;
|
||||
uniform_param.count = 0;
|
||||
|
||||
uniform_param.lookup.type = SHADER_PROGRAM_FRAGMENT;
|
||||
uniform_param.lookup.ident = "bgcolor";
|
||||
uniform_param.lookup.idx = shader_info.idx;
|
||||
uniform_param.lookup.add_prefix = true;
|
||||
uniform_param.lookup.enable = true;
|
||||
|
||||
uniform_param.result.f.v0 = colors[0];
|
||||
uniform_param.result.f.v1 = colors[1];
|
||||
uniform_param.result.f.v2 = colors[2];
|
||||
uniform_param.result.f.v3 = colors[3];
|
||||
|
||||
video_shader_driver_set_parameter(uniform_param);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, coords.vertices);
|
||||
end:
|
||||
/* reset uniform back to zero so it is not used for anything else */
|
||||
uniform_param.result.f.v0 = 0.0f;
|
||||
uniform_param.result.f.v1 = 0.0f;
|
||||
uniform_param.result.f.v2 = 0.0f;
|
||||
uniform_param.result.f.v3 = 0.0f;
|
||||
|
||||
video_shader_driver_set_parameter(uniform_param);
|
||||
|
||||
free(dummy);
|
||||
free(verts);
|
||||
|
||||
video_driver_set_viewport(video_info->width, video_info->height, false, true);
|
||||
}
|
||||
|
||||
static void gl_set_osd_msg(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
const char *msg,
|
||||
@ -1068,8 +1191,9 @@ static bool gl_frame(void *data, const void *frame,
|
||||
gl_t *gl = (gl_t*)data;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!gl)
|
||||
if (!gl || !settings)
|
||||
return false;
|
||||
|
||||
context_bind_hw_render(false);
|
||||
@ -1244,7 +1368,11 @@ static bool gl_frame(void *data, const void *frame,
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(msg))
|
||||
{
|
||||
if (settings->bools.video_msg_bgcolor_enable)
|
||||
gl_render_osd_background(gl, video_info, msg);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (gl && gl->overlay_enable)
|
||||
|
@ -2,11 +2,15 @@
|
||||
|
||||
static const char *stock_fragment_core_blend = GLSL(
|
||||
uniform sampler2D Texture;
|
||||
uniform vec4 bgcolor;
|
||||
in vec2 tex_coord;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main() {
|
||||
FragColor = color * texture(Texture, tex_coord);
|
||||
if (bgcolor.a > 0.0)
|
||||
FragColor = bgcolor;
|
||||
else
|
||||
FragColor = color * texture(Texture, tex_coord);
|
||||
}
|
||||
);
|
||||
|
@ -2,9 +2,13 @@
|
||||
|
||||
static const char *stock_fragment_modern_blend = GLSL(
|
||||
uniform sampler2D Texture;
|
||||
uniform vec4 bgcolor;
|
||||
varying vec2 tex_coord;
|
||||
varying vec4 color;
|
||||
void main() {
|
||||
gl_FragColor = color * texture2D(Texture, tex_coord);
|
||||
if (bgcolor.a > 0.0)
|
||||
gl_FragColor = bgcolor;
|
||||
else
|
||||
gl_FragColor = color * texture2D(Texture, tex_coord);
|
||||
}
|
||||
);
|
||||
|
@ -475,7 +475,7 @@ static void gl_raster_font_render_msg(
|
||||
else
|
||||
gl_raster_font_setup_viewport(width, height, font, full_screen);
|
||||
|
||||
if (!string_is_empty(msg) && font->gl
|
||||
if (!string_is_empty(msg) && font->gl
|
||||
&& font->font_data && font->font_driver)
|
||||
{
|
||||
if (drop_x || drop_y)
|
||||
|
@ -75,7 +75,7 @@ bool video_coord_array_append(video_coord_array_t *ca,
|
||||
base_size = count * sizeof(float);
|
||||
offset = ca->coords.vertices;
|
||||
|
||||
/* XXX: I wish we used interlaced arrays so
|
||||
/* XXX: I wish we used interlaced arrays so
|
||||
* we could call memcpy only once. */
|
||||
memcpy(ca->coords.vertex + offset * 2,
|
||||
coords->vertex, base_size * 2);
|
||||
|
@ -1113,10 +1113,7 @@ MENU
|
||||
#ifdef HAVE_NUKLEAR
|
||||
#include "../menu/drivers/nuklear/nk_common.c"
|
||||
#include "../menu/drivers/nuklear/nk_menu.c"
|
||||
#include "../menu/drivers/nuklear/nk_wnd_shader_parameters.c"
|
||||
#include "../menu/drivers/nuklear/nk_wnd_file_picker.c"
|
||||
#include "../menu/drivers/nuklear/nk_wnd_settings.c"
|
||||
#include "../menu/drivers/nuklear/nk_wnd_main.c"
|
||||
#include "../menu/drivers/nuklear/nk_wnd_debug.c"
|
||||
#include "../menu/drivers/nuklear.c"
|
||||
#endif
|
||||
|
||||
|
@ -610,9 +610,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT,
|
||||
"コンテンツをダウンロード")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE,
|
||||
"DPI Override Enable")
|
||||
"DPI優先を有効")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE,
|
||||
"DPI Override")
|
||||
"DPI優先")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS,
|
||||
"ドライバ")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN,
|
||||
@ -964,9 +964,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW,
|
||||
"黄色")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_FOOTER_OPACITY,
|
||||
"Footer Opacity")
|
||||
"フッター不透明性")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY,
|
||||
"Header Opacity")
|
||||
"ヘッダー不透明性")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DRIVER,
|
||||
"メニューのドライバ")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE,
|
||||
@ -3016,11 +3016,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER,
|
||||
MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN,
|
||||
"コンテンツをスキャンするための準備中")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
"コアを削除")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
"コアをハードディスクから削除する。")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
"エントリーの名前を変更する")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
@ -3028,23 +3028,23 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Modify the opacity of the framebuffer.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES,
|
||||
"Favorites")
|
||||
"お気に入り")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES,
|
||||
"Content which you have added to 'Favorites' will appear here.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_MUSIC,
|
||||
"Music")
|
||||
"音楽")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_MUSIC,
|
||||
"Music which has been previously played will appear here.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_IMAGES,
|
||||
"Image")
|
||||
"画像")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_IMAGES,
|
||||
"Images which have been previously viewed will appear here.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_VIDEO,
|
||||
"Video")
|
||||
"ビデオ")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_VIDEO,
|
||||
"Videos which have been previously played will appear here.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
"メニューのアイコン")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
@ -3066,81 +3066,93 @@ MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"エントリーの名前変更を許す")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE,
|
||||
"Show Load Core")
|
||||
"「コアをロード」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE,
|
||||
"Show/hide the 'Load Core' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT,
|
||||
"Show Load Content")
|
||||
"「コンテンツをロード」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT,
|
||||
"Show/hide the 'Load Content' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION,
|
||||
"Show Information")
|
||||
"「情報」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION,
|
||||
"Show/hide the 'Information' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS,
|
||||
"Show Configurations")
|
||||
"「設定ファイル」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS,
|
||||
"Show/hide the 'Configurations' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP,
|
||||
"Show Help")
|
||||
"「ヘルプ」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP,
|
||||
"Show/hide the 'Help' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH,
|
||||
"Show Quit RetroArch")
|
||||
"「終了」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH,
|
||||
"Show/hide the 'Quit RetroArch' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT,
|
||||
"Show Reboot")
|
||||
"「再起動」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT,
|
||||
"Show/hide the 'Reboot' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS,
|
||||
"Quick Menu")
|
||||
"クイックメニュー")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS,
|
||||
"Show or hide elements on the Quick Menu screen.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT,
|
||||
"Show Take Screenshot")
|
||||
"「スクリーンショットを撮る」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT,
|
||||
"Show/hide the 'Take Screenshot' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE,
|
||||
"Show Save/Load State")
|
||||
"「状態保存」と「保存状態をロード」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE,
|
||||
"Show/hide the options for saving/loading state.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE,
|
||||
"Show Undo Save/Load State")
|
||||
"「保存状態のロードを前に戻す」と「状態の保存を前に戻す」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE,
|
||||
"Show/hide the options for undoing save/load state.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES,
|
||||
"Show Add to Favorites")
|
||||
"「お気に入りに追加」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES,
|
||||
"Show/hide the 'Add to Favorites' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS,
|
||||
"Show Options")
|
||||
"「オプション」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS,
|
||||
"Show/hide the 'Options' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS,
|
||||
"Show Controls")
|
||||
"「コントロール」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS,
|
||||
"Show/hide the 'Controls' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS,
|
||||
"Show Cheats")
|
||||
"「チート」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS,
|
||||
"Show/hide the 'Cheats' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS,
|
||||
"Show Shaders")
|
||||
"「シェーダー」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS,
|
||||
"Show/hide the 'Shaders' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES,
|
||||
"Show Save Core Overrides")
|
||||
"「コアの優先を保存」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES,
|
||||
"Show/hide the 'Save Core Overrides' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES,
|
||||
"Show Save Game Overrides")
|
||||
"「ゲームの優先を保存」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES,
|
||||
"Show/hide the 'Save Game Overrides' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION,
|
||||
"Show Information")
|
||||
"「情報」を表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION,
|
||||
"Show/hide the 'Information' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
"OSDメッセージ背景を有効")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
"OSDメッセージ背景の赤色値")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
"OSDメッセージ背景の緑色値")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
"OSDメッセージ背景の青色値")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
"OSDメッセージ背景の不透明性")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
|
||||
"お気に入りに追加")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE,
|
||||
"Disable Kiosk Mode")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE,
|
||||
@ -3159,3 +3171,4 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
|
@ -1349,3 +1349,14 @@ MSG_HASH(MENU_ENUM_LABEL_MENU_DISABLE_KIOSK_MODE,
|
||||
"menu_disable_kiosk_mode")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_KIOSK_MODE_PASSWORD,
|
||||
"menu_disable_kiosk_mode_password")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
"video_msg_bgcolor_enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
"video_msg_bgcolor_red")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
"video_msg_bgcolor_green")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
"video_msg_bgcolor_blue")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
"video_msg_bgcolor_opacity")
|
||||
|
@ -1991,6 +1991,26 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU)
|
||||
);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE:
|
||||
snprintf(s, len,
|
||||
"Enables a background color for the OSD.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED:
|
||||
snprintf(s, len,
|
||||
"Sets the red value of the OSD background color. Valid values are between 0 and 255.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN:
|
||||
snprintf(s, len,
|
||||
"Sets the green value of the OSD background color. Valid values are between 0 and 255.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE:
|
||||
snprintf(s, len,
|
||||
"Sets the blue value of the OSD background color. Valid values are between 0 and 255.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY:
|
||||
snprintf(s, len,
|
||||
"Sets the opacity of the OSD background color. Valid values are between 0.0 and 1.0.");
|
||||
break;
|
||||
default:
|
||||
if (string_is_empty(s))
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len);
|
||||
|
@ -3227,6 +3227,16 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION,
|
||||
"Show Information")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION,
|
||||
"Show/hide the 'Information' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
"Onscreen Notification Background Enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
"Onscreen Notification Background Red Color")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
"Onscreen Notification Background Green Color")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
"Onscreen Notification Background Blue Color")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
"Onscreen Notification Background Opacity")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE,
|
||||
"Disable Kiosk Mode")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE,
|
||||
|
@ -52,8 +52,8 @@ static void nk_menu_init_device(nk_menu_handle_t *nk)
|
||||
int w, h;
|
||||
char buf[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
fill_pathname_join(buf, nk->assets_directory,
|
||||
"DroidSans.ttf", sizeof(buf));
|
||||
fill_pathname_join(buf, "assets/nuklear",
|
||||
"font.ttf", sizeof(buf));
|
||||
|
||||
nk_alloc.userdata.ptr = NULL;
|
||||
nk_alloc.alloc = nk_common_mem_alloc;
|
||||
@ -61,91 +61,26 @@ static void nk_menu_init_device(nk_menu_handle_t *nk)
|
||||
nk_buffer_init(&device.cmds, &nk_alloc, 1024);
|
||||
nk_font_atlas_init_default(&atlas);
|
||||
nk_font_atlas_begin(&atlas);
|
||||
font = nk_font_atlas_add_default(&atlas, 13.0f, NULL);
|
||||
|
||||
struct nk_font *font;
|
||||
|
||||
font = nk_font_atlas_add_from_file(&atlas, buf, 16, 0);
|
||||
image = nk_font_atlas_bake(&atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
|
||||
device_upload_atlas(&device, image, w, h);
|
||||
nk_upload_atlas(&device, image, w, h);
|
||||
nk_font_atlas_end(&atlas, nk_handle_id((int)device.font_tex), &device.null);
|
||||
nk_init_default(&nk->ctx, &font->handle);
|
||||
|
||||
nk_common_device_init(&device);
|
||||
|
||||
fill_pathname_join(buf, nk->assets_directory, "folder.png", sizeof(buf));
|
||||
nk->icons.folder = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "speaker.png", sizeof(buf));
|
||||
nk->icons.speaker = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "gamepad.png", sizeof(buf));
|
||||
nk->icons.gamepad = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "monitor.png", sizeof(buf));
|
||||
nk->icons.monitor = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "settings.png", sizeof(buf));
|
||||
nk->icons.settings = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "invader.png", sizeof(buf));
|
||||
nk->icons.invader = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "page_on.png", sizeof(buf));
|
||||
nk->icons.page_on = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory, "page_off.png", sizeof(buf));
|
||||
nk->icons.page_off = nk_common_image_load(buf);
|
||||
|
||||
nk->size_changed = true;
|
||||
nk_common_set_style(&nk->ctx, THEME_BLUE);
|
||||
}
|
||||
|
||||
|
||||
#define XMB_RIBBON_ROWS 64
|
||||
#define XMB_RIBBON_COLS 64
|
||||
#define XMB_RIBBON_VERTICES 2*XMB_RIBBON_COLS*XMB_RIBBON_ROWS-2*XMB_RIBBON_COLS
|
||||
|
||||
static void xmb_ribbon_set_vertex(float *ribbon_verts, unsigned idx, unsigned row, unsigned col)
|
||||
{
|
||||
ribbon_verts[idx++] = ((float)col) / (XMB_RIBBON_COLS-1) * 2.0f - 1.0f;
|
||||
ribbon_verts[idx++] = ((float)row) / (XMB_RIBBON_ROWS-1) * 2.0f - 1.0f;
|
||||
}
|
||||
|
||||
static void xmb_init_ribbon(nk_menu_handle_t * xmb)
|
||||
{
|
||||
video_coords_t coords;
|
||||
unsigned vertices_total;
|
||||
unsigned r, c, col;
|
||||
unsigned i = 0;
|
||||
float *ribbon_verts = NULL;
|
||||
float *dummy = NULL;
|
||||
video_coord_array_t *ca = menu_display_get_coords_array();
|
||||
|
||||
vertices_total = XMB_RIBBON_VERTICES;
|
||||
|
||||
dummy = (float*)calloc(4 * vertices_total, sizeof(float));
|
||||
ribbon_verts = (float*)calloc(2 * vertices_total, sizeof(float));
|
||||
|
||||
|
||||
/* Set up vertices */
|
||||
for (r = 0; r < XMB_RIBBON_ROWS - 1; r++)
|
||||
{
|
||||
for (c = 0; c < XMB_RIBBON_COLS; c++)
|
||||
{
|
||||
col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c;
|
||||
xmb_ribbon_set_vertex(ribbon_verts, i, r, col);
|
||||
xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col);
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
|
||||
coords.color = dummy;
|
||||
coords.vertex = ribbon_verts;
|
||||
coords.tex_coord = dummy;
|
||||
coords.lut_tex_coord = dummy;
|
||||
coords.vertices = vertices_total;
|
||||
|
||||
video_coord_array_append(ca, &coords, coords.vertices);
|
||||
|
||||
free(dummy);
|
||||
free(ribbon_verts);
|
||||
nk_common_set_style(&nk->ctx);
|
||||
}
|
||||
|
||||
static void *nk_menu_init(void **userdata, bool video_is_threaded)
|
||||
{
|
||||
#if 1
|
||||
|
||||
unsigned i;
|
||||
#endif
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
nk_menu_handle_t *nk = NULL;
|
||||
menu_handle_t *menu = (menu_handle_t*)
|
||||
@ -170,14 +105,8 @@ static void *nk_menu_init(void **userdata, bool video_is_threaded)
|
||||
"nuklear", sizeof(nk->assets_directory));
|
||||
nk_menu_init_device(nk);
|
||||
|
||||
/* for demo purposes only, opens all windows */
|
||||
#if 1
|
||||
for (i = 0; i < NK_WND_LAST; i++)
|
||||
for (i = 0; i < NK_WND_LAST; i++)
|
||||
nk->window[i].open = true;
|
||||
#else
|
||||
nk->window[NK_WND_MAIN].open = true;
|
||||
#endif
|
||||
xmb_init_ribbon(nk);
|
||||
|
||||
return menu;
|
||||
error:
|
||||
@ -219,8 +148,9 @@ static void nk_menu_input_mouse_movement(struct nk_context *ctx)
|
||||
int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
|
||||
|
||||
nk_input_motion(ctx, mouse_x, mouse_y);
|
||||
nk_input_scroll(ctx, menu_input_mouse_state(MENU_MOUSE_WHEEL_UP) -
|
||||
menu_input_mouse_state(MENU_MOUSE_WHEEL_DOWN));
|
||||
struct nk_vec2 scroll = {0 ,menu_input_mouse_state(MENU_MOUSE_WHEEL_UP) -
|
||||
menu_input_mouse_state(MENU_MOUSE_WHEEL_DOWN)};
|
||||
nk_input_scroll(ctx, scroll);
|
||||
}
|
||||
|
||||
static void nk_menu_input_mouse_button(struct nk_context *ctx)
|
||||
@ -251,42 +181,6 @@ static void nk_menu_get_message(void *data, const char *message)
|
||||
strlcpy(nk->box_message, message, sizeof(nk->box_message));
|
||||
}
|
||||
|
||||
static void nk_draw_bg(
|
||||
nk_menu_handle_t *nk,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
float alpha,
|
||||
uintptr_t texture_id,
|
||||
float *coord_black,
|
||||
float *coord_white)
|
||||
{
|
||||
menu_display_ctx_draw_t draw;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
draw.x = 0;
|
||||
draw.y = 0;
|
||||
draw.texture = texture_id;
|
||||
draw.width = width;
|
||||
draw.height = height;
|
||||
draw.color = &coord_black[0];
|
||||
draw.vertex = NULL;
|
||||
draw.tex_coord = NULL;
|
||||
draw.vertex_count = 4;
|
||||
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||
draw.pipeline.id = 0;
|
||||
|
||||
menu_display_blend_begin();
|
||||
menu_display_set_viewport(video_info->width, video_info->height);
|
||||
|
||||
draw.pipeline.id = VIDEO_SHADER_MENU_5;
|
||||
draw.pipeline.active = false;
|
||||
|
||||
menu_display_draw_pipeline(&draw);
|
||||
menu_display_draw(&draw);
|
||||
menu_display_blend_end();
|
||||
}
|
||||
|
||||
/* this is the main control function, it opens and closes windows and will
|
||||
control the logic of the whole menu driver */
|
||||
static void nk_menu_main(nk_menu_handle_t *nk)
|
||||
@ -294,13 +188,8 @@ static void nk_menu_main(nk_menu_handle_t *nk)
|
||||
|
||||
struct nk_context *ctx = &nk->ctx;
|
||||
|
||||
if (nk->window[NK_WND_SETTINGS].open)
|
||||
nk_wnd_settings(nk);
|
||||
|
||||
if (nk->window[NK_WND_SHADER_PARAMETERS].open)
|
||||
nk_wnd_shader_parameters(nk);
|
||||
if (nk->window[NK_WND_MAIN].open)
|
||||
nk_wnd_main(nk, "Demo");
|
||||
if (nk->window[NK_WND_DEBUG].open)
|
||||
nk_wnd_debug(nk);
|
||||
|
||||
nk_buffer_info(&nk->status, &nk->ctx.memory);
|
||||
}
|
||||
@ -352,7 +241,6 @@ static void nk_menu_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
nk_input_end(&nk->ctx);
|
||||
nk_menu_main(nk);
|
||||
nk_draw_bg(nk, video_info, width, height, 0.5, nk->textures.bg, coord_black, coord_white);
|
||||
nk_common_device_draw(&device, &nk->ctx, width, height, NK_ANTI_ALIASING_ON);
|
||||
|
||||
menu_display_draw_cursor(
|
||||
@ -404,7 +292,7 @@ static void nk_menu_context_load_textures(nk_menu_handle_t *nk,
|
||||
{
|
||||
image_texture_load(&ti, path);
|
||||
video_driver_texture_load(&ti,
|
||||
TEXTURE_FILTER_MIPMAP_LINEAR, &nk->textures.pointer);
|
||||
TEXTURE_FILTER_MIPMAP_NEAREST, &nk->textures.pointer);
|
||||
}
|
||||
|
||||
fill_pathname_join(path, iconpath,
|
||||
@ -413,7 +301,7 @@ static void nk_menu_context_load_textures(nk_menu_handle_t *nk,
|
||||
{
|
||||
image_texture_load(&ti, path);
|
||||
video_driver_texture_load(&ti,
|
||||
TEXTURE_FILTER_MIPMAP_LINEAR, &nk->textures.bg);
|
||||
TEXTURE_FILTER_MIPMAP_NEAREST, &nk->textures.bg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ void nk_common_device_init(struct nk_device *dev)
|
||||
dev->attrib_pos = glGetAttribLocation(dev->prog, "Position");
|
||||
dev->attrib_uv = glGetAttribLocation(dev->prog, "TexCoord");
|
||||
dev->attrib_col = glGetAttribLocation(dev->prog, "Color");
|
||||
|
||||
|
||||
glGenBuffers(1, &dev->vbo);
|
||||
glGenBuffers(1, &dev->ebo);
|
||||
glGenVertexArrays(1, &dev->vao);
|
||||
@ -134,7 +134,7 @@ void nk_common_device_init(struct nk_device *dev)
|
||||
#endif
|
||||
}
|
||||
|
||||
void device_upload_atlas(struct nk_device *dev, const void *image, int width, int height)
|
||||
void nk_upload_atlas(struct nk_device *dev, const void *image, int width, int height)
|
||||
{
|
||||
glGenTextures(1, &dev->font_tex);
|
||||
glBindTexture(GL_TEXTURE_2D, dev->font_tex);
|
||||
@ -229,14 +229,19 @@ void nk_common_device_draw(struct nk_device *dev,
|
||||
#endif
|
||||
|
||||
/* fill converting configuration */
|
||||
memset(&config, 0, sizeof(config));
|
||||
|
||||
config.global_alpha = 1.0f;
|
||||
config.shape_AA = AA;
|
||||
config.line_AA = AA;
|
||||
NK_MEMSET(&config, 0, sizeof(config));
|
||||
config.vertex_layout = vertex_layout;
|
||||
config.vertex_size = sizeof(struct nk_vertex);
|
||||
config.vertex_alignment = NK_ALIGNOF(struct nk_vertex);
|
||||
config.null = dev->null;
|
||||
config.circle_segment_count = 22;
|
||||
config.vertex_layout = vertex_layout;
|
||||
config.vertex_size = sizeof(struct nk_vertex);
|
||||
config.curve_segment_count = 22;
|
||||
config.arc_segment_count = 22;
|
||||
config.global_alpha = 1.0f;
|
||||
config.shape_AA = AA;
|
||||
config.line_AA = AA;
|
||||
|
||||
#if 0
|
||||
config.line_thickness = 1.0f;
|
||||
#endif
|
||||
@ -262,7 +267,8 @@ void nk_common_device_draw(struct nk_device *dev,
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)cmd->texture.id);
|
||||
glScissor((GLint)cmd->clip_rect.x,
|
||||
height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h),
|
||||
(GLint)cmd->clip_rect.w, (GLint)cmd->clip_rect.h);
|
||||
(GLint)cmd->clip_rect.w,
|
||||
(GLint)cmd->clip_rect.h);
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count,
|
||||
GL_UNSIGNED_SHORT, offset);
|
||||
#endif
|
||||
|
@ -15,18 +15,26 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This file is intended for backend code. */
|
||||
|
||||
#ifndef _NK_COMMON_H
|
||||
#define _NK_COMMON_H
|
||||
|
||||
/* This file is intended for backend code. */
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
#define NK_INCLUDE_STANDARD_IO
|
||||
#define NK_INCLUDE_STANDARD_VARARGS
|
||||
#define NK_INCLUDE_DEFAULT_ALLOCATOR
|
||||
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
||||
#define NK_INCLUDE_FONT_BAKING
|
||||
#define NK_INCLUDE_DEFAULT_FONT
|
||||
|
||||
#define UNUSED(a) (void)a
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
||||
|
||||
#define MAX_SIZE 256
|
||||
|
||||
#include <string.h>
|
||||
#include "../../../deps/nuklear/nuklear.h"
|
||||
#include "../../../deps/stb/stb_image.h"
|
||||
@ -60,14 +68,13 @@
|
||||
#endif
|
||||
};
|
||||
|
||||
/* generic nuklear members*/
|
||||
extern struct nk_font *font;
|
||||
extern struct nk_font_atlas atlas;
|
||||
extern struct nk_user_font usrfnt;
|
||||
extern struct nk_allocator nk_alloc;
|
||||
extern struct nk_device device;
|
||||
|
||||
enum theme {THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK};
|
||||
|
||||
struct nk_image nk_common_image_load(const char *filename);
|
||||
|
||||
char* nk_common_file_load(const char* path, size_t* size);
|
||||
@ -84,6 +91,8 @@ void* nk_common_mem_alloc(nk_handle a, void *old, nk_size b);
|
||||
|
||||
void nk_common_mem_free(nk_handle unused, void *ptr);
|
||||
|
||||
void device_upload_atlas(struct nk_device *dev, const void *image, int width, int height);
|
||||
void nk_upload_atlas(struct nk_device *dev, const void *image, int width, int height);
|
||||
|
||||
struct nk_image color_bars, test_entry, test_entry2;
|
||||
|
||||
#endif
|
||||
|
@ -15,8 +15,7 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/* This file is intended for helper functions, custom controls, etc. */
|
||||
/* This file is intended for menu functions, custom controls, etc. */
|
||||
|
||||
#include "nk_menu.h"
|
||||
|
||||
@ -37,130 +36,39 @@ void nk_wnd_get_state(nk_menu_handle_t *nk, const int id,
|
||||
}
|
||||
|
||||
/* sets the theme */
|
||||
void nk_common_set_style(struct nk_context *ctx, enum theme theme)
|
||||
{
|
||||
struct nk_color table[NK_COLOR_COUNT];
|
||||
if (theme == THEME_WHITE) {
|
||||
table[NK_COLOR_TEXT] = nk_rgba(70, 70, 70, 255);
|
||||
table[NK_COLOR_WINDOW] = nk_rgba(175, 175, 175, 255);
|
||||
table[NK_COLOR_HEADER] = nk_rgba(175, 175, 175, 255);
|
||||
table[NK_COLOR_BORDER] = nk_rgba(0, 0, 0, 255);
|
||||
table[NK_COLOR_BUTTON] = nk_rgba(185, 185, 185, 255);
|
||||
table[NK_COLOR_BUTTON_HOVER] = nk_rgba(170, 170, 170, 255);
|
||||
table[NK_COLOR_BUTTON_ACTIVE] = nk_rgba(160, 160, 160, 255);
|
||||
table[NK_COLOR_TOGGLE] = nk_rgba(150, 150, 150, 255);
|
||||
table[NK_COLOR_TOGGLE_HOVER] = nk_rgba(120, 120, 120, 255);
|
||||
table[NK_COLOR_TOGGLE_CURSOR] = nk_rgba(175, 175, 175, 255);
|
||||
table[NK_COLOR_SELECT] = nk_rgba(190, 190, 190, 255);
|
||||
table[NK_COLOR_SELECT_ACTIVE] = nk_rgba(175, 175, 175, 255);
|
||||
table[NK_COLOR_SLIDER] = nk_rgba(190, 190, 190, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR] = nk_rgba(80, 80, 80, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR_HOVER] = nk_rgba(70, 70, 70, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR_ACTIVE] = nk_rgba(60, 60, 60, 255);
|
||||
table[NK_COLOR_PROPERTY] = nk_rgba(175, 175, 175, 255);
|
||||
table[NK_COLOR_EDIT] = nk_rgba(150, 150, 150, 255);
|
||||
table[NK_COLOR_EDIT_CURSOR] = nk_rgba(0, 0, 0, 255);
|
||||
table[NK_COLOR_COMBO] = nk_rgba(175, 175, 175, 255);
|
||||
table[NK_COLOR_CHART] = nk_rgba(160, 160, 160, 255);
|
||||
table[NK_COLOR_CHART_COLOR] = nk_rgba(45, 45, 45, 255);
|
||||
table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = nk_rgba( 255, 0, 0, 255);
|
||||
table[NK_COLOR_SCROLLBAR] = nk_rgba(180, 180, 180, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR] = nk_rgba(140, 140, 140, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = nk_rgba(150, 150, 150, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(160, 160, 160, 255);
|
||||
table[NK_COLOR_TAB_HEADER] = nk_rgba(180, 180, 180, 255);
|
||||
nk_style_from_table(ctx, table);
|
||||
} else if (theme == THEME_RED) {
|
||||
table[NK_COLOR_TEXT] = nk_rgba(190, 190, 190, 255);
|
||||
table[NK_COLOR_WINDOW] = nk_rgba(30, 33, 40, 215);
|
||||
table[NK_COLOR_HEADER] = nk_rgba(181, 45, 69, 220);
|
||||
table[NK_COLOR_BORDER] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_BUTTON] = nk_rgba(181, 45, 69, 255);
|
||||
table[NK_COLOR_BUTTON_HOVER] = nk_rgba(190, 50, 70, 255);
|
||||
table[NK_COLOR_BUTTON_ACTIVE] = nk_rgba(195, 55, 75, 255);
|
||||
table[NK_COLOR_TOGGLE] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_TOGGLE_HOVER] = nk_rgba(45, 60, 60, 255);
|
||||
table[NK_COLOR_TOGGLE_CURSOR] = nk_rgba(181, 45, 69, 255);
|
||||
table[NK_COLOR_SELECT] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_SELECT_ACTIVE] = nk_rgba(181, 45, 69, 255);
|
||||
table[NK_COLOR_SLIDER] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR] = nk_rgba(181, 45, 69, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR_HOVER] = nk_rgba(186, 50, 74, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR_ACTIVE] = nk_rgba(191, 55, 79, 255);
|
||||
table[NK_COLOR_PROPERTY] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_EDIT] = nk_rgba(51, 55, 67, 225);
|
||||
table[NK_COLOR_EDIT_CURSOR] = nk_rgba(190, 190, 190, 255);
|
||||
table[NK_COLOR_COMBO] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_CHART] = nk_rgba(51, 55, 67, 255);
|
||||
table[NK_COLOR_CHART_COLOR] = nk_rgba(170, 40, 60, 255);
|
||||
table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = nk_rgba( 255, 0, 0, 255);
|
||||
table[NK_COLOR_SCROLLBAR] = nk_rgba(30, 33, 40, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR] = nk_rgba(64, 84, 95, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = nk_rgba(70, 90, 100, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(75, 95, 105, 255);
|
||||
table[NK_COLOR_TAB_HEADER] = nk_rgba(181, 45, 69, 220);
|
||||
nk_style_from_table(ctx, table);
|
||||
} else if (theme == THEME_BLUE) {
|
||||
table[NK_COLOR_TEXT] = nk_rgba(20, 20, 20, 255);
|
||||
table[NK_COLOR_WINDOW] = nk_rgba(202, 212, 214, 215);
|
||||
table[NK_COLOR_HEADER] = nk_rgba(137, 182, 224, 220);
|
||||
table[NK_COLOR_BORDER] = nk_rgba(140, 159, 173, 255);
|
||||
table[NK_COLOR_BUTTON] = nk_rgba(137, 182, 224, 255);
|
||||
table[NK_COLOR_BUTTON_HOVER] = nk_rgba(142, 187, 229, 255);
|
||||
table[NK_COLOR_BUTTON_ACTIVE] = nk_rgba(147, 192, 234, 255);
|
||||
table[NK_COLOR_TOGGLE] = nk_rgba(177, 210, 210, 255);
|
||||
table[NK_COLOR_TOGGLE_HOVER] = nk_rgba(182, 215, 215, 255);
|
||||
table[NK_COLOR_TOGGLE_CURSOR] = nk_rgba(137, 182, 224, 255);
|
||||
table[NK_COLOR_SELECT] = nk_rgba(177, 210, 210, 255);
|
||||
table[NK_COLOR_SELECT_ACTIVE] = nk_rgba(137, 182, 224, 255);
|
||||
table[NK_COLOR_SLIDER] = nk_rgba(177, 210, 210, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR] = nk_rgba(137, 182, 224, 245);
|
||||
table[NK_COLOR_SLIDER_CURSOR_HOVER] = nk_rgba(142, 188, 229, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR_ACTIVE] = nk_rgba(147, 193, 234, 255);
|
||||
table[NK_COLOR_PROPERTY] = nk_rgba(210, 210, 210, 255);
|
||||
table[NK_COLOR_EDIT] = nk_rgba(210, 210, 210, 225);
|
||||
table[NK_COLOR_EDIT_CURSOR] = nk_rgba(20, 20, 20, 255);
|
||||
table[NK_COLOR_COMBO] = nk_rgba(210, 210, 210, 255);
|
||||
table[NK_COLOR_CHART] = nk_rgba(210, 210, 210, 255);
|
||||
table[NK_COLOR_CHART_COLOR] = nk_rgba(137, 182, 224, 255);
|
||||
table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = nk_rgba( 255, 0, 0, 255);
|
||||
table[NK_COLOR_SCROLLBAR] = nk_rgba(190, 200, 200, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR] = nk_rgba(64, 84, 95, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = nk_rgba(70, 90, 100, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(75, 95, 105, 255);
|
||||
table[NK_COLOR_TAB_HEADER] = nk_rgba(156, 193, 220, 255);
|
||||
nk_style_from_table(ctx, table);
|
||||
} else if (theme == THEME_DARK) {
|
||||
table[NK_COLOR_TEXT] = nk_rgba(210, 210, 210, 255);
|
||||
table[NK_COLOR_WINDOW] = nk_rgba(57, 67, 71, 215);
|
||||
table[NK_COLOR_HEADER] = nk_rgba(51, 51, 56, 220);
|
||||
table[NK_COLOR_BORDER] = nk_rgba(46, 46, 46, 255);
|
||||
table[NK_COLOR_BUTTON] = nk_rgba(48, 83, 111, 255);
|
||||
table[NK_COLOR_BUTTON_HOVER] = nk_rgba(58, 93, 121, 255);
|
||||
table[NK_COLOR_BUTTON_ACTIVE] = nk_rgba(63, 98, 126, 255);
|
||||
table[NK_COLOR_TOGGLE] = nk_rgba(50, 58, 61, 255);
|
||||
table[NK_COLOR_TOGGLE_HOVER] = nk_rgba(45, 53, 56, 255);
|
||||
table[NK_COLOR_TOGGLE_CURSOR] = nk_rgba(48, 83, 111, 255);
|
||||
table[NK_COLOR_SELECT] = nk_rgba(57, 67, 61, 255);
|
||||
table[NK_COLOR_SELECT_ACTIVE] = nk_rgba(48, 83, 111, 255);
|
||||
table[NK_COLOR_SLIDER] = nk_rgba(50, 58, 61, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR] = nk_rgba(48, 83, 111, 245);
|
||||
table[NK_COLOR_SLIDER_CURSOR_HOVER] = nk_rgba(53, 88, 116, 255);
|
||||
table[NK_COLOR_SLIDER_CURSOR_ACTIVE] = nk_rgba(58, 93, 121, 255);
|
||||
table[NK_COLOR_PROPERTY] = nk_rgba(50, 58, 61, 255);
|
||||
table[NK_COLOR_EDIT] = nk_rgba(50, 58, 61, 225);
|
||||
table[NK_COLOR_EDIT_CURSOR] = nk_rgba(210, 210, 210, 255);
|
||||
table[NK_COLOR_COMBO] = nk_rgba(50, 58, 61, 255);
|
||||
table[NK_COLOR_CHART] = nk_rgba(50, 58, 61, 255);
|
||||
table[NK_COLOR_CHART_COLOR] = nk_rgba(48, 83, 111, 255);
|
||||
table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = nk_rgba(255, 0, 0, 255);
|
||||
table[NK_COLOR_SCROLLBAR] = nk_rgba(50, 58, 61, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR] = nk_rgba(48, 83, 111, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = nk_rgba(53, 88, 116, 255);
|
||||
table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(58, 93, 121, 255);
|
||||
table[NK_COLOR_TAB_HEADER] = nk_rgba(48, 83, 111, 255);
|
||||
nk_style_from_table(ctx, table);
|
||||
} else {
|
||||
nk_style_default(ctx);
|
||||
}
|
||||
void nk_common_set_style(struct nk_context *ctx)
|
||||
{
|
||||
/* standard nuklear colors */
|
||||
nk_colors[NK_COLOR_TEXT] = nk_rgba(158, 158, 158, 255);
|
||||
nk_colors[NK_COLOR_WINDOW] = nk_rgba(57, 67, 71, 215);
|
||||
nk_colors[NK_COLOR_HEADER] = nk_rgba(51, 51, 56, 220);
|
||||
nk_colors[NK_COLOR_BORDER] = nk_rgba(46, 46, 46, 255);
|
||||
nk_colors[NK_COLOR_BUTTON] = nk_rgba(255, 112, 67, 255);
|
||||
nk_colors[NK_COLOR_BUTTON_HOVER] = nk_rgba(58, 93, 121, 255);
|
||||
nk_colors[NK_COLOR_BUTTON_ACTIVE] = nk_rgba(63, 98, 126, 255);
|
||||
nk_colors[NK_COLOR_TOGGLE] = nk_rgba(50, 58, 61, 255);
|
||||
nk_colors[NK_COLOR_TOGGLE_HOVER] = nk_rgba(45, 53, 56, 255);
|
||||
nk_colors[NK_COLOR_TOGGLE_CURSOR] = nk_rgba(48, 83, 111, 255);
|
||||
nk_colors[NK_COLOR_SELECT] = nk_rgba(57, 67, 61, 255);
|
||||
nk_colors[NK_COLOR_SELECT_ACTIVE] = nk_rgba(48, 83, 111, 255);
|
||||
nk_colors[NK_COLOR_SLIDER] = nk_rgba(50, 58, 61, 255);
|
||||
nk_colors[NK_COLOR_SLIDER_CURSOR] = nk_rgba(48, 83, 111, 245);
|
||||
nk_colors[NK_COLOR_SLIDER_CURSOR_HOVER] = nk_rgba(53, 88, 116, 255);
|
||||
nk_colors[NK_COLOR_SLIDER_CURSOR_ACTIVE] = nk_rgba(58, 93, 121, 255);
|
||||
nk_colors[NK_COLOR_PROPERTY] = nk_rgba(50, 58, 61, 255);
|
||||
nk_colors[NK_COLOR_EDIT] = nk_rgba(50, 58, 61, 225);
|
||||
nk_colors[NK_COLOR_EDIT_CURSOR] = nk_rgba(210, 210, 210, 255);
|
||||
nk_colors[NK_COLOR_COMBO] = nk_rgba(50, 58, 61, 255);
|
||||
nk_colors[NK_COLOR_CHART] = nk_rgba(50, 58, 61, 255);
|
||||
nk_colors[NK_COLOR_CHART_COLOR] = nk_rgba(48, 83, 111, 255);
|
||||
nk_colors[NK_COLOR_CHART_COLOR_HIGHLIGHT] = nk_rgba(255, 0, 0, 255);
|
||||
nk_colors[NK_COLOR_SCROLLBAR] = nk_rgba(50, 58, 61, 0);
|
||||
nk_colors[NK_COLOR_SCROLLBAR_CURSOR] = nk_rgba(48, 83, 111, 0);
|
||||
nk_colors[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = nk_rgba(53, 88, 116, 50);
|
||||
nk_colors[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(58, 93, 121, 100);
|
||||
nk_colors[NK_COLOR_TAB_HEADER] = nk_rgba(48, 83, 111, 255);
|
||||
nk_style_from_table(ctx, nk_colors);
|
||||
|
||||
/* style */
|
||||
ctx->style.button.text_alignment = NK_TEXT_ALIGN_CENTERED;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This file is intended for helper functions, custom controls, etc. */
|
||||
/* This file is intended for menu functions, custom controls, etc. */
|
||||
|
||||
#ifndef _NK_MENU_H
|
||||
#define _NK_MENU_H
|
||||
@ -27,10 +27,7 @@
|
||||
|
||||
enum
|
||||
{
|
||||
NK_WND_MAIN = 0,
|
||||
NK_WND_SETTINGS,
|
||||
NK_WND_FILE_PICKER,
|
||||
NK_WND_SHADER_PARAMETERS,
|
||||
NK_WND_DEBUG = 0,
|
||||
NK_WND_LAST
|
||||
};
|
||||
|
||||
@ -80,14 +77,13 @@ typedef struct nk_menu_handle
|
||||
video_font_raster_block_t list_block;
|
||||
} nk_menu_handle_t;
|
||||
|
||||
void nk_wnd_shader_parameters(nk_menu_handle_t *nk);
|
||||
void nk_wnd_main(nk_menu_handle_t *nk, const char* title);
|
||||
bool nk_wnd_file_picker(nk_menu_handle_t *nk, char* title, char* in, char* out, char* filter);
|
||||
void nk_wnd_settings(nk_menu_handle_t *nk);
|
||||
struct nk_color nk_colors[NK_COLOR_COUNT];
|
||||
|
||||
void nk_wnd_debug(nk_menu_handle_t *nk);
|
||||
void nk_wnd_set_state(nk_menu_handle_t *nk, const int id,
|
||||
struct nk_vec2 pos, struct nk_vec2 size);
|
||||
void nk_wnd_get_state(nk_menu_handle_t *nk, const int id,
|
||||
struct nk_vec2 *pos, struct nk_vec2 *size);
|
||||
void nk_common_set_style(struct nk_context *ctx, enum theme theme);
|
||||
void nk_common_set_style(struct nk_context *ctx);
|
||||
|
||||
#endif
|
||||
|
@ -33,17 +33,17 @@
|
||||
#include "../../../configuration.h"
|
||||
#include "../../../retroarch.h"
|
||||
|
||||
void nk_wnd_shader_parameters(nk_menu_handle_t *nk)
|
||||
void nk_wnd_debug(nk_menu_handle_t *nk)
|
||||
{
|
||||
unsigned i;
|
||||
video_shader_ctx_t shader_info;
|
||||
struct nk_panel layout;
|
||||
struct nk_context *ctx = &nk->ctx;
|
||||
const int id = NK_WND_SHADER_PARAMETERS;
|
||||
const int id = NK_WND_DEBUG;
|
||||
|
||||
if (nk_begin(ctx, "Shader Parameters", nk_rect(240, 10, 300, 400),
|
||||
if (nk_begin(ctx, "Debug", nk_rect(10, 10, 400, 500),
|
||||
NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE|
|
||||
NK_WINDOW_SCALABLE|NK_WINDOW_BORDER))
|
||||
NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
|
@ -1,157 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Jean-André Santoni
|
||||
* Copyright (C) 2016-2017- Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <lists/dir_list.h>
|
||||
|
||||
#include "nk_menu.h"
|
||||
|
||||
#include "../../menu_driver.h"
|
||||
#include "../../frontend/frontend_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
static bool assets_loaded;
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
|
||||
struct icon_list
|
||||
{
|
||||
struct nk_image disk;
|
||||
struct nk_image folder;
|
||||
struct nk_image file;
|
||||
};
|
||||
|
||||
struct icon_list icons;
|
||||
|
||||
void load_icons(nk_menu_handle_t *nk)
|
||||
{
|
||||
char buf[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
fill_pathname_join(buf, nk->assets_directory,
|
||||
"harddisk.png", sizeof(buf));
|
||||
icons.disk = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory,
|
||||
"folder.png", sizeof(buf));
|
||||
icons.folder = nk_common_image_load(buf);
|
||||
fill_pathname_join(buf, nk->assets_directory,
|
||||
"file.png", sizeof(buf));
|
||||
icons.file = nk_common_image_load(buf);
|
||||
|
||||
assets_loaded = true;
|
||||
}
|
||||
|
||||
bool nk_wnd_file_picker(nk_menu_handle_t *nk, char* title, char* in, char* out, char* filter)
|
||||
{
|
||||
struct nk_panel layout;
|
||||
struct nk_context *ctx = &nk->ctx;
|
||||
const int id = NK_WND_FILE_PICKER;
|
||||
int i = 0;
|
||||
static file_list_t *drives = NULL;
|
||||
static struct string_list *files = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool ret = false;
|
||||
|
||||
if (!drives)
|
||||
{
|
||||
drives = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||
frontend_driver_parse_drive_list(drives, false);
|
||||
}
|
||||
|
||||
if (!string_is_empty(in) && string_is_empty(path))
|
||||
{
|
||||
strlcpy(path, in, sizeof(path));
|
||||
files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false);
|
||||
}
|
||||
|
||||
if (!assets_loaded)
|
||||
load_icons(nk);
|
||||
|
||||
if (nk_begin(ctx, title, nk_rect(10, 10, 500, 400),
|
||||
NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE|
|
||||
NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 30, 4);
|
||||
|
||||
if (drives->size == 0)
|
||||
{
|
||||
if(nk_button_image_label(ctx, icons.disk, "/",
|
||||
NK_TEXT_CENTERED))
|
||||
{
|
||||
fill_pathname_join(path, "/",
|
||||
"", sizeof(path));
|
||||
files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < drives->size; i++)
|
||||
{
|
||||
if(nk_button_image_label(ctx, icons.disk, drives->list[i].path,
|
||||
NK_TEXT_CENTERED))
|
||||
{
|
||||
fill_pathname_join(path, drives->list[i].path,
|
||||
"", sizeof(path));
|
||||
files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
if (files)
|
||||
{
|
||||
for (i = 0; i < files->size; i++)
|
||||
{
|
||||
if (nk_button_image_label(ctx, path_is_directory(files->elems[i].data) ?
|
||||
icons.folder : icons.file, path_basename(files->elems[i].data),
|
||||
NK_TEXT_RIGHT))
|
||||
{
|
||||
strlcpy (path, files->elems[i].data, sizeof(path));
|
||||
if (path_is_directory (path))
|
||||
files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
{
|
||||
if (nk_button_text(ctx, "OK", 2))
|
||||
{
|
||||
ret = true;
|
||||
strlcpy(out, path, sizeof(path));
|
||||
nk->window[NK_WND_FILE_PICKER].open = false;
|
||||
path[0] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* sort the dir list with directories first */
|
||||
dir_list_sort(files, true);
|
||||
|
||||
/* copy the path variable to out*/
|
||||
|
||||
/* save position and size to restore after context reset */
|
||||
nk_wnd_set_state(nk, id, nk_window_get_position(ctx), nk_window_get_size(ctx));
|
||||
nk_end(ctx);
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Jean-André Santoni
|
||||
* Copyright (C) 2016-2017 - Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "nk_menu.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include "../../menu_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
static char* out;
|
||||
static char core[PATH_MAX_LENGTH] = {0};
|
||||
static char content[PATH_MAX_LENGTH] = {0};
|
||||
float ratio[] = {0.85f, 0.15f, 0.0f}; /* TODO: what should this be? */
|
||||
|
||||
void nk_wnd_main(nk_menu_handle_t *nk, const char* title)
|
||||
{
|
||||
unsigned i;
|
||||
video_shader_ctx_t shader_info;
|
||||
struct nk_panel layout;
|
||||
struct nk_context *ctx = &nk->ctx;
|
||||
const int id = NK_WND_MAIN;
|
||||
settings_t *settings = config_get_ptr();
|
||||
char core_basename[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
static char picker_filter[PATH_MAX_LENGTH];
|
||||
static char picker_title[PATH_MAX_LENGTH];
|
||||
static char* picker_startup_dir;
|
||||
|
||||
int len_core, len_content = 0;
|
||||
|
||||
strlcpy(core_basename, path_basename(core), sizeof(core_basename));
|
||||
|
||||
if (!out)
|
||||
out = core;
|
||||
|
||||
if (!string_is_empty(core))
|
||||
len_core = strlen(path_basename(core));
|
||||
if (!string_is_empty(content))
|
||||
len_content = strlen(content);
|
||||
|
||||
if (nk->window[NK_WND_FILE_PICKER].open)
|
||||
{
|
||||
if (nk_wnd_file_picker(nk, picker_title, picker_startup_dir, out, picker_filter))
|
||||
{
|
||||
RARCH_LOG ("%s selected\n", out);
|
||||
nk_window_close(&nk->ctx, picker_title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nk_begin(ctx, title, nk_rect(240, 10, 600, 400),
|
||||
NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE|
|
||||
NK_WINDOW_SCALABLE|NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
nk_label(ctx,"Core:", NK_TEXT_LEFT);
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 30, 3, ratio);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, core_basename, &len_core, 64, nk_filter_default);
|
||||
if (nk_button_text(ctx, "...", 3))
|
||||
{
|
||||
out = core;
|
||||
strlcpy(picker_title, "Select core", sizeof(picker_title));
|
||||
strlcpy(picker_filter, ".dll", sizeof(picker_filter));
|
||||
picker_startup_dir = settings->paths.directory_libretro;
|
||||
nk->window[NK_WND_FILE_PICKER].open = true;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
nk_label(ctx,"Content:", NK_TEXT_LEFT);
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 30, 3, ratio);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, content, &len_content, 64, nk_filter_default);
|
||||
if (nk_button_text(ctx, "...", 3))
|
||||
{
|
||||
out = content;
|
||||
strlcpy(picker_title, "Select content", sizeof(picker_title));
|
||||
strlcpy(picker_filter, ".zip", sizeof(picker_filter));
|
||||
picker_startup_dir = settings->paths.directory_menu_content;
|
||||
nk->window[NK_WND_FILE_PICKER].open = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* save position and size to restore after context reset */
|
||||
nk_wnd_set_state(nk, id, nk_window_get_position(ctx), nk_window_get_size(ctx));
|
||||
nk_end(ctx);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Jean-André Santoni
|
||||
* Copyright (C) 2016-2017 - Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "nk_menu.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include "../../menu_driver.h"
|
||||
|
||||
void nk_wnd_settings(nk_menu_handle_t *nk)
|
||||
{
|
||||
unsigned i;
|
||||
video_shader_ctx_t shader_info;
|
||||
struct nk_panel layout;
|
||||
struct nk_context *ctx = &nk->ctx;
|
||||
const int id = NK_WND_SETTINGS;
|
||||
|
||||
if (nk_begin(ctx, "Settings", nk_rect(240, 10, 300, 400),
|
||||
NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE|
|
||||
NK_WINDOW_SCALABLE|NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
}
|
||||
|
||||
/* save position and size to restore after context reset */
|
||||
nk_wnd_set_state(nk, id, nk_window_get_position(ctx), nk_window_get_size(ctx));
|
||||
nk_end(ctx);
|
||||
}
|
@ -83,6 +83,7 @@ static void menu_display_gl_blend_begin(void)
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
@ -94,6 +95,7 @@ static void menu_display_gl_blend_begin(void)
|
||||
static void menu_display_gl_blend_end(void)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
static void menu_display_gl_viewport(void *data)
|
||||
|
@ -5258,6 +5258,21 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y,
|
||||
PARSE_ONLY_FLOAT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
PARSE_ONLY_BOOL, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
PARSE_ONLY_UINT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
PARSE_ONLY_UINT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
PARSE_ONLY_UINT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
PARSE_ONLY_FLOAT, false);
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
|
@ -4840,6 +4840,75 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.video_msg_bgcolor_enable,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
message_bgcolor_enable,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.video_msg_bgcolor_red,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
message_bgcolor_red,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.video_msg_bgcolor_green,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
message_bgcolor_green,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.video_msg_bgcolor_blue,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
message_bgcolor_blue,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true);
|
||||
|
||||
CONFIG_FLOAT(
|
||||
list, list_info,
|
||||
&settings->floats.video_msg_bgcolor_opacity,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
message_bgcolor_opacity,
|
||||
"%.2f",
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
break;
|
||||
|
@ -628,6 +628,11 @@ enum msg_hash_enums
|
||||
MENU_LABEL(VIDEO_FONT_SIZE),
|
||||
MENU_LABEL(VIDEO_MESSAGE_POS_X),
|
||||
MENU_LABEL(VIDEO_MESSAGE_POS_Y),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_ENABLE),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_RED),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_GREEN),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_BLUE),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_OPACITY),
|
||||
MENU_LABEL(VIDEO_FILTER_FLICKER),
|
||||
MENU_LABEL(VIDEO_SOFT_FILTER),
|
||||
MENU_LABEL(VIDEO_MAX_SWAPCHAIN_IMAGES),
|
||||
|
@ -262,6 +262,13 @@
|
||||
# It is a regular RGB hex number, i.e. red is "ff0000".
|
||||
# video_message_color = ffffff
|
||||
|
||||
# Background color for OSD messages. Red/Green/Blue values are from 0 to 255 and opacity is 0.0 to 1.0.
|
||||
video_message_bgcolor_enable = false
|
||||
video_message_bgcolor_red = 0
|
||||
video_message_bgcolor_green = 0
|
||||
video_message_bgcolor_blue = 0
|
||||
video_message_bgcolor_opacity = 1.0
|
||||
|
||||
# Video refresh rate of your monitor.
|
||||
# Used to calculate a suitable audio input rate.
|
||||
# video_refresh_rate = 59.94
|
||||
|
Loading…
x
Reference in New Issue
Block a user