Gui Tutorial

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
ahmedhalawa
Member
Member
Posts: 28
Joined: Wed Jul 02, 2008 9:28 am

Gui Tutorial

Post by ahmedhalawa »

Why there is no any tutorail , docs or books for useing vesa or talking about gui and the way to it .
I sow the most of topic asking about it.
Pleas from every body put any thing you know about veas here
beacuse I cant use vesa site
User avatar
JackScott
Member
Member
Posts: 1036
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Mastodon: https://aus.social/@jackscottau
Matrix: @JackScottAU:matrix.org
GitHub: https://github.com/JackScottAU
Contact:

Re: Gui Tutorial

Post by JackScott »

Hope this helps:
http://www.vesa.org/public/VBE/vbe3.pdf (first result on google for 'vesa pdf')
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Gui Tutorial

Post by Brendan »

Hi,
ahmedhalawa wrote:Why there is no any tutorail , docs or books for useing vesa or talking about gui and the way to it .
I sow the most of topic asking about it.
Pleas from every body put any thing you know about veas here
beacuse I cant use vesa site
My interpretation:

"Why is there no tutorials, docs or books for using VESA/VBE or talking about GUIs and the way to do/implement them .
I saw the most topics asking about it.
Please, from everybody put anything you know about VESA/VBE here, because I can't use the VESA website."


Ok, I'm not sure why you're having trouble with the VESA website. If you don't want to register then maybe this link will help...

I'd assume that there isn't many tutorials on using VESA/VBE because it isn't very hard and the specifications (e.g. the VBE 3.0 specification) are all you (should) need.

GUIs can be complex, but they're fairly OS specific too - a tutorial for one OS will probably be useless for another OS due to different IPC (Inter-Process Communication) techniques, different kernel APIs, different device driver interfaces, etc. For the video related stuff, (arguably) the best source of information is older game programming tutorials. For example, see if you can find a copy of "Michael Abrash's Graphics Programming Black Book" (written by Michael Abrash) on the internet somewhere...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Mattx
Posts: 20
Joined: Fri Jul 11, 2008 5:10 am

Re: Gui Tutorial

Post by Mattx »

I'm beginner as probably you but maybe it will be helpful :
http://www.osdever.net/tutorials/GUI_tut.php
this tutorail is for person who have achived method like putPixel already. If you still don't have it you must read topics on forum, vesa tutorials, something about pc architecture also would tell you alot. If you have it you must remember the best thing in creating GUI is that you have no 'limits' :) What ever you can imagine and implement can be you GUI, will it be cool and or not it will be your idea. In os development there are constant things GUI is not :)

Cheers
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: Gui Tutorial

Post by Dex »

See here: http://alexfru.narod.ru/
You need to get "My Windows Manager Demo" by Alexei A. Frounze's
User avatar
ahmedhalawa
Member
Member
Posts: 28
Joined: Wed Jul 02, 2008 9:28 am

Re: Gui Tutorial

Post by ahmedhalawa »

Welcome
I'm so sorry,my lauguage is arabic that is why i cann't unstad the most of english word so I cann't use vesa site :(.
thanks for giving us this docs =D> .

**************************************
note:
google tanslateor cann't give us the meaning which i need it.
under standing it is very diffculate.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Gui Tutorial

Post by Brendan »

Hi,
ahmedhalawa wrote:note:
google tanslateor cann't give us the meaning which i need it.
under standing it is very diffculate.
I wish things were different, but unfortunately to get anything done with operating system development you'll need to become good at reading technical documentation that was written in English (it's hard enough finding any information sometimes, and any information you do find will almost always be in English).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: Gui Tutorial

Post by DeletedAccount »

Well , you could start by putting a pixel on the screen
1) use a line drawiing algorithm to draw lines
2) use algorithms for circle , and elipses ... and other primitives
3) you could easily implement floodfill etc
4) then make use of these primitives to draw buttons , checkboxes etc ( use your imagination -- that's all :)

Some code for guidance , you may look into it , but never copy this . its pathetic :( . Its using borlands bgi .It's not very well commented either :(

Code: Select all

#include<dos.h>
#include<graphics.h>
#define DRAW 2
#define PUSH 1
#define UNPUSH 0
struct mouse
{
int button,x,y,gd,gm;
int initmouse();
void showmouseptr();
void restrictmouseptr(int x1,int y1,int x2,int y2);
void getmousepos(int *button,int *x,int *y);
void hidemouseptr();
void Win(char *header,int sx,int sy,int ex,int ey,int opt);
void Button(char *text,int sx,int sy,int ex,int ey,int opt);
void winp(int sx,int sy,int ex,int ey,int state);
void checkcircle(int xx,int yy);
void checkc(int xx,int yy,int on);
void checkbox(int xx,int yy);
void check(int xx,int yy,int choice);
void pressb(int sx,int sy,int ex,int ey);
void g();
void lg();
int click(int x1,int y1,int x2,int y2);

};
int mouse::initmouse()
{
_AX=0;
geninterrupt(0x33);
return(_AX);
}
void mouse::showmouseptr()
{
_AX=1;
geninterrupt(0x33);
}
void mouse::hidemouseptr()
{
_AX=2;
geninterrupt(0x33);
}
void mouse::restrictmouseptr(int x1,int y1,int x2,int y2)
{
_AX=7;
_CX=x1;
_DX=x2;
geninterrupt(0x33);
_AX=8;
_CX=y1;
_DX=y2;
geninterrupt(0x33);
}
void mouse::getmousepos(int *button,int *x,int *y)
{
_AX=3;
geninterrupt(0x33);
*button=_BX;
*x=_CX;
*y=_DX;
}
void mouse::Win(char *header,int sx,int sy,int ex,int ey,int opt)
{
   int COLOR=7;// Try Different colors
   setfillstyle(1,COLOR);
   bar(sx,sy,ex,ey);
   setcolor(8);
   line(sx,sy,sx,ey);
   line(sx,sy,ex,sy);
   if(opt)
   rectangle(sx+4,sy+4,ex-2,ey-2);
   setcolor(0);
   line(ex-1,sy+2,ex-1,ey);
   line(sx+2,ey-1,ex,ey-1);
   line(ex,sy,ex,ey);
   line(sx,ey,ex,ey);
   setcolor(15);
   line(sx+2,sy+2,sx+2,ey-2);
   line(sx+2,sy+2,ex-2,sy+2);
   if(opt==1)
   {
	   setfillstyle(1,1);
	   bar(sx+5,sy+5,ex-2,sy+23);
	   setcolor(COLOR);
	   rectangle(sx+8,sy+8,sx+20,sy+19);
	   line(sx+8,sy+9,sx+20,sy+9);
	   line(sx+8,sy+10,sx+20,sy+10);
	   putpixel(sx+18,sy+9,15);
	   setcolor(15);
	   settextstyle(0,0,0);
	   outtextxy(sx+25,sy+10,header);
	   setfillstyle(1,COLOR); //for x
	   bar(ex-18,sy+7,ex-7,sy+18);
	   setcolor(15);
	   line(ex-18,sy+7,ex-7,sy+7);
	   line(ex-18,sy+7,ex-18,sy+18);
	   setcolor(0);
	   line(ex-18,sy+18,ex-7,sy+18);
	   line(ex-7,sy+7,ex-7,sy+18);
	    setcolor(15);
	   outtextxy(ex-15,sy+9,"x");
	   setcolor(0);
	   outtextxy(ex-16,sy+8,"x");
	   setfillstyle(1,7);
   }
}
void mouse:: Button(char *text,int sx,int sy,int ex,int ey,int opt)
{
   int COLOR=7;
   if(opt==PUSH)
   {
	setcolor(COLOR);
	rectangle(sx+1,sy+1,ex-1,ey-1);
   }else
   if(opt==UNPUSH)
   {
	setcolor(0);
	rectangle(sx+1,sy+1,ex-1,ey-1);
	setcolor(15);
	line(sx+1,sy+1,sx+1,ey-2);
	line(sx+1,sy+1,ex-2,sy+1);
   }else
   if(opt==DRAW)
   {
	setfillstyle(1,COLOR);
	bar(sx,sy,ex,ey);
	setcolor(0);
	rectangle(sx,sy,ex,ey);
	rectangle(sx+1,sy+1,ex-1,ey-1);
	setcolor(15);
	line(sx+1,sy+1,sx+1,ey-2);
	line(sx+1,sy+1,ex-2,sy+1);
	settextstyle(2,0,4);
	setcolor(0);
	outtextxy(sx+((ex-sx)/2)-textwidth(text)/2,sy+((ey-sy)/2)-6,text);
   }
}
void mouse::winp(int sx,int sy,int ex,int ey,int state)
{
   hidemouseptr();
   if(state==1)
   {
   setcolor(0);
   line(sx,sy,sx,ey);
   line(sx,sy,ex,sy);
   line(sx,sy,sx,ey);
   line(sx,sy,ex,sy);
   setcolor(15);
   line(ex,sy,ex,ey);
   line(ex,sy,ex,ey);
   line(sx,ey,ex,ey);
   line(sx,ey,ex,ey);
  }
  else
  {
   setcolor(15);
   line(sx,sy,sx,ey);
   line(sx,sy,ex,sy);
   line(sx,sy,sx,ey);
   line(sx,sy,ex,sy);
   setcolor(0);
   line(ex,sy,ex,ey);
   line(ex,sy,ex,ey);
   line(sx,ey,ex,ey);
   line(sx,ey,ex,ey);
  }
  showmouseptr();
}
void mouse::checkcircle(int xx,int yy)// draw
{
 xx+=5;
 yy+=5;
 setfillstyle(1,15);
 setcolor(15);
 circle(xx,yy,5);
 floodfill(xx+1,yy+1,15);
 setcolor(7);
 circle(xx,yy,4);
 setfillstyle(1,0);
 floodfill(xx-5,yy,7);
 floodfill(xx,yy-5,7);
}
void mouse::checkc(int xx,int yy,int on)// action
{
 xx+=5;
 yy+=5;
 if(on==1)
 {
 setfillstyle(1,0);
 fillellipse(xx,yy,2,2);
 }
 else
 {
 setfillstyle(1,15);
 floodfill(xx,yy,7);
 }
}
void mouse::checkbox(int xx,int yy)
{
 setfillstyle(1,15);
 bar(xx,yy,xx+10,yy+10);
 winp(xx-2,yy-2,xx+12,yy+12,1);
 winp(xx-1,yy-1,xx+12,yy+12,1);
}
void mouse::check(int xx,int yy,int choice) //action
{
 if(choice==1)
 {
  //checked
  setcolor(0);
  line(xx+2,yy+4,xx+5,yy+9-2);
  line(xx+2,yy+5,xx+5,yy+9-1);
  line(xx+2,yy+6,xx+5,yy+9);
  line(xx+5,yy+8-2,xx+8,yy+1);
  line(xx+5,yy+9-2,xx+8,yy+2);
  line(xx+5,yy+10-2,xx+8,yy+3);
 }
 else
 {
 setfillstyle(1,15);
 bar(xx,yy,xx+10,yy+10);
 }
}
void mouse::pressb(int sx,int sy,int ex,int ey)
{
 hidemouseptr();
 Button("",sx,sy,ex,ey,PUSH);
 showmouseptr();
 while((button & 1)==1)
 getmousepos(&button,&x,&y);
 hidemouseptr();
 Button("",sx,sy,ex,ey,UNPUSH);
 showmouseptr();
}
void mouse::g()
{
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"");//make sure that egavga.bgi is in the current directory
}
void mouse::lg()
{
closegraph();
restorecrtmode();
}
int mouse::click(int x1,int y1,int x2,int y2)
{
getmousepos(&button,&x,&y);
if(x>x1&&x<x2&&y>y1&&y<y2&&((button & 1)==1) )return 1;
else
return 0;
}

Regards
Sandeep
Post Reply