PDA

View Full Version : FreeBasic SDK: first working example



ErosOlmi
20-09-2007, 18:03
Hi all,

here again on using FreeBasic language to be able to create thinBasic modules. This time not only words but a real working example. For the moment it is just a simple example implementing a graphic console (text and few drawing directive). But it is working fine so far and it is using both numbers and string in native thinBasic way (OLE32 strings).

I think I've also found a simple and official (I mean without any complicated or trick tasks) way to manage OLE32 strings (BSTR) directly into FreeBasic source code both to pass and receive strings. But we will see in a new thread in next days.

For the moment I just need to have some confirmations about this little module. Is it working for you?
If all will be OK, I will release also FreeBasic sources and needed .lib files to be able to create FreeBasic modules.

Have fun and please tell me if script example is working on your box. Just put included files into any new folder (of course thinBasic at least 1.4.0.x must be installed) and run script. You should get a window that will show some graphics, circles and text.

Ciao
Eros

UPDATED:
Thread closed because more advanced stage have been acquired on FreeBasic SDK.

Petr Schreiber
20-09-2007, 20:18
Hi Eros,

on my PC it works good.

First pixel fill takes about second, circles draw fast.


Bye,
Petr

ErosOlmi
20-09-2007, 20:38
Yes, first pixel set is a 640x480 loop, so 307200 iterations. Not so good for an interpreter.

Thanks for you testing Petr.
I will release the source code of the module very soon in order for all to have a look how to use FreeBasic.
Seems this will open a lot of new possibilities.

Ciao
Eros

Michael Hartlef
20-09-2007, 20:55
Same here, works fine. Speed is similar to Petr's.

Petr Schreiber
20-09-2007, 21:42
Eros,

to clarify speed, I did simple measure and it seems the first color fill takes about 687 ms, and this time value is very stable in any run which is good.

One thing regarding the module - I would like to choose resolution and bit depth rather than mode number. Do you think it would be possible ? If not, no problem, I am still quite used to similar approach from PB/DOS and SCREEN statement :)


Thanks,
Petr

ErosOlmi
20-09-2007, 22:08
Petr,

this module will not be released as official thinBasic module but as FreeBasic source code plus FreeBasic project file under FbEdit IDE (see http://www.radasm.com/fbedit/ ) to be propedeutic for thinBasic users to develop thinBasic modules using FreeBasic.

So developed functions are just an example on how to develop them under FreeBasic. Everyone will get the needed files and do what they will prefer. So do not worry about functionalities right now :D I'm just wrapping native FreeBasic keywords without nay big strategy. I just choose Graphic console functionalities because they are simple easy to be mastered very quickly. I'm not a FreeBasic expert right now :D
FreeBasic is so rich of native functions plus have a lot of 3rd party library that I suspect limit will just be the fantasy.

At the moment I'm adding comments to FreeBasic source code plus adding some more functions to show how to pass variables (both BYREF and BYVAL), how to return numeric and string data, and things like that. I'm also still working on exposing some more thinCore functionalities to FreeBasic but maybe I will leave some for the next implementation.

So be prepared to have complete FreeBasic SDK by mid of next week. I will work a bit on the week-end and release it next week.

Ciao
Eros

ErosOlmi
20-09-2007, 22:37
Hi Petr.

As usual your requests are so interesting that I didn't resist to add them.
See first post on this thread and new example in zip file.

Let me know.
Ciao
Eros

Petr Schreiber
20-09-2007, 22:46
Eros,

yesterday night I talked with my friend about how short time it takes to see new feature in thinBASIC.
I think you made new record this night :D


Thank you,
Petr

ErosOlmi
20-09-2007, 23:14
Well, speed in adding new functionalities is due to the interface we have exported from thinCore. The set of exported functions are now quite tested and stable. The only delay can be when dealing with different ways to handle string data types but for numeric, problems are zero now.

Ok, I want to beat myself in dev speed ;D
Added the following other 3 functions. Download from first post in this thread:

FBGFX_Cls[(Mode)]
FBGFX_Color(Fore, Back)
FBGFX_RGB(R, G, B)

I had to add specific RGB because generated color number have also alpha channel inside. From FreeBasic help file: "It returns an unsigned integer in the format &hAARRGGBB, where RR, GG and BB equals the values passed to this function, in hexadecimal format. AA is the implicit alpha value and is automatically set to &hFF (opaque)."

Tomorrow maybe other few. Now I go to sleep ;)

Good night!
Eros

Petr Schreiber
20-09-2007, 23:20
Incrrredible !

Thanks and good night :),
Petr

kryton9
21-09-2007, 22:56
Sorry for not participating in the tests, I am sort of staying away from other languages so I can focus on thinBasic and poweBasic with a clearer mind.

But in reading about Vista, new hardware in many cases being limited with drivers for Vista, if I need to make the switch to linux, it will be great to know can use freebasic to still develop for thinBasic if powerbasic doesn't make something for linux by then.

Michael Hartlef
22-09-2007, 08:16
Kryton, you can't develop modules on Linux to use for thinBasic on Windows.

Michael Clease
22-09-2007, 10:28
He might be able to if he uses WINE.

I havent tried it but would be interesting to see if thinbasic will run.

kryton9
22-09-2007, 22:28
I couldn't get thinBasic to run under wine the last time I tried it, but I didn't dig into it.

Mike you are right of course, thanks.

Petr Schreiber
23-09-2007, 08:26
I think it was possible to run thinBASIC under Linux,

some time ago I tried it with some old ( 3-4 years ? ) Knoppix live distribution.
There were some problems with thinAir richedit, but generally I think it worked.

I must try again with newer Linux.


Bye,
Petr