Comments (4)
from microui.
Hello @zrafa,
Porting microui to a software renderer involves writing a new "renderer" that is called from your main loop, where microui is used to create windows and then the commands it generates for that are interpreted and drawn by your own code. It will call mu_next_command
in a loop and switch out to your own custom draw code.
I have an example of this in https://github.com/ghaerr/microui/tree/master/demo-nano-X. See the main.c file, where the main loop does the above and switches out to drawing text, rectangles, icons and setting clip rects, that's it. This particular example ported microui to a graphics system called Microwindows that is more complicated and eventually draws into a frame buffer, but the idea is the same. You will also have to think through how you want to handle input.
Thank you!
from microui.
Thanks a lot for the comments. So it is clear that we must to modify/write renderer. Now, whichs function(s) exactly? And what do them do?
void r_init(void);
void r_draw_rect(mu_Rect rect, mu_Color color);
void r_draw_text(const char *text, mu_Vec2 pos, mu_Color color);
void r_draw_icon(int id, mu_Rect rect, mu_Color color);
int r_get_text_width(const char *text, int len);
int r_get_text_height(void);
void r_set_clip_rect(mu_Rect rect);
void r_clear(mu_Color color);
void r_present(void);
I mean, which of them "write" to the real screen? (or virtual, whatever, the one which you see). For example, r_clear(), clear the whole real screen? I do not know exactly what does each one.
@ghaerr : btw, I would love to use nano-x in my experiments (that was my firt choice. But it seemed me that I need sockets. Xinu has network, but I am not confident with its implementation and usage yet.
Thanks in advance for any extra help.
from microui.
I mean, which of them "write" to the real screen? For example, r_clear(), clear the whole real screen? I do not know exactly what does each one.
You can see what each one needs to do be looking at the source code for the port of microui to nano-X above. Did you look at the renderer.c source? I advise you study all the .c files, there aren't many, they tell you the answer you are looking for.
I would love to use nano-x in my experiments (that was my firt choice. But it seemed me that I need sockets.
Nano-X and microui solve two different problems. Microui's purpose is to easily build immediate-mode user interfaces. Nano-X is a graphical windowing system that can be configured without sockets. If you have a nano-X question, you can ask it over there.
from microui.
Related Issues (20)
- How can you resize microui window dynamically? HOT 2
- demo/build.sh is not suitable for MacOS HOT 1
- Post a screenshot HOT 7
- Licensing HOT 1
- DirectX 9 HOT 3
- Porting push_quad to DirectX
- Can I use it without SDL ? HOT 1
- Hash function "Cannot convert from 'const void *' to 'const unsigned char *'" HOT 4
- Question: how do I open a window HOT 2
- Library dependency HOT 1
- Why is black area covering gui appearing after resizing window? HOT 1
- Trying to get a window container within another window HOT 3
- C string gets corrupted when passed to the TextCommand handler HOT 3
- Textbox improvements! HOT 3
- Question: Microui extensions
- Question: Running demo on windows HOT 2
- RAM Footprint HOT 7
- Can you layout from minimum required sizes by child widgets?
- 'step' does not work with mu_slider_ex HOT 1
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 microui.