IonicWind Software

IWBasic => GUI Central => Topic started by: TexasPete on June 15, 2008, 07:48:07 AM

Title: converting liberty gui to ebasic
Post by: TexasPete on June 15, 2008, 07:48:07 AM
I am just making sure I am convetting properly. I have a graphic box in liberty basic in a window. To convert to eb do I simply open up another window  and write my graphics to that window?
TexasPete
Title: Re: converting liberty gui to ebasic
Post by: aurelCB on June 15, 2008, 08:32:42 AM
I think that you must open new window.
Liberty or JB open window as graphicbox.
for example :
open "Boxes" for graphics as #1
this is from JB
Title: Re: converting liberty gui to ebasic
Post by: LarryMc on June 15, 2008, 09:42:08 AM
What kind of "graphics" are you talking about. Lines  or images?

Larry
Title: Re: converting liberty gui to ebasic
Post by: GWS on June 15, 2008, 09:43:14 AM
I don't know what your graphics are like Pete, but EBasic and CBasic allow you to place graphics directly in any window you have opened - you don't need a 'graphics box' - just go for it  ;D

DirectX graphics (sprites and suchlike) are another kettle of fish of course

Here's a quick demo (the code might be a bit rough 'cos i've just rapidly translated it from CBasic) ..  :)

def win:WINDOW

def textW,textH,meanx,meany,sdev,c:int
def x,y,i,j,run,band:int
def pstep,pi,ret:float
def a$:string

autodefine "off"

declare Splot(),float

openwindow win,-800,0,800,600,@MINBOX|@MAXBOX|@SIZE,0,"EBasic Window Example",&winh

control win,@button,"Exit",(800-70)/2,470,70,30,@CTLBTNFLAT,1
setfont win, "MS Sans Serif",12,600,0,1
setcontrolcolor win,1,rgb(100,200,250),rgb(10,10,100)

' draw a gradient fill in main window ..
pstep = 600.0 / 256 + 1
for band = 0 To 255
rect win, 0, int(band * pstep), 800, int((band+1) * pstep), rgb(0,0,band), rgb(0,0,band)
next band

pi = 4.0 * atan(1.0)

' set intro text ..
a$ = "Emergence Basic Rules"
frontpen win, RGB(60,60,255)
drawmode win,@TRANSPARENT
setfont win, "Arial",30,700, @SFITALIC
gettextsize win, a$, textW, textH
move win,(800-textW)/2,40
print win,a$

centerwindow win

' create some coloured spots ...
for i = 1 to 20
meanx = rnd(500)+150
meany = rnd(300)+50
sdev = 20
c = rgb(rnd(250)+50,rnd(250)+50,rnd(250)+50)
for j = 1 to 400
x = splot() * sdev + meanx
y = splot() * sdev + meany
pset win, x, y , c
next j
next i

' set intro text ..
a$ = "Emergence Basic Rules"
frontpen win, RGB(60,60,255)
drawmode win,@TRANSPARENT
setfont win, "Arial",30,700, @SFITALIC
gettextsize win, a$, textW, textH
move win,(800-textW)/2,40
print win,a$

run = 1

waituntil run = 0
closewindow win

END

sub winh
select @class
case @idclosewindow
run = 0
case @idcontrol
if @controlid = 1 then run = 0
endselect
return
ENDSUB

sub splot()
def x1,x2:double
' routine to give a random value from the normal distribution ..
x1 = rnd(1.0)
x2 = rnd(1.0)
' catch very small values of x1 ..
if (x1 < 1.0E-5) then x1 = 1.0E-5
' the Normal curve value ..
ret = sqrt(-2.0*log(x1)) * cos(2.0*pi*x2)

return ret
ENDSUB


best wishes,  :)

Graham

Title: Re: converting liberty gui to ebasic
Post by: aurelCB on June 15, 2008, 01:04:38 PM
My mistake...
You dont open new window becose EB or CB suport graphics directly
not like you must in LB or JB.ok
Title: Re: converting liberty gui to ebasic
Post by: TexasPete on June 16, 2008, 05:18:00 PM
Thanks everybody. I was just trying to make sure so I did not have to redo stuff.
Texas Pete