Page 1 of 2
Anyone have ideas on implementing a GUI?
Posted: Tue Jan 19, 2010 6:16 pm
by DavidBG
Hello again:
I was wondering how some of you went about making a GUI. Did you create your own graphical primitives, or get a VESA standard library working on your OS? I have initialized a VESA window, and would like to know what some of you all did.
Also, like for the graphics, like an X for close, did you make up your own format, or use something like .BMP or .PCX?
Thanks,
David
Re: Anyone have ideas on implementing a GUI?
Posted: Tue Jan 19, 2010 8:19 pm
by neon
Hello,
In my system the GUI will run in userspace and will render graphics using a video-independent API [which contains primitive routines] which in turn calls the current video driver. This allows multiple video drivers and graphics mode independent from the GUI, managed by the software Subsystem API called from a userspace program.
ie, like: program->SubSystem API->Video-independent API-> [...] ->Video driver
While it is planned to provide support for both VBE and generic video drivers, we currently only have a protected mode VGA driver.
Please keep in mind that this setup is just design.
--
At the moment, I do support BMPs but as image resources in the program. In other systems, id go with TGAs instead. This is only one method of going for it; others will probably have different ideas but perhaps this might give you some ideas as well
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 4:47 am
by neato
Hi, I wrote everything myself, as I seen it was needed. All you need is a little know how (code wise) and a lot of creativity. I found that it helped me to first create a draft of it in MSPaint first, then use PsShop to get the RGB values, and dimensions, then I just wrote code to draw it out.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 5:52 am
by Creature
Well, last time I got graphics working, I first started out with some basic VESA stuff (higher resolutions and such). Then I wrote an invalidation-rectangle system (DAMN, that increases speed a lot) and wrote some convenience code (like alpha blending, mapping an RGBA value to an appropriate integral value based on the colour depth, etc.).
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 6:05 am
by neato
Definitely mapping each control precisely does certainly increase redraw speed and helps to limit flickering. Just think how dumb it would be to refresh the entire screen every time you went to update a status bar...
Yeah, you have to have alpha blending if you want to create an illusion that something like an icon was selected in a browser window. Otherwise you'd have to waste major time toggling images. I just integrated mine into my main draw function and I toggle that on and off instead. lol... much faster.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 6:57 am
by Combuster
neato wrote:Yeah, you have to have alpha blending if you want to create an illusion that something like an icon was selected in a browser window.
Never heard of insets/outsets/dashed lines? You'll get up, down and selected states without having to replot the image, only the borders.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 10:52 am
by DavidBG
Hello:
Would redrawing the screen every time the user moves the mouse be too slow? It seems though, that I should make my own primitives. (I've done it before, in VGA, I assume is is the same in SVGA)
David
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 11:50 am
by Combuster
DavidBG wrote:Would redrawing the screen every time the user moves the mouse be too slow?
Ususally, yes.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 12:01 pm
by giszo
You should redraw the old and the new rectangle of the mouse pointer only.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 12:45 pm
by DavidBG
Hello again:
Here is a silly question but I have searched and searched for an answer:
How do I plot a pixel in SVGA?
I already have a VESA Standard window initialized.
But I can only plot a pixel in VGA with int 0x10 if I move 0x0C into AH and the color into AL. Then I put the X and Y in CX and DX and call int 0x10. But this does not work in SVGA. I can't figure out how to do it directly either like with 0xA000. Any of you know how to do it in ASM?
Thanks!
P.S. Is double buffering slow? Or would that be a solution?
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 1:04 pm
by DavidBG
On second thought, Maybe I should start with a VGA GUI anyway, because I am in real-mode. I do not know how to use a GDT so I cannot go into protected-mode yet. This means I can't use more than the first 64k of the screen anyway.
I'll keep working at it, thanks for the ideas on how to go about it.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 1:06 pm
by Combuster
DavidBG wrote:Here is a silly question but I have searched and searched for an answer:
Hmm, first hit on google for me:
The manual. Includes fairly detailed instructions for a reference document.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 1:41 pm
by Creature
DavidBG wrote:Hello:
Would redrawing the screen every time the user moves the mouse be too slow? It seems though, that I should make my own primitives. (I've done it before, in VGA, I assume is is the same in SVGA)
David
AFAIK, GFX cards usually have a feature called "hardware cursors" (or something like that) allowing better performance.
DavidBG wrote:
P.S. Is double buffering slow? Or would that be a solution?
Well, it does require you to (typically) add a buffer the size of the screen, to which you draw everything. Then, when you are finished drawing (or when the monitor refreshes), you swap the buffers. There is an article on the wiki called
Double Buffering that you might want to check out.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 3:46 pm
by neato
Combuster wrote:neato wrote:Yeah, you have to have alpha blending if you want to create an illusion that something like an icon was selected in a browser window.
Never heard of insets/outsets/dashed lines? You'll get up, down and selected states without having to replot the image, only the borders.
When one icon is selected within an ocean of unselected icons, which is easier to see: A) A big blue rectangle. B) A tiny little dash line. It's all about trying to be friendly to as many users as possible and you're not going to get there by being lazy.
Re: Anyone have ideas on implementing a GUI?
Posted: Wed Jan 20, 2010 5:24 pm
by neon
DavidBG wrote:On second thought, Maybe I should start with a VGA GUI anyway, because I am in real-mode. I do not know how to use a GDT so I cannot go into protected-mode yet. This means I can't use more than the first 64k of the screen anyway,
VBE (and thus Super VGA) supports a way to switch between banks of the full video memory allowing you to be able to access the full video memory through that 64k "window". Look into "Bank Switching" with VBE; im sure there is plenty of tutorials on it
On the use of double buffering, if it was possible, id go with page flipping over double buffering for a general graphics OS. Requires hardware support though, but does fix the issues involved with double buffering.