May 09, 2024, 10:23:11 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


converting liberty gui to ebasic

Started by TexasPete, June 15, 2008, 07:48:07 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

TexasPete

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

aurelCB

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

LarryMc

What kind of "graphics" are you talking about. Lines  or images?

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

GWS

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

Tomorrow may be too late ..

aurelCB

My mistake...
You dont open new window becose EB or CB suport graphics directly
not like you must in LB or JB.ok

TexasPete

Thanks everybody. I was just trying to make sure so I did not have to redo stuff.
Texas Pete