Open zrafa opened 2 years ago
The library does not depend on SDL nor GL. It's the samples which feature them. You are free to implement a purely software implementation for the renderer. I'm afraid there's no example of it though, but it should be pretty straightforward : you need to draw/fill rectangles, sprites and text.
Le mer. 24 nov. 2021 à 15:17, Rafael Ignacio Zurita < @.***> a écrit :
Hello. This is not an issue. Just a question looking for a link or help: How I do port this great project to another lower framebuffer layer? I see that it depends on SDL y GL it seems. I have just a memory buffer for drawing pixeles (it is a little experiment on Xinu operating system using vga in protected mode x86). So I do not have neither SDL nor GL. But I can draw pixels (or of course, copy a memory drawing buffer to screen for example). Should I modify the renderer.* files? Others? Any help on how to modify the current demo for a new screen control would be appreciated.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rxi/microui/issues/56, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH5RYWTJQ5G3ZJYFXJPJZLUNTXWPANCNFSM5IWF4P2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
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!
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.
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.
Hello. This is not an issue. Just a question looking for a link or help: How I do port this great project to another lower framebuffer layer? I see that it depends on SDL y GL it seems. I have just a memory buffer for drawing pixeles (it is a little experiment on Xinu operating system using vga in protected mode x86). So I do not have neither SDL nor GL. But I can draw pixels (or of course, copy a memory drawing buffer to screen for example). Should I modify the renderer.* files? Others? Any help on how to modify the current demo for a new screen control would be appreciated.