PDA

View Full Version : thinbasic Lionmodule :D



Lionheart008
28-05-2009, 22:02
chapter one: my "first dll test" ;)

hi dear thinbasic friends...

this is no joke... from this day you can uses "lion" as dimension :)

I am publishing now my first thinbasic / lionmodule script example with own lion.dll for working with thinbasic...

...more to come, I am very sure and be very happy to find a short and good way for me to create new thinbasic module stuff... 8)

any feedback are very welcome :D, you can test the mini script, it run's very well

best regards, Lionheart
all done in zip file if you like...

Lionheart008
28-05-2009, 23:58
add some more infos here...

my idea for a new thinbasic "lion module" should aim to a colour / paint tool...

I add here a first colour pointer exe.example... how to use it with the "lion module"... I cannot say how to build it today... but this is my idea for the next weeks :D

use arrows "up, down, left, right" to move the colour pointer... ;)

servus, good evening, Lionheart

Lionheart008
29-05-2009, 02:17
chapter two: my "second dll test" ;)

short input...

... one little "lion" (uses "lion", "console") update with three math. function declaration, as I have understood this new functionality of the module completely new ;)

good night, making a lot of fun to go step by step into quite new dimension...
just enough for this night and I am very glad to see new horizonts :)

script as followed...


'- Empty GUI script created on 05-28-2009 21:03:53 by Lionheart, (ThinAIR)
'- test script for DLL handling with new lionmodule :)

'-------------
'DLL FOR THINBASIC LIONMODULE
'=============

uses "lion", "console"

declare function hello lib "lion.dll" alias "hello" (byval n as long) as long
declare function mynumber lib "lion.dll" alias "mynumber" (byval n as long) as long
declare function Deg2Rad lib "lion.dll" alias "Deg2Rad" (byval n as long) as long
declare function Rad2Deg lib "lion.dll" alias "Rad2Deg" (byval n as long) as long

dim a as long
dim v as long
dim b as long
dim z as long
dim r as long

printl date$
printl time$

a=hello 18
v=hello 32
b=hello 16
z=mynumber 34
r=rad2deg 16

printl
printl "Hello dear Thinbasic and Lionmodule users!"
printl
printl a
printl
msgbox 0,"Returned value of different math. example is: " & a
printl
msgbox 0,"Returned value of second math. example is: " & v
printl v
printl
msgbox 0,"my lovely number is: " & z
printl z
printl
printl "Hey all is ok here with new module try..: " & b
printl
msgbox 0,"..my exciting Rad2Deg number is: " & r
printl Rad2Deg(Deg2Rad(45.0))
printl
printl "- push any key to exit :) -"
waitkey

sleep well, best regards, Lionheart
ps: add all in this zip file and enough for today...
...and thanks to charles for some good advice ;)

Michael Hartlef
29-05-2009, 07:35
Welcome to the group of thinbasic module developers :) And thanks for the effort.

Some things are missing imho. A help file with command descriptions. I suggest HelpNDoc. Very easy to handle.
The next thing is that without Prefixes, your commands may collide at one day with thinBasics native commands.

Michael


Ps.: Mmmh, a module but then you need to declare the commands? So is it a module or an external DLL?

Lionheart008
29-05-2009, 20:39
hi michael :)

thank you for nice words... yes, I am on the right way... have a lot of good ideas for my lion module, but I have to check a lot of things at the starting point for "thinbasic/Lion" module to become a real unique module like "ui", "tbgl", "oxygen" or "tbdi", "tbem" etcpp.. ;) I am far away, only 2 million lightyears from next sunsystem or another blue planet...

I am just standing here before the mount everest and looking for a good climbing rout up to the clouds :D

more next week, I am sure there will come some new input and then I will declare some functions or/and commands...

best regards, all good for you too, Lionheart

Lionheart008
30-05-2009, 14:00
chapter three: my "third dll test" ;)

=> "liongfx" try :)

hi all...
hi michael,


Ps.: Mmmh, a module but then you need to declare the commands? So is it a module or an external DLL?

I will create a own MODULE :D.. you can see it in this test example with few new commands... but I will not follow this way, just tried to compile it for thinbasic :)

..shows next a new example first time with own uses "liongfx" module... this time fully without any other libraries and have adept it perfectly from fbgfx example... wasn't so hard to get this new script, makes a lot of fun... :yes:... the second step for me... to understand all this strange and exciting new module drugs..

it was only important for me to make a test handling with thinbasic language and
the timer function in it is old but fulfilled his task for this test... ;)


'- test example for new lionmodule for thinbasic, 30.mai.2009 by lionheart

uses "LIONGFX"

liongfx_WindowTitle "LIONGFX: Test for new thinbasic Lionmodule :) "

liongfx_ScreenRes 800, 600, 32

dim x, y as long
For x = 1 To 800
For y = 1 To 600
liongfx_PSet x, y, x * y
Next
Next

randomize

liongfx_Locate 5, 20
liongfx_Print "What about some colored circles? Press any key to see!"
liongfx_Sleep

liongfx_WindowTitle "Press only ESCAPE key to stop this drug"
dim CountCircles as quad = 50000
dim ch as string
dim T1 as double = TIMER
Do
incr CountCircles
ch = liongfx_Inkey
liongfx_locate 10, 75
if ch <> "" then liongfx_Print "[" & ch & "]"
liongfx_Circle rnd(100,550), rnd(100,360), rnd(10,220), rnd(1, RGB(255,255,255))

Loop Until ch = chr$(27)

dim DeltaTime as double = (timer - T1)
if DeltaTime = 0 then DeltaTime = 0.0001

msgbox 0, "..sorry for stressy moments, all is ok with your eyes?"

liongfx_Locate 5, 50
liongfx_Print "This test was performed in " & format$(DeltaTime, "#0.000") & " secs. "
liongfx_Locate 10, 50
liongfx_Print "Beautiful Circles on screen: " & CountCircles
liongfx_Locate 15, 50
liongfx_Print format$(CountCircles/DeltaTime, "#0") & " circles x second"
liongfx_Locate 20, 50
liongfx_Print "Thanks a lot for your time. Press a key to end."
liongfx_Sleep


info: add all in zipfile...
(*.dll and *tbasic file)

any feedback would be nice ;)

servus, nice day, Lionheart

Lionheart008
30-05-2009, 18:02
hi again :)

... so I need perhaps professional advice for my "vertex" idea ;)

what can I use for "vertex" as dimension without using open gl commands ? it's possible at all or totally rubbish ? ;)


dim vertex as long
dim vertex as double ' that's perhaps... nonsense ..
dim vertex as point ' would be better...

I would like to go another way instead of...


glBegin gl_Points
glColor3f 1.0,1.0,0.0 :' yellow
glVertex3f 0.5, 1.0, -6.0 :' 1. Point
glVertex3f -0.5, 1.0, -6.0 :' 2. point
glVertex3f 0.0, 2.0, -6.0 :' 3. point
glEnd



...my code part idea...



...
thinBasic_ParseDouble(lx.y, lx.x)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then

Vertex (lx.x, lx.y, lx.z), lSize, lColor
...


hmh, would be great to get any idea or suggestion for help.. thanks in advance ;)

best regards, Lionheart

Michael Hartlef
30-05-2009, 18:28
Well, I'm not sure what you are after. Are you talking about how a new command should like or how should handle it inside FB? A vertex can have 2 or 3 dimensions. That has nothing to do with OpenGL, DirectX, GDI, what so ever. A vertex is a structure that will store the coordinates or a location, either with 2 or 3 dimensions.




thinBasic_ParseDouble(lx.y, lx.x)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then

Vertex (lx.x, lx.y, lx.z), lSize, lColor

Is there a parsing function thinBasic_ParseDouble inside the FB SDK? :read:

Lionheart008
30-05-2009, 18:51
chapter four: my "fourth dll test" ;)

ONE:

uhps... ! :D

...more good exercises for testing dll creation... have built this early morning a clone sister of "oxygen" module... called "LION" to learn with this great power to handle... :P I see this work it only as DLL example... don't forget ;)


'-- THE HELLO PROGRAM FOR LION MODULE

uses "lion", "console"

lio2_basic " print `Hello Frankolino ! may be this is the rising of a new bright star at the sky ` : terminate "
lio2_exec

printl "hey, this is a good new for oxygen and lion module !"

msgbox 0, "Hello, I am not alone in the darkness :) "

the script works... the LION is roaring, using for living this time fully oxygen power (the children must learn to walk so I pushed it for the start!)... and if I am not standing alone in the darkness.. it will works for new functionality... I will proof it the next days...
many thanks to charles and all his fantastic examples... without this new oxygen power module I never had have the idea to struggle for an own thinbasic module ... this oxygen module give me nearly daily motivation :D !

info about my "hello-lion" example: only the message window say it's "o2", but it's "LION" made... little make-up mistake...
I haven't yet managed it to say this script belongs to "LION" module... may be I can find it in "thincore" ???

info: all done in zip file... a) thinbasic_lion.dll and b) "Hello Lion" script for testing...

TWO:
@michael... thank you, I will check it again... have some time problems at the moment because of my second job (puh) and it seems to be a FB task but didn't found any good hint about this problem... more to come... I find a way and say it to you :)


Is there a parsing function thinBasic_ParseDouble inside the FB SDK?
answer: yes ! ;)

best regards, Lionheart

ps: better was to name the four example above as "franzi.dll", "maria.dll" or "foo.dll" to avoid confusion, but people who like to program they are in a exciting mood and I am a little bit crazy last days with these things, you can imagine :)

Petr Schreiber
30-05-2009, 19:06
Hi Frank,

no offence, but you are little bit like a squirrel - jumping from tree to tree :)

Maybe we could help you better if you could present us your vision for module and its command syntax. You already presented 3 versions of lion module, each doing completely different things.

When you need to parse 2 or 3 numbers, you can use following:

thinBasic_ParseXNumbers(2, 3, a, b, c)


Petr

Lionheart008
30-05-2009, 19:23
short :)

hi petr...
all...


no offence, but you are little bit like a squirrel - jumping from tree to tree Smile

"better to burn out than fade away" ;)
(neil young, rust never sleeps !)

yes it's ok and I am in some way guilty for confusing, but it's not the problem here :)

a) my first example was an external dll test with declare function and how michael has seen it quite right an extern DLL... was just the first example for me to test thinbasic.dll things... so I did this first step ;)

b) the "liongfx" example shows the first really own module power for thinbasic so I am be proud of it :) I have used the fbgfx example from FB to make it...

c) this direction I will go with some kind of similar power of oxygen and would like to use graphic commands to realize colour things (lion-painting) and effects (lion-fx) and some more things like nurbs (lion-nurbs) scripts for thinbasic...

that was my idea the last day, better the last nights !!!... it takes time to become a closer project... I cannot say a lot of things about it... this idea must take time, but the more I work with different scripts... the more I can say you more about my LION module project... Four days ago I haven't any idea how to build an DLL for thinbasic and until today I have realize that it can works... I am happy about it :)

do I can help you with this added infos ? ;)

thanks for

When you need to parse 2 or 3 numbers, you can use following:
Code

thinBasic_ParseXNumbers(2, 3, a, b, c)

I will test it... must go now at work.. I am a little bit in a stressy time today and tomorrow! therefore I concentrate all the things and focussed it here with several inputs... must laugh :D. I can say more about the module the next days... have patience :)

best wishes, Lionheart

Lionheart008
03-06-2009, 19:59
sorry... dear thinbasic friends, I have deleted this post... one more good as running example will be better than write a bible about virtuell problems, better to solve it from me ;)

thanks, Lionheart

Michael Hartlef
03-06-2009, 21:04
Sorry Franck, I have a very hard time understanding your english. Maybe it is just me. Drop me a PM in german if you want.

Michael Hartlef
03-06-2009, 21:08
And to answer some things I understood, there are 2 things a module can do for you. You can create new thinBasic commands or create a wrapper for an external DLL. 99,9% of the time it is not just calling another command. The sources of my modules are open so if you take your time, you will see that it takes much much more then this. And 99,9% of the time it is forbidden by a license to just replicate a command by just calling it.

Lionheart008
03-06-2009, 21:38
hi michael, sorry, I was in a hurry... having had fun with sports (squash)...

for me it's better to say or show my thoughts with more words than to reduce it, because I am not very familiar with coding words in english ;)


And to answer some things I understood, there are 2 things a module can do for you. You can create new thinBasic commands or create a wrapper for an external DLL. 99,9% of the time it is not just calling another command. The sources of my modules are open so if you take your time, you will see that it takes much much more then this. And 99,9% of the time it is forbidden by a license to just replicate a command by just calling it.

ok, thanks! :) I have understood it, yes...


Drop me a PM in german if you want.

ok again, I will do that :)

I have no problem to ask here... better one more time than loosing my head :D

best regards, Lionheart
ps: a new "thinbasic_liongfx.tbasic" example will follow... to show what I am meaning...

Lionheart008
03-06-2009, 23:17
hi all:)

perhaps somebody with freebasic knowledge can check this code part, if it's wrong or ok ;) - for me it's totally ok!

part one:

sub Exec_LIONGFX_LINE()
'----------------------------------------------------------------------------
'
'----------------------------------------------------------------------------

Dim ParensPresent As Long
Dim lX1 As Long, lY1 As Long
Dim lX2 As Long, lY2 As Long
Dim a as integer, b as integer
Dim lRadius As Double
Dim lColorPresent As Long
Dim lColor As long
Dim lR as long ,lG as long, lB as long


'---Check if open parens is present
ParensPresent = thinBasic_CheckOpenParens_Optional

thinBasic_ParseLong(lX1)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lY1)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lX2)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lY2)
thinBasic_ParseLong(lR)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lG)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lB)

LINE (lX1, lY1)-(lX2,lY2),RGB(lR, lG, lB),b
'LINE (20, 20)-(300, 180), RGB(255,0,0), b

EndIf
ENDIF
ENDIF
ENDIF
ENDIF
If ParensPresent = TB_TRUE Then thinBasic_CheckCloseParens_Mandatory

End sub

compilation was done with success :)

but the thinbasic example doesn't have fun to work with "line" part... circles are working very well ;)

code part two...


Do
incr CountCircles
ch = liongfx_Inkey
liongfx_locate 10, 75
if ch <> "" then liongfx_Print "[" & ch & "]"
liongfx_Circle rnd(100,540), rnd(100,380), rnd(10,200), rnd(1, RGB(255,255,255))
liongfx_LINE (100,100)-(300,200), rgb(255,0,0), b '- here's the problem line! :)

Loop Until ch = chr$(27)

ok, some good advices are very welcome :)

best regards, Lionheart

Michael Clease
03-06-2009, 23:40
you check for (
then a long
then a ,
then a long
then a ,
then a long
then a ,
then a long
then a long
then a ,
then a long
then a ,
then a long
then a )

so your calling command would look like this liongfx_LINE(x1,y1,x2,y2 r,g,b)
but i dont know what TB would do with the "y2 r" because you dont check for a comma

ParensPresent = thinBasic_CheckOpenParens_Optional
thinBasic_ParseLong(lX1)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then thinBasic_ParseLong(lY1)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then thinBasic_ParseLong(lX2)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then thinBasic_ParseLong(lY2)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then thinBasic_ParseLong(lColour)


liongfx_LINE(x1,y1,x2,y2,Colour)
liongfx_LINE (100,100,300,200, rgb(255,0,0))

Lionheart008
04-06-2009, 01:19
hi michael "abraxas" :)

thank you for your very welcome script part... good idea... but freebasic calls a "line" command in this case... so far as I know... ;) looks like this one... and works



screen 17, 32
sleep 500
LINE (20, 20)-(300, 180), RGB(255,0,0), b
sleep 1000


or


LINE (x, y)-(x1, y1), RGB(255,0,0), b

I have checked all possibilities but without success... the thinbasic script with "line" command or other thing (I cannot find) must be the problem...

@charles...
-send you here my whole script project as zip-file: *.bas, *.dll, *.tbasic :)
-have "thinbasic_liongfx" compiled with FB and was ok...

a) thinbasic script: first part of script is ok
b) second part with "liongfx_line" is still the main problem, so I have got here an error message... push escape key and you will see... perhaps you can check it... would be great...

good night... see you, Lionheart :dog24:
ps: I have deleted the zip file and add a new working fine one in my next post of thursday

Charles Pegge
04-06-2009, 04:40
Hi Frank,

Got your code working by matching the params and syntax on the thinBasic side.

Your FB code is not expecting the b parameter.

And in your FB parsing of LINE, you check for an optional left bracket at the start and a mandatory right bracket at the end (if the left bracket was present). So to match these parsing rules:




Do
incr CountLines
ch1 = liongfx_Inkey
liongfx_locate 20, 80
if ch1 <> "" then liongfx_Print "[" & ch & "]"

''PROBLEM LINES
''-------------
'' liongfx_Line (100,100)-(300,200), rgb(255,0,0), b
'' liongfx_Line (100,100),(300,200), rgb(255,0,0)', b
'' liongfx_Line (100,100,300,200, rgb255,0,0) ', b
'
'BUT THESE WORK
''--------------
liongfx_Line (100,100, 300,200, 255,0,0) ', b
liongfx_Line 100,100, 300,200, 255,0,0 ', b
liongfx_Line rnd(0,100),rnd(0,100), rnd(0,300),rnd(0,200), rnd(0,255),255,255 ', b
Loop Until ch1 = chr$(27)

ErosOlmi
04-06-2009, 06:15
Hi Frank,

sorry for yesterday evening. I promised to check code but I fall sleeping as soon as I returned back from work :zzz:

Charles and Michael are right.
First you need to decide syntyax of "liongfx_Line" command.
When done, follow it step by step in module parsing.

So if syntax is liongfx_Line(x1, y2, x2, y2, lColor) than follow it in module.
Attention RGB(r,g,b) is just a single numeric expression, you do not have to parse all parameters, thinBasic will do it for you. Unless you want to parse something like: liongfx_Line(x1, y2, x2, y2, r, g, b)

Ok, we have decided that the syntax is liongfx_Line(x1, y2, x2, y2, lColor)
Your module code to parse the above syntax is something like:


Sub Exec_LIONGFX_LINE()
'----------------------------------------------------------------------------
' syntax: liongfx_Line(x1, y2, x2, y2, lColor)
'----------------------------------------------------------------------------
Dim pp As Long
Dim lX As Long , lY As Long
Dim lX1 As Long , lY1 As Long
Dim lColor As Long

'---Check if open parens is present
pp = thinBasic_CheckOpenParens_Optional

thinBasic_ParseLong(lX)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lY)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lX1)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(ly1)
If thinBasic_CheckComma_Mandatory = TB_TRUE Then
thinBasic_ParseLong(lColor) '---This is just a single numeric expression regardless what will be used to pass a numeric value

Line (lX, lY)-(lX1, lY1), lColor

End If
End If
End If
End If

If pp = TB_TRUE Then thinBasic_CheckCloseParens_Mandatory

End Sub



Hope to be of any help.
Ciao
Eros

Lionheart008
04-06-2009, 09:21
@ good morning dear thinbasic medicine help doctors :eusaclap:

I am sooooo glad to see it works... :D - thanks to all (michael h., michael c., charles :D, eros...) for this good help and infos, that's the main reason I am here since some month... to learn and it's allowed to make mistake or running new ways with thinbasic to explore unknown terrain ! must laugh... I am in a good mood to catch the next hurdle :locomotive:

my edit of today: I add here the fixed version of "liongfx" thinbasic test script :)

a new idea for liongfx is just waiting... see you, have all a nice day, Lionheart :dog16:

Lionheart008
05-06-2009, 00:26
my little 5 cent for this night :D

no really time last day to create new things... but I have played around with this liongfx example with well known coding stuff (fbgfx!), translated for my purpose and so it looks like this one...


'Plasma-like effect with liongfx
uses "liongfx", "console"

Dim T1, T2 As QUAD
Dim w,h As Double
w=400
h=350

'---Initialize hi resolution timer
HiResTimer_Init

liongfx_ScreenRes(w,h,32,2)

Dim x,y,page As Double
Dim c,t As Double

T1 = HiResTimer_Get
t=t+1
For x = 0 To w
For y = 0 To h

c=(Cos((x+y+t)/100)+Cos((x-t)/100)+Cos((y-t)/100)+Cos((x-y+t)/100))*2+Sin(t/100)*15
liongfx_PSet(x,y,Rgb(Sin(c)*64+128,Cos(c)*64+128,Cos(-c/2)*64+128))
liongfx_PSet(x,y,Rgb(Cos(c)*32+128,4*rnd*Cos(c)*32+128,log(-c/2)*64+128))
'liongfx_Circle rnd(100,540), rnd(10,380), rnd(10,200), rnd(1, RGB(255,255,255))
Next
printl " just an liongfx learning script :) " + int(rnd(1)*400), "Ciao Julius Cesar! " + int(rnd(1)*400)

Next

T2 = HiResTimer_Get
MSGBOX 0, "Elapsed time in microseconds: " & format$((t2-t1)/1000000, "#.000") '- (t2-t1)/1000000
sleep 5000
page=-page+1
liongfx_ScreenSet(page,-page+1)
'printl
'printl "press any key to exit"
'waitkey
stop

ok, I have included two different functions, not very new things, but was a good exercise to learn for me... and you can test also your machine for speed ;)

more to come, hope it works, good night, Lionheart :zzz:

Lionheart008
11-06-2009, 23:37
hi dear animal friends...
hi charles... have done it ;)


Your FB code is not expecting the b parameter.

well, one little progress for thinbasic / lionmodule (liongfx)... I managed to create a new box line for lines... one more little good thing for thinbasic, but for me very important to understand the lines commands ;)... now it's just missing the box should be filled too.. I will do it this little new feature for the next time ...

old: liongfx_Line (60,60, 300,260, 0,0,255)
new: liongfx_line (40,40, 300,260, 0,0,255,4)
info: the last number (here "4") is important for the rectangle !

my advice: push "escape" for the three divided example... to come forward and see what happens...


'-- more input for tb module liongfx, here: rectangle :), 10.juni.2009

uses "liongfx", "console"

liongfx_WindowTitle "thinbasic liongfx: Test 0.3c for new thinbasic Lionmodule by FreeBasic"

liongfx_ScreenRes 800, 600, 32

dim x, y as long
For x = 1 To 800
For y = 1 To 600
liongfx_PSet x, y, x * y
Next
Next

randomize

liongfx_Locate 5, 20
liongfx_Print "What about some colored circles, lines, rectangles? Press any key to see!"
liongfx_Sleep

liongfx_WindowTitle "Press only ESCAPE key to stop this drug :) "
dim CountCircles as quad
dim CountLines as quad
dim ch, ch1 as string
dim T1 as double = TIMER

Do
incr CountCircles
ch = liongfx_Inkey
liongfx_locate 10, 75
if ch <> "" then liongfx_Print "[" & ch & "]"
liongfx_Circle rnd(100,540), rnd(100,380), rnd(10,200), rnd(1, RGB(255,255,255))
Loop Until ch = chr$(27)

Do
incr CountLines
ch1 = liongfx_Inkey
liongfx_locate 30, 80
if ch1 <> "" then liongfx_Print "[" & ch & "]"

liongfx_locate 60+ rnd*10, 20+rnd*30
liongfx_color 255, 60
liongfx_print "enjoy... new lions gfx effect !"

liongfx_locate 20+ rnd*10, 10+rnd*30
liongfx_Line (60,60, 300,260, 0,0,255,4,2)
liongfx_Line (100,100, 300,200, 255,0,0,16,4)
liongfx_Line (100,100, 300,200, 255,0,0,16,8)
liongfx_Line (200,200, 400,300, 128,60,0,16,16)
liongfx_Line (rnd(20,100),rnd(40,100), rnd(128,300),rnd(0,200), rnd(100,255),60,255,24,24)
Loop Until ch1 = chr$(27)


dim DeltaTime as double = (timer - T1)
if DeltaTime = 0 then DeltaTime = 0.0001

msgbox 0, "..sorry for more coloured stress, all is ok! :) "

liongfx_Color 255,10
liongfx_Locate 8, 50
liongfx_Print "This test was performed in " & format$(DeltaTime, "#0.000") & " secs. "
liongfx_Locate 10, 50
liongfx_Print "Beautiful Circles on screen: " & CountCircles
liongfx_Locate 15, 50
liongfx_Print "more crazy Lines on screen: " & CountLines
liongfx_Locate 20, 50
liongfx_Print format$(CountCircles/DeltaTime, "#0") & " circles x second"
liongfx_Locate 25, 50
liongfx_Print format$(CountLines/DeltaTime, "#0") & " lines x second"
liongfx_Locate 30, 50

liongfx_Print "Thanks a lot for your time. Press any key to end."
liongfx_Sleep


the files test_liongfx_screenres3c.tbasic and test_liongfx_screen_F.tbasic example I have included in the zipfile plus liongfx.dll :)

have fun with it, best regards, Lionheart
ps: have included a second example liongfx_screen_F.tbasic file for testing...

Lionheart008
12-06-2009, 01:50
...have forgotten to show the code of the second script: test_liongfx_screenF.tbasic :D


uses "liongfx"

liongfx_WindowTitle "Thinbasic Screen_F test for liongfx module"

liongfx_Screen 18, 32

dim x, y as long
For x = 1 To 640
For y = 1 To 480
liongfx_PSet x, y, x * y
Next
Next

randomize

dim MaxLines as long = 10000
liongfx_Locate 5, 25
liongfx_Print "What about " & MaxLines & " colored lines ? Press any key to see!"
liongfx_Sleep

'---Clear screen
liongfx_Cls

for x = 1 to MaxLines

liongfx_locate 20+ rnd*10, 10+rnd*30
liongfx_Line (60,60, 300,260, 0,0,255,4,2)
liongfx_Line (100,100, 300,200, 255,0,0,16,4)
liongfx_Line (100,100, 300,200, 255,0,0,16,8)
liongfx_Line (200,200, 400,300, 128,60,0,16,16)
liongfx_Line (rnd(20,100),rnd(40,100), rnd(128,300),rnd(0,200), rnd(100,255),60,255,24,24)
liongfx_Line (rnd(40,120),rnd(80,120), rnd(250,360),rnd(80,200), rnd(20,255),0,55,224,24)
next

for x = 1 to 10
liongfx_Locate rnd(1,28), rnd(1,60)
liongfx_Print "Hi there in sydney and rome " & x
next

liongfx_Locate 1, 1
liongfx_Print "Test performed successfully!. Thanks for your cooperation. Press a key to end."
liongfx_Sleep


that's all for this night, servus and salve, cheerio, Lionheart
:dog16:

ps: do you think it's worth to develop further this ex-fbgfx module for thinbasic ??? I have done only one or two per cent from hundred ;)

ErosOlmi
12-06-2009, 06:17
ps: do you think it's worth to develop further this ex-fbgfx module for thinbasic ??? I have done only one or two per cent from hundred ;)


Hi Frank.

In some sense, developing a thinBasic module is a kind of responsibility assumption.
If you develop it just for fun or to show other how to do or for learning/teaching purposes, that's ok, no problem: you can decide what you want.
But if you develop it for distribution, you have to think other people will base their work on it so you should think about maintain it, further develop, be open to user requests, make documentation, ... and so on.

So, in my opinion, you can answer by yourself to your question depending where you want to go with your module.

Ciao and thanks a lot for your many nice works.
Eros

Michael Hartlef
12-06-2009, 07:09
hi frank.

I guess you asked this because you didn't got much response about it.

Like Eros said, what is the purpose of this module? For fun, to learn, to give other tb users a new toolset? The motivation to develop a module can come from so many directions. For me it was that

1. Wanted to give myself some new commands
2. Give something back to Eros for developing tb
3. Learn more about coding

In small communities like ours you will not get much response. Hell I am not even sure if someone uses tbem or tbdi. Or how many will use the new sprite commands. But that is fine with me. Because i had fun creating all this stuff. I know i finished things. The problem with a lot of coders is that 99,9% of them won't finish projects they have onced. Why?

At the beginning of a project it is fun. Things are running smoothly. But later on it becomes work. Simply work and a lot of it. Most people loose interest then.
And developing a module is hard work. Designing and coding it. Write a helpfile for it. Samples. Test it. And you are not sure if other people will use it.

Do it for yourself. Make a plan and follow it.

ErosOlmi
12-06-2009, 07:27
Exactly Michael. Plus a bit of auto-motivation is not bad.

It is hard to reply to Frank question. Why say yes or no? On what basis I can tell you: "yes, it is worth to go on" or "no, it is not worth"?

When things do not go into the direction one expect, auto-motivation makes the difference.
I would have stopped thinBasic many years ago without auto-motivation reasons.

So, as Michael said: if it is in your list of interests, make a plan and follow it even if you will not get much responses.
Our replies can seem a bit rude but are honest (I suppose);)

Ciao
Eros

Lionheart008
12-06-2009, 16:16
hi michael, eros, thank you so much for your honest and helpfully reply... :D

I was very tired last night... but today it's quite another power again in me ;) I will go the hard way and try to create my own module and climb up new mountains... perhaps with a little help from my friends (joe cocker!)... and I am eager enough to learn with new module technology and coding for thinbasic :)
"auto-motivation" is not the main problem for me I see it's a time problem for me !

@michael
The motivation to develop a module can come from so many directions. For me it was that ...

for me: - learning coding language with thinbasic
- I love and like a lot tbgl, oxygen and special effects
- to see how easy or hard it is to jump over walls I never wanted to try it some
month before and I am glad about this very good feeling
- and I like the community with often very good feedback and help :)

now I see the next hurdles and perhaps charles, eros, michael, petr or another guy can help here...


dim myliongfxSprite() as byte

createsprite mysprite(), spritesize, spritesize
'put (-spritesize+rnd*(xRes-1+spritesize), -spritesize+rnd*(yRes-1+spritesize)), myliongfxSprite, PSET


I will try to define a "sprite" for the next script and the thinbasic code is ready since one week, only the fb compiling becomes strange for me at the moment... I will check it ;)
ok, it was not intended to go the same way as at the board are similar topics about sprite themes, but to create a rectangle with a picture or circles and lines will be the next step for me and the liongfx module ! :D

the example did it in the old tbgl way... to create a sprite... it was only an example for me to learn this way too... cause I have never built this kind of sprite examples before... no joke ! michaels and petr's new tbgl-sprite power it's quite another great theme :D !

@eros:
So, as Michael said: if it is in your list of interests, make a plan and follow it even if you will not get much responses.

yes, I will make a good structured and organized plan for the module... that's very important for me... because I am sometimes chaotic in daily life... uargh :dog24:

best regards, Lionheart and fit again 8)

ps: the demo for my next idea you can see in the zip folder of liongfx-testsprite ;)
pps: I am loyal with thinbasic and would like to become grown up with this language !

Michael Hartlef
12-06-2009, 17:40
ok Franck, so where is the problem? Did you wanted someone to help you? :?

The first file (thinBasic) ran fine. The second one didn't had any sprites in it, right? And was a FreeBasic compiled executable?

It ran fine but what does that have to tell me now?

Lionheart008
12-06-2009, 18:26
hi michael...


It ran fine but what does that have to tell me now?

... ok ;) must grinning, the two examples I have submitted were intended in the right way... the first one how to build a sprite example with tbgl, but without the new sprite commands, was only one example for me how to build it and yes, works very fine :) ...

I am looking for a definition for a "sprite" (image) to compile it from freebasic into thinbasic example script... therefore I have tried to show this second example what it's my next aim...

dummy code example like this one:


dim myliongfxSprite() as byte

createsprite mysprite(), spritesize, spritesize
'put (-spritesize+rnd*(xRes-1+spritesize), -spritesize+rnd*(yRes-1+spritesize)), myliongfxSprite, PSET

now I am just looking for a "sprite" or "image" definition... as I am not sure what kind of dimension an image or a sprite need...

for eg.

Img = Imagecreate(64, 64, RGBA(64, 160, 0, 255))
Dim Img as byte '-- (that's right???)
Circle Img, (32, 32), 28, RGBA(255, 0, 0, 128),,,,F


my idea was: img = x_width, y_heigth, d_bitmap (d=for depth) ...

I cannot handle yet with a User defined Type...(it's not important in my eyes for my purpose), that's all... hope you can follow me... ;)

I try to write down the Sub Exec_LIONGFX_IMAGE() so you can better see what I am meaning.

best regards, thanks, Lionheart

Michael Hartlef
12-06-2009, 19:00
Franck,

maybe it is my missing knowledge of FreeBasic, but how you post code is not understandable for me.

Like for an example



I try to write down the Sub Exec_LIONGFX_IMAGE() so you can better see what I am meaning.


Where did you write it down? In your last post?

What you wrote there is a very weird command syntax which I cannot understand. Is this FreeBasic code?

Are ImageCreate, CreateSprite, Circle Img (a command with a space between it?) FreeBasic commands?

I suggest you post the code you have from your freebasic module, or I won't be able to help. To me this is to much guessing.
And please describe what you are trying to do. I mean, are you using OpenGL for your graphics, or native FreeBasic commands.

Or does someone else here understand what Franck is talking about? :(

Lionheart008
12-06-2009, 19:20
hi michael,

yes, the most part it's from freebasic commands and you are perhaps not so familiar with it (must laugh), I don't want to confuse you any more, but it doesn't matter... I manage it... and send an example like the posts from eros and charles from 04. juni...


Are ImageCreate, CreateSprite, Circle Img (a command with a space between it?) FreeBasic commands?

yes and much more ... :) I thought until the last week the basic languages are in the most way similar.. but there are some serious differences !

ok, no problem, nevertheless, thank you for spending time for my posts...

here a simple freebasic example with an "imagecreate" command that works very fine :)


screen 19,32
dim image as any ptr
image = imagecreate(101,101,rgb(255,255,255))
circle (50,50),50,rgb(255,0,0)
get (0,0)-(100,100),image
put (100,100),image,pset
sleep

I will try to translate it for my liongfx module... and I am sure I will find a way ;)

see you, nice evening, walking now with dog ... I have really good mood this day...
Lionheart

Michael Hartlef
12-06-2009, 21:35
hi michael,

yes, the most part it's from freebasic commands and you are perhaps not so familiar with it (must laugh)


enjoy your laugh :shock:


I don't want to confuse you any more, but it doesn't matter... I manage it... and send an example like the posts from eros and charles from 04. juni...


Are ImageCreate, CreateSprite, Circle Img (a command with a space between it?) FreeBasic commands?

yes and much more ... :)


Cool, and I thought FreeBasic had just IF THEN ENDIF PRINT as commands. :roll:


ok, no problem, nevertheless, thank you for spending time for my posts...


Don't worry, it won't happen again. :comp12:

Lionheart008
12-06-2009, 22:50
hi michael :)


enjoy your laugh Shocked

sorry, don't misunderstand me.. I am laughing about this strange theme to myself... if you are going into a strange forest you cannot see sometimes the easiest way to get out again... and it's a english forum... I can tell often the sense and contents of the post better in german language but so I can improve my english too and I am always open for new jokes and the shame is sometimes on my side ;) now you can laugh! :D

by the way: freebasic is quite ok and have very nice features... I have started with qbasic fifteen years ago by a training course at the evening (university göttingen) and it was a good feeling to find a well understanding scripting language like thinbasic for me :)



Cool, and I thought FreeBasic had just IF THEN ENDIF PRINT as commands
thank you, a good counter ! ;) so I must laugh again... I take it with humour...

a little gift for you: do you know bonzai 3d ???
http://www.bonzai3d.com/bonzai3d_homeN.html

cheerio, Lionheart

Lionheart008
16-06-2009, 11:48
dear thinbasic liongfx users :)
ok... my 40 cents for this day and the next ones ;)

little update for the liongfx module... to take off... then I have to learn and study again for my exam tomorrow and much more... (I have a stressy white face!)... :)

I have included new functions as follow, you can test it... !

liongfx_len
liongfx_buf
liongfx_get
liongfx_put

I add here only the last example (changed a little bit) and you can see it works only with uses "Liongfx" :D I am proud of it... as it wasn't so easy as I have thought ...

@charles or somebody else ;) my not very important question:


variable = Get(#file, [position], variable)
btw: how can I define "#file" syntax (freebasic!) to open or search for a file ??? ;)


'------ new liongfx function len, buf, get, put :), 15.juni.2009 by lionheart (f.brübach)

uses "liongfx"

liongfx_WindowTitle "Thinbasic Screen_F1 (len,buf,get,put) test for liongfx module"

liongfx_Screen 18, 32

dim x, y as long
For x = 1 To 640
For y = 1 To 480
liongfx_PSet x, y, x * y
Next
Next

randomize

dim MaxLines as long = 10000
liongfx_Locate 5, 25
liongfx_Print "What about " & MaxLines & " colored lines ? Press any key to see!"
liongfx_Sleep

'--- new function for liongfx
liongfx_put, 2, 3, 6
liongfx_get, 1, 2, 5
liongfx_len, 4
liongfx_buf, 2,4

'---Clear screen
liongfx_Cls

for x = 1 to MaxLines

liongfx_locate 20+ rnd*10, 10+rnd*30
liongfx_Line (60,60, 300,260, 0,0,255,4,2)
liongfx_Line (100,100, 300,200, 255,0,0,16,4)
liongfx_Line (100,100, 300,200, 255,0,0,16,8)
liongfx_Line (200,200, 400,300, 128,60,0,16,16)
liongfx_Line (rnd(20,100),rnd(40,100), rnd(128,300),rnd(0,200), rnd(100,255),60,255,24,24)
liongfx_Line (rnd(40,120),rnd(80,120), rnd(250,360),rnd(80,200), rnd(20,255),0,55,224,24)
liongfx_Line (rnd(80,160),rnd(120,180), rnd(100,260),rnd(120,300), rnd(40,255),0,255,224,24)
next

for x = 1 to 10
liongfx_Locate rnd(1,28), rnd(1,60)
liongfx_Print "Hi there in berlin and rome " & x
next

liongfx_Locate 1, 1
liongfx_Print "Test performed successfully!. Thanks for your cooperation. Press a key to end."
liongfx_Sleep


best regards too all they must learn and study too 8) if there is more time I'll build a new example with the new functions ...

cheerio, Lionheart, have all a nice day...
ps: zip file includes liongfx dll and the thinbasic script for testing :)

Charles Pegge
17-06-2009, 08:32
Hi Frank,

To answer your question about FreeBasic File # commands syntax, if I understand it correctly, you can use the thinCore function below to extract words or tokens from the script and interpret them on the module side.

File i/o syntax is quite complicated, (The FB manual covers it quite well.) but if you want to emulate it in the TB script, this will allow you to interpret syntax of any kind with your own rules.

But I have not tried it myself so far - I think BASIC is better when it keeps its parsing rules regular.

Charles

PS: Good luck with your exams!




'----------------------------------------------------------------------------
'thinBasic_GetToken
'----------------------------------------------------------------------------
' Returns the next token as string.
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_GetTokenName _
LIB "thinCore.DLL" _
ALIAS "thinBasic_GetTokenName" _
( _
_ ' OPTIONAL
BYVAL AutoPutBack AS LONG _
) AS BSTR

Lionheart008
19-06-2009, 16:26
hi charles, hi all dear thinbasic friends :)

examination was ok but in four of five cases I have got only "good" (90-94 points of 100) results... not "very good" (one course I managed with fantastic 99 from 100 points!!!) and our calculation and "to build a factory" tasks with access and excel module were horrible hard! ;) the teacher wanted to nerve us... so we have made some trouble... with success... Now I am ready for the green isle with blue water to see nothing about ms office module... :) this chapter is done for ever...

thank you charles for your "GetTokenName" help .. I will try to use it for my module, but I am not sure to make it until next week...

my last example / try with the thinbasic lionmodule belongs to the last days... manipulated the thinbasic source code and uses again the liongfx dll ...


'------ new liongfx function len, buf, get, put :), 17.juni.2009 by lionheart (f.brübach)

uses "liongfx"

liongfx_WindowTitle "Thinbasic second Screeny_Test for liongfx module"

liongfx_Screen 18, 32

dim x, y, i as long
dim w, h, d, f as long = rnd(32,64)

randomize timer

for x = 1 to 640
For y = 1 to 480
liongfx_PSet rnd*x, rnd*y, rnd*x *rnd*y
next
next
sleep 5000

dim MaxLines as long = 25000
liongfx_Locate 5, 20
liongfx_Print "What about " & MaxLines & " lines or boxes ? push a key and wait.."
liongfx_Sleep

'--- new function for liongfx
liongfx_put, 2, 3, 6
liongfx_get, 1, 2, 5
liongfx_len, 4
liongfx_buf, 2,4

'---Clear screen
liongfx_Cls

liongfx_Locate 25, 40
liongfx_color 200,40
liongfx_Print "wait a moment and push 2x return again.. "
sleep 100
liongfx_Cls

for x = 1 to MaxLines

liongfx_locate 20+ rnd*10, 10+rnd*40
liongfx_Line (60,60, 300,260, 0,0,255,4,2)
liongfx_Line (100,100, 300,200, 255,0,0,16,4)
liongfx_Line (100,100, 300,200, 255,0,0,16,8)
liongfx_Line (200,200, 400,300, 128,60,0,16,16)
liongfx_Line (rnd(20,100),rnd(40,100), rnd(128,300),rnd(0,200), rnd(100,255),60,255,24,24)
liongfx_Line (rnd(40,120),rnd(80,120), rnd(250,360),rnd(80,200), rnd(20,255),0,55,124,24)
liongfx_Line (rnd(80,160),rnd(120,180), rnd(100,260),rnd(120,300), rnd(40,255),0,255,224,24)
liongfx_Line (rnd(20,80), rnd(-100,-100), rnd(120, 300), rnd(25, 250), rnd (140,255),60,155,24,16 )
next

for x = 1 to 10
liongfx_Locate rnd(2,28), rnd(2,60)
liongfx_Print "Hi asterix and obelix " & x
next
liongfx_Cls

liongfx_Locate 2, 2
liongfx_Print "liongfx test was ok. Press any key to follow next step.. "
liongfx_Sleep

for y = 1 to 14
liongfx_color rnd(10,255),26
liongfx_Locate rnd(1,30), rnd(1,60)
liongfx_Print "GFX living mode: " + STR$(w) + "F " + STR$(h) + "B " + STR$(d) + "L " + STR$(f) & y
next
liongfx_Locate 22,25
liongfx_color 50,255
liongfx_Print "Good night dear Elephants :)"

liongfx_Sleep

somebody who wants to use this "screeny" test example - have fun with it... and perhaps anybody can say if it's working fine... or not...

best regards, I am very tired, but with a good mood in heart and brain :D
ps: and I have still no idea what's going on here with new games and global moderators ;)

Petr Schreiber
19-06-2009, 16:34
Hi Frank,

example worked fine, I liked the first "scene" most.

Do not worry about "good", as long as it means "passed" it is ok :)


Petr

Lionheart008
19-06-2009, 22:17
hi petr...
hi all :)

thanks for testing my last scene, it was important for me to see if this script works, because on my old notebook machine there are sometime troubles while running the lionmodule executing from thinair... don't know why... my desktop pc has no problem :)

here one more, very little, but nice picture... (only one picture) I think more about a kind of a tv test picture, so I made some experiments with this script... everybody can do it in the same way... feel free to manipulate some values of the lines or add new ones ;)


'------ new liongfx function :), 19.juni.2009 by lionheart

uses "liongfx"
dim x, y, i as long
liongfx_WindowTitle "Thinbasic third Screeny_Test for liongfx module"

liongfx_Screen 16, 32

randomize timer

liongfx_color 10,155
liongfx_locate 20, 10
liongfx_print "hey, what's going on here ?"
for i = 40 to 480
liongfx_Line( i,40, i,260, i * 40, i * rnd*140, i * 140, rnd*125,36)
liongfx_Line( i,160, i,180, i * 80, i * 80, i * rnd*80, rnd*255,rnd*124)
liongfx_Line( i,80, i,120, i * rnd*140, i * rnd*140, i * rnd*140, 180,160)
liongfx_Line( i,120, i,180, i * 60, i * rnd*40, i * rnd*40, rnd*180,40)
next i

liongfx_Sleep

enough for today, good evening, Lionheart
ps: don't concentrate too long at the picture, you will be drunken after some seconds :D
pps: script and dll zipped in my file again

Lionheart008
20-06-2009, 11:19
good morning ! :)

one more from the zztop rocking road...

new commands and syntax: imagecreate and imagedestroy (here is a little problem I have to solve the next days...)

one example with new syntax you can use:

liongfx_Imagecreate(64, 64, 64, 160, 0, 255) '-- rgba :)
liongfx_Imagedestroy, 24



'------ new liongfx function :), 20.juni.2009 by lionheart

uses "liongfx"
dim x, y, i as long

liongfx_WindowTitle "Thinbasic third Screeny_Test 3a for liongfx module"

liongfx_Screen 16, 32

randomize timer

liongfx_color 10,155
liongfx_locate 20, 10
liongfx_buf, 200,240
liongfx_Imagecreate(64, 64, 64, 160, 0, 255) 'rgba ! :)
liongfx_Imagedestroy, 24

liongfx_print "hey maria, what's going on here with my eyes ?"
for i = 40 to 480
liongfx_Line( i,40, i,260, i * 40, rnd*255-i*32, i * 140, rnd*125,36)
liongfx_Line( i,160, i,180, i * 80, i * 80, rnd*180-i*32, rnd*255,rnd*124)
liongfx_Line( i,80, i,120, i * rnd*140, i * rnd*140, i * rnd*140, 180,160)
liongfx_Line( i,120, i,140, i * 60, i * rnd*40-i*32, i * rnd*40, rnd*180,40)
next i

liongfx_Sleep


I have used the last script example to add these two new imagecreate / imagedestroy commands... with no error messages... well done.. but

this error message for imagedestroy after compiling with freebasic isn't quite clear for me...


thinBasic_LIONGFX.bas(210) warning 1(1): Passing scalar as pointer, at parameter 1 of IMAGEDESTROY()

I have compiled the script with success, but this error message stayed with me ;)

have all a nice day, here it's raining again.. where is my hot summer??? I need warm, hot, sunny shining days around me with people having bright faces and they are laughing :D

salve, nice and funny day with thinbasic, best wishes, Lionhead

Lionheart008
23-06-2009, 12:20
hi all and good morning :)
dear petr, charles, eros, michaels and all other good guys here ;)

sorry for doing nothing at the moment, but I have not time to check any script or making new input for my lionmodule because my examination period will end at friday (high noon!)


'------ new liongfx function :), 21.juni.2009 by lionheart

uses "liongfx"
dim x, y, z, i,k, p,trans as long

liongfx_WindowTitle "Thinbasic new Screeny_Test 3cc for liongfx module"

liongfx_Screen 16, 32

randomize timer
liongfx_color rnd(10), 200
for x = 1 to 640
For y = 1 to 480
liongfx_PSet rnd*x, rnd*y, rnd*x *rnd*y
liongfx_PUT, 2,6,3,8,p,trans
liongfx_PSet x, y, x *y
next
next
sleep 5000


liongfx_color 10,155
liongfx_locate 20, 10
liongfx_buf, 200,240

liongfx_Imagecreate(64, 64, 64, 160, 0, 255) 'rgba ! :)
liongfx_Imagedestroy, 24
'liongfx_error,
liongfx_put,1,2,3,4,p,trans 'worked as function !

liongfx_print "hey maria, what's going on here with my eyes ?"
for i = 40 to 480
liongfx_Line( i,40, i,260, i * 40, rnd*255-i*32, i * 140, rnd*125,36)
liongfx_Line( i,160, i,180, i * 80, i * 80, rnd*180-i*32, rnd*255,rnd*124)
liongfx_Line( i,80, i,120, i * rnd*140, i * rnd*140, i * rnd*140, 180,160)
liongfx_Line( i,120, i,140, i * 60, i * rnd*40-i*32, i * rnd*40, rnd*180,40)
next i

liongfx_locate rnd(20,50),50
for k = 20 to 120
liongfx_color 100,60
liongfx_Circle( rnd(k),rnd(240), rnd*140 )
next k

liongfx_Sleep


@petr: "example worked fine, I liked the first "scene" most."
so I have used the coloured points scene again ;)

my five cents for today...
a) liongfx_error - better not to use, must grinning, it's making no sense as the scene will not start!

b) liongfx_put
(new compiled as function... but I don't know what's the advantage / disadvantage I can create a command either with a sub or a function... nice to see it! )



liongfx_error, '- better don't use it as the main script will not start ;) !

liongfx_put,1,2,3,4,p,trans 'works as function !

one little new example I add here...

things and efforts they aren't so successful last night (have tried it for about two hours!!!) I cannot show... they are not ready and belongs to the liongfx_asm and liongfx_basics commands (freebasic stuff) and new error messages I have got since this experiments :D more to come later, I am sure... perhaps charles can give some suggestions... ;)

freebasic specific: and how it's possible to use this BSTR as dimension ?

dim sBSTR as BSTR
function = sBSTR

have all a nice and sunny day, thinbasic is getting better and better and I like this! :D
ps: as usual... thinbasic script and thinbasic_liongfx.dll zipped in added file :)

Charles Pegge
23-06-2009, 14:40
Hi Frank,

Further to our email discussion. This is how to create a BSTR in FreeBasic and other basics:
The bytes in the string are uninitialised.


'
dim sBSTR As BSTR '---OLE string
dim slen as long
slen=256
sBSTR = SysAllocStringByteLen( 0, slen )


sBSTR itself contains the address to the string - which is nothing more than a block of memory. In basic, when ever a string is redefined with a different length. The old BSTR must be destroyed and a new one created. For this reason, Strings are usually double pointered. In other words a dynamic string contains the address of a Bstring (which contains the address of the string itself.)

BSTRings must be freed once you have finished with them.



SysFreeString sBSTR


But because Linux does not have the same system for BSTRings - FreeBasic uses its own string management system for both MS and Linux platforms - we have to transfer bytes from BSTrings to FreeBasic strings , so there is a function in thinBasic_Oxygen.bas to do this for you. BSTR_to_FSTR.


Charles

Lionheart008
23-06-2009, 21:24
thank you charles for these infos... very useful :)

I made an sub example for the lion module and it works with BSTR... very good! now I can sleep calm and satisfied... one thing leads to another... one door open and it takes me to another colored and unknown area... have good mood today... here's the sun back and I will check new possibilities for the lionmodule like asm and other things on my virtual list in my mind... after finishing examination at friday I will make a structured plan for my module... this is necessary !

one question.. what is the different handling between your syntax o2 and o2h of your thinbasic oxygen script ? It was intended to use it in different ways..., isn't it? ;)


'---------------
sub tbO2_BASIC()
'===============
'
o2h=1
tbo2_asmo()
end sub

by the way: the main thinbasic_lionmodule script has got today a little children (tiger.bas), so I can split the main thinbasic_lionmodule script and push it with new power ;)

wish a good evening, good ideas and good mood too :)

salve, Lionheado di nudelo :D

Charles Pegge
23-06-2009, 23:56
Yes o2h on the module side is a flag and when set to non-zero triggers support for Basic syntax.

The #o2h directive and also the o2_basic command sets this flag.

Charles

MikeTrader
24-06-2009, 19:29
Charles, this is amazing work. I have got to play with this soon...

Charles Pegge
24-06-2009, 20:46
Hi Mike,

Good to see you here!

I got the first DLL written in Oxygen working today. A few problems to sort out with earlier programs but I hope to resolve these very soon.

Charles

Lionheart008
24-06-2009, 22:35
hi charles :)
hi all ...

I am curious to see what you have done with your written dll with oxygen :D... great !

new feature for my lionmodule...

a) liongfx_basicprint
(works at the moment as second print command and can also uses numbers...)
was very astonished to catch this one, but I have to improve it for the next time ! :)

b) liongfx_asm
(works, but there is still a little problem cause of not knowing mov eax commands and more... don't know why)

c) liongfx_getruntimeinfo
have built it, but how can I check this ???

d) liongfx_getvarptr
have built it too, but haven't yet new example for it... more to come...

my next script example add new features like above mentioned... and the colored input screen changed and scrolled the colours... I am sure some of you like and love it (petr?)

@ mike trader...
hi mike, you are new here? you are welcome :) on the other site you are "spam" and then you are not welcome ;) sorry perhaps..., because there appears a lot of "newbies" here and making only advertising for medicine products or other virtual nonsense they disappear very soon and were kicked off the forum and so I am not sure if you are a real user... can you introduce yourself with some sentences ??? would be nice...

best regards, good ideas and more good features for thinbasic too :D

lionheart

peter
24-06-2009, 23:03
Hi Lionheart,

liongfx_ASM !
that suits me fine.
any examples with ASM ?

Peter

Charles Pegge
24-06-2009, 23:23
Hi Frank,

I can vouch that Mike is a real person and a professional programmer. He came over to see me last Summer before strolling up mount Snowdon (in the rain!) then flying back to LA. It was very unusual to meet up with an internet colleague from another country for real - we had so much to talk about.

Re: Lion Asm - I encountered a curious problem using assembler in one of the Oxygen module functions - something that should have worked without any complications - so it may be one of those rare FreeBasic bugs. I will need to investigate further.

Charles

Lionheart008
25-06-2009, 00:02
hi charles, peter, mike trader ;)
hi all...

I will check it too, the problem with asm coding still exists for me... yes, if you see a way, please tell me more about it... I have built it as a "sub execute_liongfx_asm" and have compiled it with success, but the thinbasic script don't like it and makes errors for mov eax, imul, add and more...

@peter: if the asm works with thinbasic properly I will make some examples for it...

@mike: ok, mike you are very welcome here at the board... :D thanks for this info, charles !
He came over to see me last Summer before strolling up mount Snowdon (in the rain!) then flying back to LA.

good night :), have tomorrow the next exam and theoretical part at friday, uargh... 8)

see you, best thanks again for you superb oxygen module and all the great stuff you made charles... ! I like it and has pushed me forward :)

lionheart

Charles Pegge
25-06-2009, 10:17
Hi Frank,

You can create your own syntax to some extent, though thinBasic will only support single-line syntax directly.

This is an experiment, which may have possibilities for LionModule.

In FreeBasic inline assembler it is generally safe to use eax ebx ecx edx esi edi registers and you can
and or xor add sub inc dec shl shr sar imul them. (The idiv instruction always divides the edx:eax register pair implicitly so you only specify the divisor eg: idiv ecx )

Charles

Module (FreeBasic)


'--------------------------
Function Lion_tst() as long
'==========================
'
dim As Long a,ParensPresent
ParensPresent = thinBasic_CheckOpenParens_Optional()
dim b as bstr
dim s as string
b=thinBasic_GetTokenName(0)
BSTR_to_FSTR(b,s)
sysFreeString b
thinBasic_Parselong(a)
if s="HALF" then
asm
mov eax,[a]
shr eax,1
mov [function],eax
end asm
end if
if s="SQUARE" then
asm
mov eax,[a]
imul eax,eax
mov [function],eax
end asm
end if
If ParensPresent = TB_TRUE Then thinBasic_CheckCloseParens_Mandatory()
End Function


thinBasic script


dim half as long, square as long
'.....
msgbox 0,lion_tst half 32 & " " & lion_tst square 32

Lionheart008
25-06-2009, 17:35
hi charles,
hi all :)

chakka! and wow! :D I have built the asm part with success !!! everything works fine now some minutes before... and found my mistake...! while compiling my liongfx script I have returned the matches as "string" not as "long"... so my first issue of asm was to 90 per cent correct :) I due it to my missing sleep the last nights...


This is an experiment, which may have possibilities for LionModule.

yeah! thank you for your last asm codes...(e.g.: math operations), I have changed my script a little and used it.. to test it with success... and it works very fine! but I am seeing it's too complicated to do all asm commands in one main script so I will split it into my "tiger.bas" script when I find a way for it to use all asm commands and math operations... more to come...

these commands work fine :)

a) liongfx_asm half 32
b) liongfx_asm sqare 64
c) liongfx_asm inc 32
and
d) liongfx_asm mul (or) imul 20 works but not perfect... have to check it, missing time to do that at the moment...

so long, wish you the best, I am feeling simply great, must laugh :occasion:
have added here a new thinbasic testscript example with new thinbasic_liongfx.dll file :)

prosit, lionheart :dog16:

Lionheart008
25-06-2009, 22:31
hi all :)

now it's clearer and more brighter with asm robot properties for me ;)

new syntax as followed with calculation are working now fine...

new two asm functions:
a) liongfx_asm addme 128 '-add function: result 128 + 1 = 129, ok
b) liongfx_asm fal 24 24*4 '- multiply A to B to C, result 24*24 + 24*4 = 672, ok

the old ones:
c) liongfx_asm half 32
d) liongfx_asm sqare 64
e) liongfx_asm inc 32


code example:


'------ new liongfx function :), 25.juni.2009 by lionheart

uses "liongfx"
dim x, y, z, i,k, p,trans as long
dim half as long
dim square as long
dim mul, imul as long
dim inc as long
dim addme as long
dim fal as long

liongfx_WindowTitle "...thinbasic ASM calc. test 1b for liongfx module"

liongfx_Screen 18, 32

'try for asm running and calculations
msgbox 0,liongfx_asm half 64 & " " & liongfx_asm square 48 & " "

msgbox 0, liongfx_asm inc 64 & " : result is ok ! " 'inc from 0 to 1 ;)
msgbox 0, "...now all is perfect with the ASM robot :)"
msgbox 0, liongfx_asm addme 128 & " : 1) add result is also ok ! " '- result 128 + 1 = 129

msgbox 0, liongfx_asm fal 24 24+4 & " : 2) fal A to B result is clear and ok ! " '- result 672 (24*24+24*4)

randomize timer
liongfx_color rnd(10), 200
for i = 1 to 8 step 4
for x = 1 to 640
For y = 1 to 480
liongfx_PSet rnd*x, rnd*y, rnd*x *rnd*y
liongfx_PSet 4*rnd*x-i, 4*rnd*y-i, rnd*x-i *rnd*y-i
next
next
next
sleep 1000

liongfx_color 10,155
liongfx_locate 20, 10
liongfx_buf, 200,240
liongfx_len

liongfx_Imagecreate(64, 64, 64, 160, 0, 255)
liongfx_Imagedestroy, 24
liongfx_put,1,2,3,4,p,trans

liongfx_print "Hey dear maria, what's going on here with my eyes ?"
for i = 40 to 480
liongfx_Line( i,40, i,260, i * 40, rnd*255-i*32, i * 140, rnd*125,36)
liongfx_Line( i,160, i,180, i * 80, i * 80, rnd*180-i*32, rnd*255,rnd*124)
liongfx_Line( i,80, i,120, i * rnd*140, i * rnd*140, i * rnd*140, 180,160)
liongfx_Line( i,120, i,140, i * 60, i * rnd*40-i*32, i * rnd*40, rnd*180,40)
next i

liongfx_locate rnd(20,50),50
for k = 20 to 120
liongfx_color 100,60
liongfx_Circle( rnd(k),rnd(240), rnd*140 )
next k

liongfx_asm

msgbox 0, "ok, I found ASM and it WORKS ! Yipeeh!!! :) "


you can test it... if you like it... I am proud of it to grasp this heavy stuff !!! :)

any feedback would be great if this liongfx_asm script works correctly on your machine too ... I am only happy asm feature is running now for me :D

all necessary files zipped again :)

best regards, Lionheart

Lionheart008
26-06-2009, 13:48
the examination is done :D

have made all this horrible tests with average "GOOD" results ! :)))) 9.650 points from 10.000 points possible... ! not so bad for me... ms office and economy calculations with graphic presentations are now a new little friend of me, but I don't like access... ;)
I am now a advanced project manager :) must laugh... but not for thinbasic! :P

hi all :)
dear charles...

one more little question

by the way: what is rdtsc ? it belongs to old "dos" area ???

found this example last day:


ASM
XOR eax, eax
cpuid
rdtsc
mov [_counter_tsc1_], eax
mov [_counter_tsc1_+4], edx
END ASM

2) have built some new asm commands with "rdtsc" (eg: liongfx_plusasm rdt 24 and liongfx_plusasm rdts 180 for testing and I get fine results ...

more to come... I am exhausted, but very happy to get new professional graduation, but it's not a doctor... perhaps I will do such silly things in next life... must laugh 8)

see you, best regards, Lionheart
don't pass mouse over me.

Lionheart008
26-06-2009, 14:34
... my next example with liongfx_asm and liongfx_plusasm calculations... I am very glad to see this script works, that was important for me... ;) looks not very exciting, but it's a next good and big step to understand more about asssembler coding...


'-- test calc script for liongfx, friday, 26.juni.2009 by lionheart :)

uses "liongfx", "console"

dim a as long
dim b as long
dim c as long
dim addme as long
dim square as long
dim fal as long
dim rdt as long

DECLARE FUNCTION multiplication(BYVAL x AS INTEGER, _
BYVAL y AS INTEGER) AS INTEGER

RANDOMIZE TIMER
a = RND * 100
b = RND * 100
c = a*b

printl " " & c & " " & a & " " & b & multiplication( a, b)
msgbox 0, liongfx_asm square a
msgbox 0, liongfx_asm addme b
msgbox 0, liongfx_asm fal 64 12
msgbox 0, liongfx_plusasm rdt 250

liongfx_sleep 100


FUNCTION multiplication(BYVAL x AS INTEGER, _
BYVAL y AS INTEGER) AS INTEGER

liongfx_asm fal

END FUNCTION
printl
printl "press any key to quit this fantastic liongfx script :) "
waitkey


more to come ... and I hope as soon as possible with more colours and effects and graphic beautiful things I love it more ;)

best regards, Lionheart

Lionheart008
26-06-2009, 19:33
...next two operations and the hospital client is dead :D

here are some new graphic power elements (at the very beginning!) :

a) liongfx_view (200,160, 100,260, 84, 128)
b) liongfx_point, 12, 26

now you can build with the added example rectangles (per "lines", old feature) and filled boxes ("view", new feature)... and colourize it with a frame... I see the new power of it and next time I try to move the rectangles or boxes... pushing it by key arrows... if I manage this one :) the task for next week...


'--- new graphic power with thinbasic liongfx, friday, 26.juni.2009 by lionheart

uses "liongfx"

liongfx_screenres 640,480,32

dim as integer x = 300
dim as integer y = 300

msgbox 0, "this example shows new graphic power with liongfx :)", %MB_Iconinformation, " tb-liongraphics: rectangle, box, filled, colored"

liongfx_imagecreate 120,120,14, 0,255,0

liongfx_PUT, 500,400,120,140
liongfx_PSET 126,126,18

'liongfx_color 250,140
liongfx_LINE (200,100, 232,132, 255,20,140, 16, 12)

liongfx_LINE (300,150, 100,300, 55,200,140, 16, 8)
liongfx_VIEW (200,160, 100,260, 84, 128)

liongfx_Line (rnd(140,120),rnd(80,120), rnd(250,360),rnd(180,200), rnd(20,255),0,55,224,24)
liongfx_VIEW (60,160, 110,100, 24, 240)

liongfx_locate rnd(250),rnd(100)
liongfx_VIEW (400,360, 240,200, 155, 120)

liongfx_color 120,40
liongfx_color 250,140
liongfx_POINT, 12,26

liongfx_SLEEP
liongfx_imagedestroy, 4

that's all for today and this week, best regards, Lionheart

ps: I will set for the next time all liongfx script examples with dll in a separately zip folder and collect the examples... it's a better way to make liongfx sample scripts folder ;)

Michael Clease
26-06-2009, 22:33
ps: I will set for the next time all liongfx script examples with dll in a separately zip folder and collect the examples... it's a better way to make liongfx sample scripts folder ;)


Perhaps a help file with the syntax for the keywords in your module.

Lionheart008
02-07-2009, 23:23
hi everybody out there,

one more for the road with a simple circle example using liongfx module...


Perhaps a help file with the syntax for the keywords in your module.
@ michael clease... yes, I will do that the next weeks... have this one as very important topic in my mind ;)


'-- liongfx example with circles :), 2.july.2009, translated from fb

dim i, x, y, f, r as integer

uses "liongfx"

msgbox 0, "thinbasic/liongfx...shows a simple circle example with colours"

liongfx_screenres 640,480,8
liongfx_windowtitle "circles, colours, rectangle with tb / liongfx"

randomize timer

do
for i = 1 to 440
x = rnd(1, 639)
y = rnd(1, 479)
f = rnd(1, 255)
r = rnd(1, 400)
liongfx_circle x-1,y-1,r,f
liongfx_line (200,100, 230,130, 40,255,80, 24, 12)
IF liongfx_inkey <> "" then liongfx_error,2
sleep 100
next i
liongfx_cls
loop
end



if anybody has fun to test it, do it :)

I will try to implement new multikey commands (pushing arrow keys up, down, left, right) to move e.g. rectangles or circles for the next days... haven't found yet a useful solution for it, but I am on the right way I see... :dog16:

best regards, Lionheart

Lionheart008
06-07-2009, 23:03
yep... one more from the zztop road :)
dear thinbasic users...

have played around with some new experiments, not finished!, with liongfx graphic features...

I will try to find a possibility to catch the current graphic modes and driver with liongfx module... will be hard enough ;)

this demo shows only how this could looks like ... see the example as a dummy demo !

my example I add here with liongfx_dll and two! thinbasic scripts... you will perhaps see the different between the scripts ...

nearly forgotten: simple to use the script by taking the return key to go on... may be somebody is really interested to test this example... ;)


'-- test for new graphic features, monday, 6.july.2009 by lionheart :)

uses "liongfx"

DIM depth(4) as integer
DIM key as string
dim driver as string = "screen graphic infos: "
DIM i, j, w, h, d, rate,bpp, p as long
w=rnd(1,480)
h=rnd(1,320)
rate=rnd(i,255)
d=rnd(2,48)

depth(0) = 4
depth(1) = 8
depth(2) = 16
depth(3) = 32


for i = 0 to 4
liongfx_screen 16, depth(4) 'depth(1), depth(2), depth(3), depth(4)
liongfx_screeninfo, w, h, d, bpp, rate, 32, driver
liongfx_print
liongfx_line (480,320, 40-i,20-i, 60, rnd(0,255), rnd(126,255), 24,16 )
liongfx_locate 1,2
liongfx_print "pseudo graphic_mode: " + STR$(w) + "x" + STR$(h) + "x" + STR$(d)


IF (rate > 0) THEN
liongfx_locate 2,2
liongfx_PRINT " at " + STR$(rate) + " pseudo Hz"
END IF
liongfx_PRINT " (" + driver + ")"
IF (i = 0) THEN
FOR j = 20 TO 255
liongfx_LINE(32+j, 100, 32+j, 139,rnd(125,255),40,rnd(0,55),12, liongfx_shl, 24, j)
NEXT
ELSE
FOR j = 24 TO 255
liongfx_LINE (140+j, 100, 120+j, 141,40,rnd(250),rnd(1,255-i),40-i, liongfx_SHL, 8, j)
liongfx_LINE (140+j, 160, 120+j, 210,40, 55-i,rnd(1,180-i),40, liongfx_SHL, 4, j)
liongfx_LINE (140+j, 240, 120+j, 285, 140,rnd(0,150),rnd(2,250),40, liongfx_SHL, 16, j)
NEXT
END IF
key = liongfx_INKEY
WHILE key = ""
key = liongfx_INKEY
WEND
IF key = "k" THEN liongfx_error,2 '-- end
NEXT i

'------ test for allocate / deallocate
liongfx_allocate,4,2,6
liongfx_deallocate, p,12,32

msgbox 0, "hey..allocate memory: " + liongfx_allocate,4,2,6
msgbox 0, "hey..deallocate all...: " + liongfx_deallocate,p,12,32

'- end of script :)

two new features included: liongfx_deallocate and liongfx_screeninfo
notice: I collect some part of new features and refresh after it the pdf document :)


best regards, good night, Lionheart, totally refreshed after week-end
ps: have done a little update for a better english ;)

Lionheart008
07-07-2009, 15:50
hi all,
perhaps somebody can help...
dear charles ;)

theme: translation freebasic into thinbasic world...

1) I have managed to include something like "multikey_lefty" function for liongfx... so far I am glad...


liongfx_multikey_lefty '-- I cannot use left or right as reserved key !
liongfx_multikey_righty
liongfx_multikey_up
liongfx_multikey_down


but...

2) how can I return the handling for action with "key input" (left, right, up, down) as ...what dimension ?

for example: I use eg. thinbasic_returnCodeLong or thinbasic_returnString or thinbasic_returnNone... the functionality I need is something like "inkey" command... but here I have to return a value for action (=-1) and not action (=0)...


if liongfx_multikey_lefty and y < 479 then
liongfx_multikey_lefty lefty += 1

the example code lines work for the thinbasic side, but I get no reaction after pushing "left" key to move the objects... ;)

I will add a new example, if I know it better... or somebody has a good idea, would be nice! :)

a part of my new code...


liongfx_multikey_up
msgbox 0, "multikey up: " + liongfx_multikey_up
if liongfx_multikey_lefty and y < 350 then
liongfx_multikey_lefty lefty = -1
end if

msgbox 0, "multikey lefty: " + liongfx_multikey_lefty
liongfx_multikey up,24,12,38,46
msgbox 0, "multikey upper: " + liongfx_multikey up,24,12,38,46

liongfx_multikey_righty
liongfx_multikey_up '--- thank you charles for this advice with separately subs !
liongfx_multikey_down

I can use at the moment two similar ways with "liongfx_multikey" as sub functions... ;)

a) liongfx_multikey_up '- I prefer perhaps this solution
b) liongfx_multikey up,24,12,38,46
'- was my first idea, too complicated and runs but without the original moving effect of objects ;) ...

thanks in advance !

sunny days, Lionheart

Petr Schreiber
07-07-2009, 16:11
Hi Frank,

what does "pseudo Hz" mean in example one post ago? 132 Hz is something like double of my monitor refresh rate :)

Lionheart008
07-07-2009, 22:06
hi all,
hi petr :)


what does "pseudo Hz" mean in example one post ago? 132 Hz is something like double of my monitor refresh rate

it was only a dummy example to test the script, the value of 132 Hz is fictive, you can sleep without any horror that your monitor has too slow refreshing rates ;)


rate=rnd(i,255)

you can simple change the "rate" from rnd(i,255) to rnd(i,128) you will get another pseudo Hz rate (around 67) , it's not a real value, I needed only to test the script ... "liongfx_screeninfo" should do more than I have thought so this command should scan all graphic modi and driver infos too... but this is another chapter for next weeks or month...

my next little example with paint command and multikey, but I am looking still after the right possibility to use and manage it with the arrow keys... and thank you charles for help too, I see there are more than one ways for multikey commands and the right solution ;)

here's just a simple paint example... I have tested also the new multikey commands up, down, lefty, righty with values by console... the right handling to move an object will come another time... it's a hard question for me... 8)


'--- liongfx with paint and multikey 1a, 7.july.2009 by lionheart

uses "liongfx", "console"

dim t as double
dim x,y as long
dim up as long = 10
dim lefty as long = 5
dim righty as long = -6
dim down as long = -4

liongfx_screen 15

liongfx_multikey_up,24
Liongfx_circle 160, 100, 40, 14
Liongfx_paint 160, 100, 1 , 14

liongfx_multikey_up,12
printl "yes, now with multikey up... " + liongfx_multikey_up,up,12

Liongfx_circle 260, 120, 80, 15
Liongfx_paint 260, 120, 2 , 15

liongfx_multikey_down,24
printl "yes, now with multikey down... " + liongfx_multikey_up,up,24

Liongfx_circle 60, 40, 20, 13
Liongfx_paint 60, 40, 4 , 13

liongfx_multikey_up

if liongfx_multikey_lefty, 12 and y < 350 then
liongfx_multikey_lefty, lefty = -5
end if
printl

liongfx_multikey_lefty, lefty
printl "kuckuck lefty: " + liongfx_multikey_lefty, 8,24
printl

liongfx_multikey_up,24

liongfx_multikey_righty, righty
printl "hey righty " + liongfx_multikey_righty, righty,45
printl
liongfx_multikey_down, down
printl "hey down " + liongfx_multikey_down, down
liongfx_sleep 500

t = timer
do
loop until timer > t + 6

if you like to test it, do it :)

new functions:

liongfx_paint 260, 120, 2 , 15
liongfx_multikey_up,24 '- same to down, lefty, righty... more to come...
(notice: it works, but it's not perfect as the objects has still to move and dance ! :D )

nice evening, see you, lionheart
ps: my problem is to say the liongfx_multikey how to use the arrows, freebasic did this one with an old dos keyboard scanmode...! totally crazy :shock:

Lionheart008
08-07-2009, 11:22
good morning all :)

have done an interesting example for a new command and see very clear the different between using liongfx_screensync or not...

my script example followed as usual ...


'--- testscript for liongfx: screenset, screensync, screencopy test by lionheart, 8.july.2009, translated from fb :)

uses "liongfx"

dim bf as long

liongfx_screen 13, 2
liongfx_color 0,150
liongfx_windowtitle "testscript liongfx: screensync ON"

dim x as integer
x = -60

liongfx_screenset 1, 0

do
liongfx_cls
liongfx_line (x, 80, x + 59, 119, 4, 255,50,18,bf)
x += 1
if (x > 319) then x = -60

liongfx_screensync
liongfx_screencopy

loop while liongfx_inkey = ""

'- liongfx_error,2

a) without screensync : the green rectangle runs very fast and wild like an animation from left to right through screen

b) using screensync: the green rectangle goes very slow and flickering a little bit (will still search for the problem .. ) from left to right through screen...

that's all for my first 5 cent today... two new commands...

liongfx_screencopy
liongfx_screensync

best wishes to all thinbasic / liongfx users... I am sure, there are a lot of them in thinbasic world, I know ! must laugh :D

lionheart
info: two scripts I have added in zipfolder plus liongfx.dll for testing

Petr Schreiber
08-07-2009, 11:32
Interesting example Frank,

so liongfx_screensync works like vertical synchronization, "waiting" for display speed ?


Petr

Lionheart008
08-07-2009, 16:12
hi all, hi petr :)

1) yes, you are correct...


liongfx_screensync works like vertical synchronization

the "wait" command was replaced with "screensync"... (read in a regularly way one byte of a port, waiting for program execution until this byte fulfilled the conditions...)
I have included the screensync command again in next example and it works smooth :)

2) new liongfx theme: screensaver, with strings :)

...because it was easy for me now I have created a little screensaver with liongfx... (for strings, includes simple date and time functions)... more to come... I am believing it's time to have more fun with liongfx :D... but you use it with own risk, must laugh loud... this simple screensaver is not good for tired eyes... ;)

perhaps somebody has fun to test it... three different scripts I add here...

best regards, Lionheart with very cold fingers... it's april again ??? crazy times with random weather surprises ! :)

Lionheart008
09-07-2009, 01:03
hi again... don't sleep, cause I have made some more experiments with liongfx_lines and liongfx_pset effects :)

two examples I show here... and it's very exciting to see you need only some line of code to build such crazy pictures...

a) the lines examples shows a kind of screensaver for boxes...

'-- liongfx example with rectangles :), 8.july.2009, by lionheart

dim i, x, y, f, r as integer
dim a,b as long

uses "liongfx"

msgbox 0, "thinbasic/liongfx...shows coloured rectangles effect"

liongfx_screenres 640,480,8
liongfx_windowtitle "coloured rectangle effects with tb / liongfx"

liongfx_screensync

randomize timer

do
for i = 1 to 440
x = rnd(1, 639)
y = rnd(1, 479)
f = rnd(1, 255)
r = rnd(1, 400)*sin(timer)
liongfx_line (200-x*sin(timer),140-y*cos(timer), 220,120, 40,rnd(10,255),rnd(80,255), 24, 12)
IF liongfx_inkey <> "" then liongfx_error,2
sleep 100
next i
liongfx_cls
loop
end


b) the point examples shows four loops with "patterns" in it, take time you will see... :)

'------ new liongfx function with points :), 08.juli.2009 by lionheart

uses "liongfx"
dim x, y, z, i,k, p,trans as long

liongfx_WindowTitle "liongfx points effects "
liongfx_Screen 18, 16
randomize timer
liongfx_screensync
liongfx_color rnd(10), rnd(10,200)
for i = 1 to 8 step 4
for x = 1 to 640
For y = 1 to 480
liongfx_PSet rnd*x, rnd*y, rnd*x *rnd*y
liongfx_PSet 4*rnd*x-i, 4*rnd*y-i, rnd*x-i *rnd*y-i
liongfx_Pset x-320,y-240*int(rnd*4)-10, x-i * y-i
next
next
next
sleep 1000

c) oh... not enough.. here it comes, my champion :)

circle-evolution with circle patterns they are growing... !
you can end this script by pushing "E" ! 8)


'-- liongfx_circle effects with patterns by lionheart, 08.july.2009 :)

uses "liongfx", "console"

dim x,i,b as single
dim v as long

liongfx_screen 16

x += 1
b += 1
v = rnd(0,255)

do
liongfx_locate 17,19
liongfx_color b+4,v
liongfx_print "push E = end"
do
x = 0
for i = 0 to 140 step 2
x = x + 4
b = b + 1
v = v + 5
liongfx_circle (1,1,x-1)
liongfx_circle (400,300,x-1)
liongfx_circle (400,0,x-1)
liongfx_circle (1,300,x-1)
liongfx_circle (20,340,v-1)
liongfx_sleep 100
next
loop until i > 50

liongfx_sleep 500

loop until liongfx_inkey = "e"
liongfx_error,2
stop


would be great to test it and making some feedback... if you like... have done all in one zip folder...


good night...:) lionheart

Petr Schreiber
09-07-2009, 10:48
I liked the pixel spray very much :)

Only problem was there were randomly some pauses in rendering.

Lionheart008
09-07-2009, 16:19
hi all,
dear petr,

thanks, yes it's the craziest example for me too, but my favourite remains to the circle evolution... reminds me at early times of video games and musician clips at the very beginning or advertising for "coke" or "bluna" :)

my next example shows how to change colours in a gradual way... the randomly pauses while rendering scene I have it too..., sorry, but I think it's still from lacking / missing more highly "screen and graphic elements" power features :D

here my next nice script, I will improve it for making more colour depth and refrehsing...


'-- colours graduale increasing with liongfx, 9.juli2009, by lionheart

uses "liongfx","console"

dim w,h,x,y,colour,depth as integer
dim rt,gr,bl as integer
dim mode_rt,mode_gr,mode_bl as integer
dim u,wfr,wfg,wfb as double
dim rtad,grad,blad as integer
dim i as long

liongfx_screen 16,32

liongfx_screeninfo, w,h,x,y,colour,depth,4
liongfx_windowtitle "liongfx_effect: colour graduale increasing - press `P` to quit"
liongfx_screensync
liongfx_screenlock

u=64
u+=16
i+=rnd(10)
colour=rnd(1,255)
depth=rnd(4,32)
rtad=2
grad=rtad
blad=rtad

msgbox 0, "quit the window by pushing 'P', wait and see colours of box are changing :)"
'liongfx_print depth

do
for x=90 to 390
for y=40 to 320
wfr+=.1
wfb+=.1
wfg+=.1

'-- red
if wfr > 1000 then
if mode_rt=1 then
rt+=rtad : wfr = 0:mode_rt=1
else
rt-=rtad : wfr = 0
end if
end if

'-- blue
if wfb > 1000 then
if mode_bl=1 then
bl+=grad : wfb = 0:mode_bl=1
else
bl-=blad : wfb = 0
end if
end if

'-- green
if wfg > 1000 then
if mode_gr=1 then
gr+=grad : wfg = 0:mode_gr=1
else
gr-=grad : wfg = 0
end if
end if

if rt< 10 then mode_rt=1
if bl< 10 then mode_bl=1
if gr< 10 then mode_gr=1
if rt = rnd(255) then mode_rt=0
if bl= rnd(255) then mode_bl=0
if gr= rnd(255) then mode_gr=0

colour=liongfx_rgb(rt,gr,bl )
liongfx_pset (x+i,y+i,colour)
next
next
sleep 10
liongfx_screenunlock
loop until liongfx_inkey= "p"
liongfx_error,2
sleep 10
stop

it's looking like a simple scene, but there is a lot of power behind it, you can see ;)

new liongfx_commands included for today, examples with definitions follow next days:

liongfx_cint '-- rounding up any kind of values
liongfx_bin '-- returns binary value as string
liongfx_val '-- convert a string to a number
liongfx_callocate '-- pointer, memory handling
liongfx_bload '-- load certain areas of binary data from a file (e.g. "picture.bsv")

press "P" to quit the scene, but wait a certain time to see how the colours are changing...

best regards, Lionheart

kryton9
10-07-2009, 00:17
Frank, I enjoyed the demos. They bring back memories of all the fun coding is and your screens capture the thrill of seeing lines of code turn into visual reflections.

Lionheart008
10-07-2009, 09:20
hi kent, hi all :)



They bring back memories of all the fun coding is and your screens capture the thrill of seeing lines of code turn into visual reflections.

thank you, that's it :D ! the mainly thing: to have fun with thinbasic / liongfx coding and to myself saving this learning curve! ;)

I am wondering every time to have simple or complex code and getting such nice and surprised results I enjoy nearly daily working with liongfx module... and my motivation is more to have some nice pictures, you can believe :)

I see also the evolution of charles' oxygen module and I like his way of doing and improving this fantastic module for thinbasic.. :) same to the guys they have still developed their modules like petr and michael or eros and roberto... great respect !

now some more of liongfx "visualisation" ! 8)
only few lines...


'-- color experiments with liongfx, 09.juli.2009 by lionheart :)
uses "liongfx"

liongfx_SCREEN 18,32,2

dim chip1 as integer
dim chip2 as integer
dim a,b as integer
dim bf as long

liongfx_screensync

do
a = a + 1 '- add or use here 1, 10 or 100 or 1000 ! :)
b = b - 1 '- substract here values...
chip1 = chip1 + 1
if chip1 = 640 then
chip1 = 0 ' change the right side from -1,+1,+2 ...
chip2 = chip2 + 1
end if
if chip2 = 480 and chip1 = 639 then exit do
liongfx_PSET (chip1,chip2,a)
'liongfx_PSET (chip1,chip2,b)

loop

btw: it's possible to change the values and making experiments, try it! :)

to be honest... it was a good idea to have a closer look at freebasic some month ago I haven't understood only few things about this language and I have learnt a lot with / about thinbasic the last weeks... adept some codes from fb to thinbasic, so why don't use both languages (synergy effect!:) ) to make perhaps a better programming language ? I love thinbasic, I like freebasic ! that's the different... :D

see you, best regards, Lionheart, nice day for all thinbasic users :dog24:

peter
10-07-2009, 16:15
Hi Lionheart,

i could to test your module with a game.
do you have already 'Sprites'?
do you have 'LoadSprite' and 'LoadBitmap','DrawSprite' ?
it would be good, if you have some of this statements.
that is necessary in order to write a good game.

i could begin with a little Pacman at first.
what do you say ?
Peter

Lionheart008
10-07-2009, 16:44
hi peter,

short reply: sounds good, but you may wait some days... this chapter with sprites or loading pictures will come the next time... cause there are still some difficulties / inconveniences between freebasic / thinbasic for this chapter I can remember, as I have tried it some weeks ago without success, but I check it for the next time.. I have more knowledge about compiling after four, five weeks 8) I am sure, it' possible! ;)

could be also possible to integrate some asm codes... don't tried it before...


i could to test your module with a game.
do you have already 'Sprites'?
do you have 'LoadSprite' and 'LoadBitmap','DrawSprite' ?

thanks for asking, best regards, Lionheart

Petr Schreiber
10-07-2009, 22:47
Hi Peter, Frank,

one thing - Mike Hartlef just developed ton of quality sprite functions for TBGL (available in TB beta), I think doing another sprite system now could be little redundant. But of course - Frank is free to implement whatever he wants.


Petr

kryton9
11-07-2009, 01:14
I played around with the new sprite module and it is really impressive, I definitely recommend giving it a try Peter.

peter
11-07-2009, 13:22
Hi Petr,

i think that Lionheart would not compete, with the
"Sprite system " from Mike Hartlef.
This is only a challenge for him and his module.
He wants to create his own System. He makes everything great !
In this case, you can pick out with what you want to write.
I am pretty curious on this thing !

Kent,
i cannot give a try, because i do have some problems with the Beta Version.
Later i will try it.

Peter

Lionheart008
13-07-2009, 23:04
hi all :)

have made some new progresses belongs to "multikey" functions... thank you charles for new ideas ... ;)

a) I get the feedback from key inputs... so it might be possible one time to move the objects... how it be realized, I will find a way :)

new commands:
liongfx_getkey
liongfx_palette
liongfx_multikey_lefty, 8,24
liongfx_draw "liongfx"
notice: "liongfx_draw" isn't just perfect... have got some strange behaviour...

'--- liongfx with paint and multikey 1a, 7.july.2009 by lionheart

uses "liongfx", "console"

dim t,i as double
dim x,y as long
dim up as long = 10
dim lefty as long = 5
dim righty as long = -6
dim down as long = -4
dim clr,blu,grn as integer

liongfx_screen 15

liongfx_getkey
liongfx_PALETTE, i, clr,blu,grn

liongfx_multikey_up,24
Liongfx_circle 160, 100, 40, 14
Liongfx_paint 160, 100, 1 , 14

liongfx_multikey_up,12
printl "yes, now with multikey up... " + liongfx_multikey_up,up,12

Liongfx_circle 260, 120, 80, 15
Liongfx_paint 260, 120, 2 , 15

liongfx_multikey_down,24
printl "yes, now with multikey down... " + liongfx_multikey_up,up,24

Liongfx_circle 60, 40, 20, 13
Liongfx_paint 60, 40, 4 , 13

liongfx_multikey_up

if liongfx_multikey_lefty, 12 and y < 350 then
liongfx_multikey_lefty, lefty = -5
end if
printl

liongfx_multikey_lefty, lefty
printl "kuckuck lefty: " + liongfx_multikey_lefty, 8,24
printl

liongfx_multikey_up,24

liongfx_multikey_righty, righty
printl "hey righty " + liongfx_multikey_righty, righty,45
printl
liongfx_multikey_down, down
printl "hey down " + liongfx_multikey_down, down
liongfx_sleep 500

t = timer
do
loop until timer > t + 6

uses keyboard inputs to see what happens.. take the ESC key to progress the scene ;)


b) not ready, but a preview... perhaps a way to get the sprite solutions...



'-- liongfx: sprite problem to solve until end july :) by lionheart

uses "liongfx", "console"

liongfx_Screen 15, 16

dim sprite, add1,alpha as long
dim bf,b,x,y as long
dim s as string
dim i as integer

add1 = 60
alpha = 50
x=32
y=32


liongfx_draw, "Hey!"

liongfx_sprite, 64*64
msgbox 0, "hey, this could be some day a sprite example :) " + liongfx_sprite, 32*32

liongfx_ImageCreate 32, 32, 10,10,liongfx_rgb, 255,255,255 = liongfx_sprite,32*32 '- 32x32

liongfx_Cls



for i = 0 to 63
liongfx_Line i, 10, i, 300, 255,50, i * 4, i * 4, i * 4
liongfx_Line i + 128, 5, i + 128, 300, 55,255, i * 4, i * 4, i * 4
liongfx_Line i + 256, 10, i + 256, 200, 155,55, i * 15, i * 15, i * 15
Next i

liongfx_getkey

liongfx_Put, 0, 0 , liongfx_sprite,24*24, add1
liongfx_Put, 32, 0, liongfx_sprite,24*24, alpha

liongfx_Sleep 1000

I am honest, there are some bigger problems to say a fine solution for freebasic compiling for thinbasic, but I will not mention it here.. I have to solve it :)


best regards and sleep well, Lionheart

Lionheart008
14-07-2009, 21:41
hi all, hi charles...

hmh... I go around and around in a circle but find no way out... ;)

I would like to have an image (liongfx_imagecreate) with put command (liongfx_put) and nothing happens! great... I am not sure, but it may concern the compiling handling from freebasic to thinbasic... I have done in my eyes everything right... but I can't see the desired picture...

there are three, four commands with other handling like I wished from fb and I cannot transport it to thinbasic... at this moment... perhaps I find a way... everything is ok with creation of "lines" and "circles" separately, no problem, but if I want to create a little image with 100x100 and a rectangle or circle in it.. nothing happens...

I test the scripts often with print or message box to see what kind of results I am getting ;) don't know if anybody have had similar problems... but I am standing before a big wall and cannot see the wonderful blue water and bright sun shining behind it ;)

my example... it's running, but doing other things I wished :)


'-- testscript with feedback :), 14.juli.2009 by lionheart

uses "liongfx", "console"

dim image1, img8, img32 as long
dim i, y as integer

dim s as string = "pipi langstrumpf watchs the clock: " + time$
dim buffer as long

liongfx_screen 14,32

liongfx_circle 124,124,24,4
liongfx_draw, buffer, "draw something beautiful here...(10,10)"
printl "kuckuck, the sun is shining :) " '
liongfx_draw, buffer, s
liongfx_print "draw result: " + liongfx_draw, buffer, "draw a string with...(40,40)"
liongfx_print

msgbox 0, s
liongfx_print "draw a string with..(100,100): " + liongfx_color,RGB(55,163,79)

liongfx_imagecreate 100,100,10,0,0,0 = img32
liongfx_PUT, 10, 10, img32,buffer

liongfx_circle 50,50,liongfx_rgb, 255,0,0
liongfx_print "put: " + liongfx_put, 100,100, buffer,img32

liongfx_print
liongfx_print "push a key to continue..."

liongfx_getkey

liongfx_screen 15,32

for i = 0 to 80
liongfx_Line i, 0, i, 300, rnd(255),50, i * 4, i * 4, i * 4
liongfx_Line i + 128, 5, i + 128, 350, 55,255, i * 4, i * 4, i * 4
liongfx_Line i + 256, 10, i + 256, 250, 155,55, i * 15, i * 15, i * 15
next i

liongfx_get, 0,0, 100
liongfx_put, 100,100, buffer,img32

liongfx_getkey
liongfx_sleep 1500
liongfx_error,2


I am not frustrated, I wonder only why these three, four commands doing in some way other things... I like to have... :D

I cannot say it's a kind of fun coding, but it won't hurt me :)

@charles: perhaps you know such problems from freebasic while working on your oxygen compiling ?

good evening, best regards, lionheart

ps: last edit for charles.. .I have tried it again, the problems belong to the freebasic side, I am sure ;)

Lionheart008
22-07-2009, 22:03
hi everybody,

one more from the "u2" and "zztop" road and of course some powder of thinbasic liongfx

a) have played around again with plasma structures... ( four examples for the start) and I had to test it again.. for a newer update of liongfx dll because there were some irregularities from the freebasic side... uff...


'Plasma-like effect with liongfx, 22.juli.2009
uses "liongfx", "console"

Dim T1, T2 As QUAD
Dim w,h As Double
w=640
h=480

randomize timer

HiResTimer_Init

liongfx_Screen 17,32
liongfx_windowtitle "plasma playing again: 2 :) "

Dim x,y,page As Double
Dim c,t As Double
dim z as long = 2*gettickcount*(sin(timer)*128)
dim p as long

T1 = HiResTimer_Get
t=t+1
For x = 0 To w
For y = 0 To h

c=(Cos((x+y+t)/100)+Cos((x-t*y)/100)+Cos((y-t)/100)+Cos((x-y+t)/100))*2+Sin(t/100)*15
liongfx_PSet (x,y,Rgb(Sin(c)*64+128*z,Cos(c)*64+128,Cos(-c/2)*64+128) )

Next
printl

liongfx_PSet (x,y,Rgb(Cos(c)*32+128+z,4*rnd*Cos(c)*32+128+z,log(-c/2)*64+128+z) )
printl
printl " liongfx meets plasma :) " + int(rnd(1)*400), "batgirl is watching you! " + int(rnd(1)*400)

Next


T2 = HiResTimer_Get
MSGBOX 0, "Elapsed time in microseconds: " & format$((t2-t1)/1000000, "#.000") '- (t2-t1)/1000000
sleep 5000
page=-page+1
liongfx_ScreenSet(page,-page+1)

liongfx_sleep

b) a simple random script I added in the zip folder too...


'- testscript for rnd and lines after rebuilding liongfx :), 22.july.2009
uses "liongfx","console"

dim first as double
dim last as double
dim b, i as long

Randomize Timer

msgbox 0, "good night mr. hulk " + rnd_range(first,last)

printl "yep tennis: " + rnd(1,2009)

printl "yep soccer solo " + rnd(11)
liongfx_print "yep soccer correct " + rnd(11)
printl
printl "yep soccer due " + rnd(1,12)

printl "yep golf " + rnd(1,255)
liongfx_print "yo golfer correct: " + rnd(40,120)

printl "yep waterskiing " + rnd(1,24)
printl
liongfx_print "doppy! " + rnd_range(first, last)

function rnd_range (byref first as double, byval last as double) as double
'first = 100
'last = 101

function = rnd(last - first) + first
end function

liongfx_print "all is ok with this random script? - push any key to continue :) "

liongfx_getkey

liongfx_Screen 14

liongfx_Line 10,10, 100,100, 100,255,100,4, 12

for i = 20 to 319
liongfx_Line 20, 20, 300, 180, 255+i,100,50,2, 4
liongfx_Line 140, 80, 180+i, 120,255,100,50, 15, b
liongfx_Line - 200, 200+i, 255,100, 50, 25,100+i, 15, 4

next i

liongfx_print "push a key to end me"
liongfx_sleep

last edit at 23:20 pm: I add a new picture (green, last one) with a certain glass effect, isn't it ? ;)

good evening, no more words, have fun with the examples or/and feel free to test it, lionheart

PS: welcome to the big summertime hole, I see there is not a lot of action at the board at this moment...

kryton9
23-07-2009, 07:02
Those are some really cool effects and screenshots Frank. Keep up the cool work!