Comments (6)
I think I understand what you are asking.
If you are talking about a top menu bar like this: (similar to vurtun/nuklear#308)
you will want to look into nk_menubar_xxx
.
Searching for nk_menubar
or nk_menubar_begin
in the Nuklear repo should return some hits in some of the examples.
For a basic example (I haven't directly tested this), you could do something like this:
if (nk_begin(ctx, "Menubar", nk_rect(0, 0, WIDTH, HEIGHT), 0))
nk_menubar_begin(ctx);
/*
25 being the width of each item, and 1 specifying 1 item in the row
*/
nk_layout_row_begin(ctx, NK_STATIC, 25, 1);
/*
push the first item (the label in the menu bar)
*/
nk_layout_row_push(ctx, 45);
if (nk_menu_begin_label(ctx, "EXAMPLE", NK_TEXT_LEFT, nk_vec2(120, 200))) {
/*
The widgets you put in here will only show when your menu is opened
*/
nk_layout_row_dynamic(ctx, 25, 1);
if (nk_menu_item_label(ctx, "EXAMPLE DROPDOWN LABEL ITEM", NK_TEXT_LEFT)) {
// do something here when this menu option is clicked
}
nk_menu_end(ctx);
}
nk_menubar_end(ctx);
nk_end(ctx);
}
This should be enough to get you started, and if you need more reference I am using nk_menubar here in my own repo.
And just for your reference, here are the definitions from nuklear.h
/* =============================================================================
*
* MENU
*
* ============================================================================= */
NK_API void nk_menubar_begin(struct nk_context*);
NK_API void nk_menubar_end(struct nk_context*);
NK_API nk_bool nk_menu_begin_text(struct nk_context*, const char* title, int title_len, nk_flags align, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_label(struct nk_context*, const char*, nk_flags align, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_image(struct nk_context*, const char*, struct nk_image, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_image_text(struct nk_context*, const char*, int,nk_flags align,struct nk_image, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_image_label(struct nk_context*, const char*, nk_flags align,struct nk_image, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_symbol(struct nk_context*, const char*, enum nk_symbol_type, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_symbol_text(struct nk_context*, const char*, int,nk_flags align,enum nk_symbol_type, struct nk_vec2 size);
NK_API nk_bool nk_menu_begin_symbol_label(struct nk_context*, const char*, nk_flags align,enum nk_symbol_type, struct nk_vec2 size);
NK_API nk_bool nk_menu_item_text(struct nk_context*, const char*, int,nk_flags align);
NK_API nk_bool nk_menu_item_label(struct nk_context*, const char*, nk_flags alignment);
NK_API nk_bool nk_menu_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment);
NK_API nk_bool nk_menu_item_image_text(struct nk_context*, struct nk_image, const char*, int len, nk_flags alignment);
NK_API nk_bool nk_menu_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment);
NK_API nk_bool nk_menu_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment);
NK_API void nk_menu_close(struct nk_context*);
NK_API void nk_menu_end(struct nk_context*);
from nuklear.
Thank you that worked.
from nuklear.
You can make menu's ...
but what do you mean by a file menu .. ? Do you mean the actual file picker popping up or just listing the file options on your UI?
from nuklear.
A good start would probably be to check out Nuklear/demo/common/file_browser.c
. As far as I can tell the only example that uses it is Nuklear/demo/glfw_opengl2
with INCLUDE_FILE_BROWSER
defined.
from nuklear.
You can make menu's ... but what do you mean by a file menu .. ? Do you mean the actual file picker popping up or just listing the file options on your UI?
I am sorry, I noticed you can make menu's, nice menus indeed, but by file menu I mean something like:
I was working with imgui with some modifications for my sdl scheme, then I realized there are more modern versions, and found out about Nuklear.
So the question is: How can I put a Menu's on the top of the main window, in a menu bar.
Best Regards,
C.A.
from nuklear.
A good start would probably be to check out
Nuklear/demo/common/file_browser.c
. As far as I can tell the only example that uses it isNuklear/demo/glfw_opengl2
withINCLUDE_FILE_BROWSER
defined.
Hello, I have looked over both glfw_opengl2/demo and Nuklear/demo/common/file_browser.c and found that they include examples to browse a file system, (which will be useful later on) - but was not able to find a file menu as I described. Best regards, C.A.
from nuklear.
Related Issues (20)
- Line chart performance: boxes on points make line charts much slower than without HOT 1
- Is it possible to know whether input is captured?
- Creating a nk_image with the sdl_renderer backend HOT 2
- Errors in compiling https://immediate-mode-ui.github.io/Nuklear/doc/#nuklear/example
- Two Issues with Fonts
- Inconsistent grabbing behavior in demos (click and drag property) HOT 8
- Build help with Allegro5 MinGW-64(TDM-Posix-SEH) HOT 2
- Demo headers and nk_ and design choices, oh my! HOT 6
- Backspace does not actually clear a buffer when using nk_edit_string HOT 1
- Request: create example for showcasing integration with RGFW HOT 2
- How to make own title bar, without using the operating systems HOT 3
- Group margins/alignment Ubuntu HOT 3
- Demo doesn't include code on how to display images without OpenGL. HOT 1
- After set an opened Combo Box to invisible, no response from the entire window.
- How to do multiple render with one update HOT 2
- Events not working with multiple Nuklear windows
- Add `delta_time_seconds` to each renderer
- GUI "cards" HOT 6
- Multiple window instances HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuklear.