Page 1 of 1

Gui

Posted: Mon Dec 03, 2007 3:49 pm
by zfos
do you have links on how to create guis

Posted: Mon Dec 03, 2007 10:13 pm
by Mike
Hello,

Do you already have a video driver and graphics driver developed?

When I get off work, I will see if I can find you resources. :)

gui

Posted: Tue Dec 04, 2007 11:36 pm
by zfos
no, i dont all i have are your tutorials but i like gui's

Posted: Wed Dec 05, 2007 12:13 am
by Mike
Hello,

A GUI is just an interface that uses graphics rendering to display the interface. So, in order to create a GUI, you must have some way to render graphics first.

Graphics, of any sort, is pure mathematics and data management. For an example, in a video mode, where video memory is mapped to a linear address, where each pixel is 1 byte, this will render a rectangle (Taken from an old game of mine):

Code: Select all

void DrawFilledRect (int x, int y, int width, int height, int col) {

   byte_t far* p=0;
   int i=width;
   p = GetDisplay () + y * VID_WIDTH +x;

   while (height>=0) {

       for (i=width; i>=0; i--)
	      p[i] = col;

       p+=VID_WIDTH;
       height--;
   }
}
The above code may be found within a graphics driver.

GetDisplay() may be implemented by your video driver. All it does in this case is return the base address of the mapped region of video display.

---

After all of the needed graphics routines are implemented, such as our above routine, you need to have the GUI manage this information somehow.

...Such as, a window?

All a GUI (should) do is manage data. In this case, we might create a basic Window object defining properties of a window. Mabey:

Code: Select all

class Window {
   unsigned int std::string  m_strName;
   RECT  m_rcRect;
   //...other properties of the window...//

public:
   void Render ();
}

void Render () {

   // render the window at its new location
   // This may be done by a system call, which will
   // provoke our graphics driver and calls our
   // DrawFilledRect() and associated routines
}
^The above should be implemented by your GUI library code.

Notice that we have yet to touch an input--which is the most important part, and why creating a Kernel Shell first is important.

The kernel shell is just text based--not graphical. This allows you to build on your input manager and C++ library code before the graphics. This will fix our above problem.

Because the GUI and graphics shell rely on alot of different parts of your system, it is highly recommended to develop a text based shell first.

Your GUI relies on the System API. The System API will then invoke the current Graphics Driver. The Graphics Driver will invoke the current Video Driver.

You must do everything in the proper order, even if it is bare minimum code.

I hope this gives you an idea of how everything works on the graphics side of things, and show you what your next steps should be :)

Posted: Sun Feb 15, 2009 9:05 pm
by djsilence
Hi, Mike! I registered in this forum (we wrote to each other "djsilence@inbox.com") :D You wrote to zfos about creating windows class. According to my efforts and efforts of Microsoft - it will be much better to use window as structure. So, zfos:

1. You need (if you wanna 'clever' GUI) to create tables or list of windows classes (I do not use classes, because it is a few styles an it is easier to create each window anew than to create a class and then a window) and list (or table :) ) of pointers to windows structers (handlers).
2. This is a link of some GUI tutorial http://osdever.net/tutorials/GUI_tut.php, but I recommend you to take a pen and a sheet of paper, sit down at the kitchen with a cup of tea and think yourself of how does you will do this. I promise, that it is VERY interesting! And it is not difficult.
3. You need (to support hi-res GUI) a simple video driver (an easier - VESA driver). I do not know does you know something about this, so I won't write it at the moment. Have any questions - post. I'll answer.

And remember, that GUI is unuseable while you have no mouse and keyboard driver. Your mouse driver needs to control wich window got the event of mouse or keyboard. It is more difficult than simple drivers. :? Sorry, for my funny English! :)

Cheers, Daniel!

Re: Gui

Posted: Sun Sep 13, 2009 3:28 pm
by zfos
thanks for the tips!!!

i can't wait till we get to this point in the tutorials