improve layouting
parent
341040abc2
commit
847289c6de
|
@ -156,7 +156,7 @@ void game_init(const char *ip, uint16_t port, game_kind play_mode, uint32_t num_
|
|||
active_viewer = &world_viewers[0];
|
||||
camera_reset();
|
||||
|
||||
game_ui = InitNuklear(12);
|
||||
game_ui = InitNuklear(10);
|
||||
}
|
||||
|
||||
if (game_mode != GAMEKIND_SINGLE) {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "models/items.h"
|
||||
|
||||
extern void tooltip_show_cursor(const char* name);
|
||||
extern const char *tooltip_find_desc_contents(const char *name);
|
||||
|
||||
void ToolAssetInspector(void) {
|
||||
if (nk_begin(dev_ui, "Asset Inspector", nk_rect(400, 100, 240, 800),
|
||||
|
@ -22,6 +23,17 @@ void ToolAssetInspector(void) {
|
|||
tooltip_show_cursor(asset_names[i]);
|
||||
}
|
||||
|
||||
// draw help text
|
||||
if (nk_tree_push_id(dev_ui, NK_TREE_NODE, "description", NK_MINIMIZED, i)) {
|
||||
{
|
||||
const char *desc = tooltip_find_desc_contents(asset_names[i]);
|
||||
if (desc) {
|
||||
nk_layout_row_dynamic(dev_ui, 0, 1);
|
||||
nk_label_wrap(dev_ui, desc);
|
||||
}
|
||||
}
|
||||
nk_tree_pop(dev_ui);
|
||||
}
|
||||
// draw block
|
||||
block_id blk_id = blocks_find(i);
|
||||
if (blk_id != 0xF) {
|
||||
|
|
|
@ -86,6 +86,17 @@ tooltip *tooltip_find_desc(const char *name) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const char *tooltip_find_desc_contents(const char *name) {
|
||||
for (zpl_isize i = 0; i < zpl_array_count(tooltips); ++i) {
|
||||
tooltip *tp = (tooltips + i);
|
||||
|
||||
if (!strcmp(tp->name, name))
|
||||
return tp->content;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tooltip_clear(void);
|
||||
|
||||
void tooltip_show(const char* name, float xpos, float ypos) {
|
||||
|
@ -124,7 +135,7 @@ void tooltip_clear(void) {
|
|||
inline void tooltip_draw_contents(tooltip *desc) {
|
||||
if (!desc) return;
|
||||
|
||||
nk_layout_row_dynamic(game_ui, 30, 1);
|
||||
nk_layout_row_dynamic(game_ui, 0, 1);
|
||||
nk_label_wrap(game_ui, desc->content);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue