View Full Version : liongfx: graphic input: pixel-monitor-test, circles, lines, rendering
Lionheart008
29-07-2009, 03:30
hello dear liongfx fans...
if somebody is interested in testing this pixel-monitor test script, you can do that... :)
'- monitor testing with liongfx, by lionheart, 28.juli.2009
uses "liongfx","console"
dim sx, sy, x, y, s as integer
dim f1, f2 as integer
f1 = &HFF00FF
f2 = &H00FF00
liongfx_Screen 19,32
liongfx_windowtitle "liongfx: nothing but pixels :)"
sx = 800
sy = 600
msgbox 0, "liongfx monitor pixel test"
liongfx_Cls
for y = 1 to sy-1
for x = 1 to sx-1 step 2
liongfx_PSet x, sy-y, f1
liongfx_PSet x+1, y, f2
next
swap f1, f2
liongfx_screensync
next
liongfx_Sleep
no more words.
edit: today, 14:24 pm.. new pixel-monitor-test script you find here
good night, lionheart
Lionheart008
29-07-2009, 04:25
next one.. :)
this example generates geometric structure of lines to a circle ;)
uses "liongfx", "console"
liongfx_screen 20,8
liongfx_windowtitle "liongfx: generates geometrics circle with 'two colours'"
dim xn,an,yn,bn,cn,in1 as single
dim tn as double
xn = 100
an = 384
yn = 100
bn = 384
cn = 512
liongfx_sleep 500
for in1 = 0 to 6.28 step 0.31415/2
xn = sin(in1) * 300 + 512
yn = cos(in1) * 300 + 384
for an = 212 to 812 step 100
liongfx_color in1+1,255
liongfx_lines xn,yn, an,bn,12 '-rnd(12,125)
next an
for an = 84 to 734 step 100
liongfx_color in1+2,155
for tn =1 to 1000000
next tn
liongfx_lines xn,yn, cn,an,10 '- rnd(10,255)
next an
next in1
liongfx_getkey
liongfx_sleep 1500
two codes variants (with a) two colours and b) many colours) I have included in zip file.
that's all and makes a lot of fun !
good night, lionhead
Petr Schreiber
29-07-2009, 07:32
Hi Frank,
I like these short but interesting demos.
The first one gives some interesting optical effects when playing with f1/f2 colors.
It seems you can use RGB function instead of &Hxxxxxx too.
Petr
Lionheart008
29-07-2009, 14:22
hi petr, hi all :)
have modified the pixel-monitor-test and now it's running with colors, but not with the whole variety of all colours ;) was just a test for me and thank you !
I like these short but interesting demos.
The first one gives some interesting optical effects when playing with f1/f2 colors.
It seems you can use RGB function instead of &Hxxxxxx too.
best regards, Lionheart
add the new script in my first post
Lionheart008
30-07-2009, 11:11
good morning all :)
have made some more experiments with lines and math. structures as you can see. these two examples I have adapted for thinbasic from an old freebasic example ;)
'- liongfx example with line and closing to a point of intersection with steps by iteration
uses "liongfx", "console"
liongfx_screen 19,8
liongfx_windowtitle "liongfx: lines, iteration, part two"
dim x,y,p,i,a,b,w as single
for x = -20 to 20 step .01
y = x ^ 2
liongfx_PSET x * 15 + 400,y + 100,10
next x
p = 620
for x = 100 to 700 step 2
y = p - x
liongfx_PSET x,y,12
next x
for w=0 to 520 step 12
x = 160+w
y = 520
liongfx_sleep 100
liongfx_PSET x,y,20
for i = 1 to 30
b = ((x - 400) / 15) ^ 2 + 100
a = x
liongfx_COLOR i,255
liongfx_lines x,y, a,b,10
x = a
y = b
b = y
a = p - y
liongfx_COLOR i, rnd(1,200)
liongfx_lines x,y, a,b,8
x = a
y = b
next i
next w
liongfx_sleep 100
liongfx_getkey
nice day,
best regards, Lionheart
lydia_sp
30-07-2009, 16:23
hi lionheart, I like your example very much and have tested three, four. lion: It`s a tool or something like tbgl ? Can you tell more about it and if I can use it with tbgl ? it`s very important for me to get a clear overview, so many modules and every part do quite other special things. you are very engaged, that` s I like it so.
best regards, lydia
ps: I am thinking you are a german guy ? ;)
Petr Schreiber
30-07-2009, 16:49
Hi Lydia,
To summarize graphic systems currently provided by ThinBASIC:
"Canvas"
This is part of UI (user interface module), which allows drawing lines, ellipses, boxes and text to fixed size control or fixed size window.
Software rendering (no use of 3D card), pixel perfect art.
LionGFX
Module developed in FreeBASIC, in some ways similar to "Canvas" approach.
The syntax is more closer to DOS basics... Frank will tell you more as he is the father of module.
Software rendering (no use of 3D card), pixel perfect art.
TBGL
TBGL is OpenGL based module for hardware accelerated both 2D and 3D graphics, which can be drawed to sizeable window, even fullscreen or inside dialog (like 3D editors do).
In latest beta of ThinBASIC it provides basic primitives like lines, circles, rectangles, spheres, boxes, cylinders, toruses or 3D models which can be exported from applications like Blender, Wings3D, ...
It allows you to define custom shapes too, use textures on them, manipulate them.
TBGL also provides function on fonts - you can print both 2D text and text floating in 3D space.
It contains 2 big high level systems you might use if you want - Scene/Entity system for designing 3D scene (cameras, lighting, primitives), and Sprite system very suitable for 2D games, which even handles collision detection automagically.
From this list you can see TBGL and LionGFX follow different path. First is hardware accelerated, while the second not.
That means you cannot combine them to produce one image.
Lionheart008
31-07-2009, 03:44
hi dear liongfx fans with humour ;)
it's brand new, out now, unbelievable, all for free !
"push the coloured circle!" my first game with liongfx! horrible game with no ending !
and you will get...
a) no highscore
b) no panic to loose
c) nobody will be hurt or must die
d) you can choose your own velocity to play
e) you only need four keys to make it coloured and four healthy or broken fingers
f) no complicated spaghetti code
g) no time to loose try and get the bitter lemon cup
h) no fantastic effects, no !
i) everybody can win and makes a lot of life experiences !...
just a little start for a game for people with sense of humour and people with a lot of courage to play it... :D
good night, lionheart
Ps: I must bundle the game, it's so full of features! awesome ! :)
pps: @lydia...
I say welcome from my left side to you too :)
I will write you more and closer details about "liongfx" tomorrow, I am very tired :) petr has told you already important and good things ...
lydia, thank you for friendly words and I would recommend to start with tbgl and using tbgl features for your game ideas. "liongfx" is still under construction and I have made in my eyes only 10 per cent from 100 for a really good thinbasic module... good night
Petr Schreiber
31-07-2009, 08:21
Hi Frank,
that is not bad, the smooth color change is very entertaining to watch!
Maybe the circle could collect something :)?
Petr
Lionheart008
31-07-2009, 16:24
hi petr, hi all,
the circles can catch now a box, you can change with the circles the colour of the box and the 'short game' ends after some time period and clearing the screen with GAME OVER ;) and I have added a new variation of moving by key "p".
Maybe the circle could collect something Smile?
even a child can play with it, simply great ! :D
btw: this little chapter makes a lot of fun !
' ----------------------------------------------------------
update: circle-game, saturday, 19:15 p.m
' ----------------------------------------------------------
best regards, Lionheart
ps: catch-the-box game is work in progress
lydia_sp
31-07-2009, 21:01
thank you petr and lionheart again for your answer! I like these kind of examples. I will proof tbgl and lion examples! Both are very interesting for my ideas. good luck for lionheart for development. I see its a hard work. good luck for tbgl too.
sorry: but what are "karmas"? I dont know why you can choose or get it ? I know Buddha and spiritual things by my girl friend, but karma and basic language, that` s funny ;)
I heard from thinbasic, powerbasic, ibasic by my old math. teacher. He was an scary original with full dark beard, a lot of dry humour and high intelligence about qbasic, basic and fortrun. these times are passed. I tried first thinbasic, but I have bought also powerbasic and will use it, so I have difficults or staying still with working or understanding thinbasic. though this cas I cannot imagine. I am eager and intelligent.
see you again hombres, lydia
Michael Hartlef
31-07-2009, 21:04
Giving Karma is like honoring someone for something you think was nice. The opposite is when you don't like someones post, then you take it.
Some people like this forum feature, some people don't care about it.
lydia_sp
01-08-2009, 13:57
michael, I understand "karma", but I think it`s not objectiv indication for good, better, best for me and it`s typical men gratification ;) some bonus points were given in IT industry (usa, gb). I know it by my father. But I don`t like it. that`s why I was wondering to see such gratification at this board. nevertheless, it`s ok and not important for me. bye, lydia
lydia_sp
01-08-2009, 14:01
for mr. lionheart surfer :)
I have to laugh a lot about your little game with circles and coloured box. I test it and make some more features! great. thank you. my girl friend thea was laughing too. thanks for beeing not so dry and typical programming guy I can imagine. perhaps I can give you some day some help. nice day from cologne! hasta la vida, lydia
Lionheart008
01-08-2009, 19:16
short reply :)
thank you lydia for nice words. such friendly things help every time and day ;)
one little update for the circle game (ok: I hope you see it as it is: it's not really a prof. game, only an experiment, exercise how to handle with liongfx features!) you can see in my last post. one little problem I have to delete in this example, I will try it to make it better for the next time...
nice week-end to all here. more to come next week...
lionheart
ps: I was surfing last summer at the german "ostsee" (eastsee). not very dangerous but I was feeling great while surfing over the rough (!) sea with para gliding ! :D
Lionheart008
07-08-2009, 08:41
good morning :)
little things with rgb's... I have thought this example should be here too... perhaps it's useful for somebody...
part one:
'- color example with liongfx, 7.aug.2009 by lionheart
uses "liongfx", "console"
liongfx_screenres 320,320,24
liongfx_paint 1,1,liongfx_rgb, 255,255,255 'white
liongfx_color, liongfx_RGB,255, 163, 79: liongfx_print "white: 255,255,255"
liongfx_sleep
liongfx_paint 1,1,liongfx_rgb,255,0,0 'Red
liongfx_color, liongfx_RGB,255, 163, 79: liongfx_print "red: 255,0,0"
liongfx_sleep
liongfx_paint 1,1,liongfx_rgb, 0,255,0 'Green
liongfx_color, liongfx_RGB,255, 163, 79: liongfx_print "green: 0,255,0"
liongfx_sleep
liongfx_paint 1,1,liongfx_rgb, 0,0, 255 'Blue
liongfx_color, liongfx_RGB,255, 163, 79: liongfx_print "blue: 0,0,255"
liongfx_sleep
liongfx_cls
liongfx_paint 1,1,liongfx_rgb, 0,0,0 'black
liongfx_color, liongfx_RGB,255, 163, 79: liongfx_print "black: 0,0,0"
liongfx_sleep
liongfx_getkey
liongfx_color, liongfx_RGB,255, 163, 79
liongfx_paint 100,100,100
liongfx_locate 12,16
liongfx_print "two lonesome circles"
liongfx_circle 140, 140, 60, liongfx_rgb, 255, 15,250
liongfx_circle 200,200,100, liongfx_RGB,255,255,0
liongfx_sleep
shows values of rgb's. I will try to translate html colours into rgb's too .
part two:
uses "liongfx", "console"
liongfx_SCREEN 18, 32
' frontcolor Orange, background darkblue
liongfx_COLOR &hFF8000, &h000040
liongfx_CLS
liongfx_LOCATE 18, 30: liongfx_PRINT "Hello dear liongfx & thinbasic World!"
liongfx_sleep
liongfx_CLS
liongfx_COLOR &hFF2000, &h000080
liongfx_LOCATE 20, 26: liongfx_PRINT "this summer is simply hot and great!"
liongfx_SLEEP
nice week-end. I am not really here ;) holidays are calling me too !
sunny greetings, lionheart
ps: all copied in zip file, two liongfx examples and liongfx dll
Lionheart008
07-08-2009, 10:48
..rendering experiments :)
if somebody can test this example, would be great to get any feedback ...
a) this example renders a scene with different coloured regions
b) after rendering is finishing wait a moment...
c) push any key at the keyboard, you will see a number at the screen for multikey functions
d) if you want to render new one you have to push ESC (Escape) key...
e) close the console window to end this scene
- will check why the script doesn't stop by pushing "p" as I wished ;)
this rendering example I have adapted in some big parts from freebasic ...
'- test rendering for liongfx by lionheart, friday, 8.aug.2009
uses "liongfx", "console"
liongfx_windowtitle "rendering test parcour vol 0.5 beta with liongfx "
DIM X AS DOUBLE
DIM Y AS DOUBLE
DIM XS, XT AS DOUBLE
DIM YS, YT AS DOUBLE
DIM R, COLR, P AS INTEGER
DIM G, COLG AS INTEGER
DIM B, COLB AS INTEGER
DIM col as integer
DIM CT AS SINGLE
DIM RESET_DEMO AS INTEGER
DIM max2 AS SINGLE
liongfx_SCREEN 18,32
liongfx_CLS
RANDOMIZE TIMER
msgbox 0, "using: wait a moment after render finished scene, then push any key, best way to render new: push ESC"
X = RND(1,255) * 640
Y = RND(100,255) * 480
RESET_DEMO = 1
DO
IF RESET_DEMO = 1 THEN
liongfx_CLS
RESET_DEMO = 0
X = 1
Y = 1
COLR = RND(1) * 255
COLG = RND(1) * 255
COLB = RND(1) * 255
P = RND(1) *1
END IF
X += XS
Y += YS
FOR xt = x TO 1000+x+P
FOR yt = y TO 1000+y+P
R = (COLR + ((TAN(XT/1024) + COS(YT/768)) * 255))/2
G = (COLG + ((SIN(YT/768) + TAN(XT/1024)) * 255))/2
B = (COLB + ((COS(XT/1024) + SIN(YT/768)) * 255))/2
COL = liongfx_RGB, R,G,B
liongfx_PSET XT, YT, COL
NEXT yt
NEXT xt
liongfx_SCREENSYNC
IF X < 512 THEN
XS += 0.001
ELSE
XS -= 0.001
END IF
IF Y < 384 THEN
YS += 0.001
ELSE
YS -= 0.001
END IF
IF liongfx_multikey_up, 24 THEN
liongfx_print "this script is ok, rendering new one :)"
RESET_DEMO = 1
END IF
IF liongfx_multikey_up, 24 THEN
FOR xt = 0 TO 1024
FOR yt = 0 TO 768
R = (COLR + ((TAN(XT/1024) + COS(YT/768)) * 255 ))/4
G = (COLG + ((SIN(YT/768)*gettickcount/200*128 + TAN(XT/1024)) * 255 ))/4
B = (COLB + ((COS(XT/1024)*gettickcount/200*128 + SIN(YT/768)) * 255 ))/4
COL = liongfx_RGB, R,G,B
liongfx_PSET XT, YT, COL
NEXT
NEXT xt
END IF
LOOP UNTIL liongfx_inkey = "p"
liongfx_getkey
liongfx_sleep
best regards, Lionheart
lydia_sp
07-08-2009, 19:00
hi mr. lionheart surfer. question: do you continue your particle example with circles ? It`s possible to move the objects by key input ? would be good to see. thanks for new examples. pleasure to see more. Check all scripts this evening. Coming back from my girl friend, party time over three days !!! great. now I am hungry.
do you work with new tbgl sprite examples too ?
hasta la vida, lydia
Lionheart008
07-08-2009, 20:48
good evening, senorita lydia_sp :)
do you continue your particle example with circles ? It`s possible to move the objects by key input ?
oh yes, of course I will do that the next days/weeks (I think so!). I have only to compile in a better way all the multikey and put and imagecreate stuff new...because I have noticed some mistakes --men/man and users are only doing mistakes, not machines! ;) -- at my side... :) then I will examine and explore the circle and line example and show it for a better handling.. if it doesn't work at all or as I wished I change the site to freebasic... no, that was only a joke ! I plan some holidays with girl friend and doggy...
party time over three days !!! great. now I am hungry.
thank you for this sentence, I must laugh. I am always hungry and thirsty too, even in summertime, but I cannot celebrate parties three or four days or all along the night, I am no longer 20 years old 'young'! But I know that feeling very well to have a heavy or foggy mind and nothing is going on right or everything happens with a certain distance to you... wish you good recovering if you have such a foggy head ;)
tbgl and sprite example I will have a closer look also next week...
good evening, lionheart
Lionheart008
07-08-2009, 22:30
without any words... see and wonder how simple this little love things could be ... ;)
uses "liongfx", "console", "math"
DIM x,y AS INTEGER
DIM x1,y1 AS INTEGER
DIM i AS SINGLE
liongfx_SCREEN 18, 32
liongfx_windowtitle "popart and your heart meets liongfx"
DO
i += 0.005
x = SIN(i)*120 + 200
y = COS(i)*120 + 200
x1 = SIN(i*2)*75 + x+1
y1 = COS(i*2)*75 + y+1
liongfx_SCREENLOCK
CLS
liongfx_COLOR liongfx_RGB, 255*4, 163, 79,8
liongfx_CIRCLE x+200,y+200, 50, &h00FFFF*sin(gettickcount/200)*128
liongfx_PSET 300+i*40,300-i*12,&h0040FF*sin(gettickcount/200)*128
liongfx_COLOR liongfx_RGB, 55, 163*sin(gettickcount/200)*128, 79,8
liongfx_CIRCLE x1,y1, 10, liongfx_rgb, rnd(1,255),10,128*10 'sin(gettickcount/200)*128, 79,8
liongfx_PSET 200+i*20,200-i*10,&hFF80FF*2
liongfx_SCREENUNLOCK
liongfx_SLEEP 10
LOOP UNTIL liongfx_INKEY = "q"
that's my 10 cent for today, bye, Lionheart
Lionheart008
13-08-2009, 21:51
hi all :)
my last picture and example for liongfx, I will (have to!) make a break for a longer period. private things due me to do this one. not so easy but it's more important to going forward with other professional things (criminal novel, musician, lightwave 3d!) :D
I have to focus my things to this one, it's better for me... after having some day free (holiday) I have made up my mind to make this decision...
uses "liongfx", "console"
liongfx_Screen 12
liongfx_windowtitle "rectangles"
liongfx_View 220,140, 420,340,5,2
liongfx_Line 10,10, 100,100,4,16,2
liongfx_locate 2,4
liongfx_color 200,10
liongfx_Print "hello sleeping thinbasic world in summertime"
liongfx_Line 20,20, 180,180,6,12,9
liongfx_Line 24,24, 80,80,4,16,4
liongfx_Line 44,44, 160,160,4,16,3
liongfx_Sleep 150
liongfx_getkey
very simple but I like it ! that's all for today and this year. have all a good time and fun with thinbasic coding. I have learnt a lot of good things here, thanks! good luck for thinbasic for the future ! :D
tschüss, frank
Petr Schreiber
13-08-2009, 22:06
Hi Frank,
well, that is kind of shocking announcement :tears:
I understand sometimes the "real life" gets so intense it is better to focus on family/work to not let the time slip by.
Good luck with your work and adventure, and do not forget to come back if you will feel the time is right. You are always welcome here!
I consider your lionGFX experiments are quite interesting, and I think I am not alone.
Surprised Petr
P.S. Don't forget to let me know once your criminal novel is out!
lydia_sp
18-08-2009, 20:36
oh no surfer! you will quit the forum ? WHY ? I am sad about that!!! I thought I can learn and use new liongfx power for games ? don`t give up, I am shocking too. petr said this. I follow this feeling. real life is short. not every time is always lucky or making you happy. take a break and come back. I like your engagement like four, five other guys here. One reason to start my entry for thinbasic as female user. don`t like to leave good guys at the forum I have read so many good things. I pet my wizzard: :wizard: and say good luck for your profession and a lot of success !
adios, lydia