Author |
Topic: re: endless graphics draws and LBBooster (Read 1683 times) |
|
michael
Guest
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #8 on: Sep 10th, 2015, 09:05am » |
|
That's amazing!! And to think I tried to make a simulated DLL in LB.. Essentially, what you showed me would allow me to make modules for many things. I would also suppose you would surprise me further and say that LBB could also be used to somehow make a DLL?
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #9 on: Sep 10th, 2015, 9:17pm » |
|
on Sep 10th, 2015, 09:05am, michael wrote:| I would also suppose you would surprise me further and say that LBB could also be used to somehow make a DLL? |
|
Actually it can't, or at least I've never worked out a way to do it (I'm not sure whether it's theoretically possible or not).
Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #10 on: Sep 11th, 2015, 02:26am » |
|
I tried to make include work in LBB but the program doesn't recognize it. I put it at the end of my main program and then executed it. Because of the missing program module (subroutines that are separated from the program and saved in a separate .bas file) I looked at the links concerning it in LBB and I cant figure why it doesn't work.
And a little subject for your amusement: Quote :"Spheres are really hard to make " http://canevian.conforums.com/index.cgi?board=Development&action=display&num=1441915542
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #11 on: Sep 11th, 2015, 05:46am » |
|
on Sep 11th, 2015, 02:26am, michael wrote:| I cant figure why it doesn't work. |
|
Most likely reasons:
Not starting in the first column. Unlike a conventional comment, 'include must be at the very beginning of the line.
No CRLF afterwards. If you are putting it at the very end of the program, make sure you have added a newline after the filename. Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #12 on: Sep 11th, 2015, 07:59am » |
|
Obviously I am doing something wrong. lets say this is my main program.. I have include at the start of the program: (the program wont run if the sub is put there.) Code:
'include mytools.bas
nomainwin
open "The sphere subroutine !!Created by Michael Gallup (free for the public to use)" for graphics_nsb_fs as #1
#1 "trapclose [quit]"
#1 "fill black ; home ; down ; north"
'************H***V***S***R***G***B**Dimmer
call sphere 500,500,220,225,240,250,1
call sphere 50,50,25,225,240,250,9
call sphere 100,100,50,200,200,200,4
call sphere 200,200,100,140,200,200,2
wait
[quit]
close #1
end
and here is the program it would add to the above code. I would have saved it as mytools.bas do you know how it would be corrected?
Also the code bellow would need to be put at the base of the program. Code:
sub sphere h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
for y=1 to size
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 2"
#1 "circle ";y
#1 "flush"
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
next y
end sub
|
| « Last Edit: Sep 11th, 2015, 08:09am by michael » |
Logged
|
|
|
|
tsh73
Full Member
member is offline


Gender: 
Posts: 210
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #13 on: Sep 11th, 2015, 10:50am » |
|
'include doesn't work as a first line. It is documented in a help file: Quote:| For maximum compatibility with Liberty BASIC Workshop the 'include directive is ignored when it is at the very beginning of the program. See this Wiki article for more information, and for details of how to integrate LBW with LBB. |
|
|
|
Logged
|
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #14 on: Sep 11th, 2015, 5:06pm » |
|
The use of flush in the middle of the loop is not appropriate. If you ran this in LB with a size of 200 then every time the window was moved minimised or restored there would be 200 drawing actions. Perhaps not with LBB but certainly with LB.
Flush should be use sparingly and at the end of a looped or multiplexed drawing routine.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #15 on: Sep 11th, 2015, 5:24pm » |
|
on Sep 11th, 2015, 5:06pm, Rod wrote:| If you ran this in LB with a size of 200 then every time the window was moved minimised or restored there would be 200 drawing actions. Perhaps not with LBB but certainly with LB. |
|
The effect won't be so serious in LBB, but it will certainly slow the program down so it's not a good idea. If you're writing a program to run only in LBB, I would recommend not using FLUSH (although it can still be useful when paired with REDRAW). If you want the code to run in both LB and LBB then use FLUSH but ensure it doesn't result in a memory leak (e.g. using CLS or DELSEGMENT to free the memory).
Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #16 on: Sep 11th, 2015, 5:34pm » |
|
That's fine. It doesn't take me long to copy/paste my main program onto a template. I will just make a Program generator to merge the files together quickly into a new program. Because that's what I do best. I am using LBB just for the fact that it makes stand alone executables and for the fact it allows continuous draws. I could use the other resources like gxGL and OpenGL and some other method Richard used in old forum posts for 3D magic, but that's a bit over me since I have only been serious on LB since last January 2015..
|
| « Last Edit: Sep 11th, 2015, 5:56pm by michael » |
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: re: endless graphics draws and LBBooster
« Reply #17 on: Sep 11th, 2015, 8:24pm » |
|
on Sep 11th, 2015, 5:34pm, michael wrote:| I will just make a Program generator to merge the files together quickly into a new program. |
|
Can I just reiterate that 'include works correctly in LBB, as documented. If it serves your purpose (and it's ideal for the gxGraphics library) then use it.
Richard.
|
|
Logged
|
|
|
|
|