Porting from Blitz, first impressions

Advanced game related topics
gpetersz
User
User
Posts: 39
Joined: Fri May 20, 2005 11:24 am
Location: Budapest, Hungary
Contact:

Porting from Blitz, first impressions

Post by gpetersz »

Hi everybody,

I've "struggled" for some days with Purebasic and my "Blitz-formed" mind started to change. (I've been using Blitz since 2001).
Seemingly PureBasic gives more flexibility (smaller executable) for the price of more complicated coding.
For example, if I open a screen (set graphics mode) in Blitz then every
drawing command will work on the frontbuffer (unless I specify the
backbuffer to allow double buffering). While in Purebasic I have to
put my drawing (mostly) between startdrawing and stopdrawing blocks.
It requires a bit more attention when constructing the source.
There are other examples like locate before drawing something (what has its advantages (less parameters in drawing functions), and disadvantages (two lines of source for one result) as well ). Or ExamineMouse before using Mouse functions (first I thought that InitMouse would do, but not).

It requires more attention, a bit longer source, a bit more probabiltiy of errors , but it gives more freedom and flexibility, smaller executable (and probably faster, since it doesn't refresh keys or mouse constantly).

Overall I am very content with PureBasic, though I have to get used to it and know it.

One strange thing what bothers me a bit (some seasoned Purebasic coder, or Fred might help me).

It is the currency of objects. I mean many commands refers itself that it works on the "current" screen, sprite, image etc.
On the other side this currency is many times set by some kind of command like CreateImage what (I guess) sets the current image to the created one. It means that one should follow this currency in one's code to secure proper execution, ie I experienced some errors (what were solved later by me) when I haven't followed it exactly.

I mean, for example it would be nice that I could set directly what is the object I am talking about.

For example:
Result = OpenScreen(Width, Height, Depth, Title$)

StartDrawing(ScreenOutput(Result))

would be nice. Now it gives an "Incorrect number of parameters" error, but it means that I has to know which is the current screen (whose ID is returned by ScreenOutput).

The other thing I would be very happy with if there would be marked the commands in help with something like this: "This command sets/changes the current screen/image/sound etc".

What do you think? How do you handle this issue?

(PS: Anyway, PureBasic is just great, complex and useful, with many possibilities.)
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Just a word about the current object stuff, it will probably changed in the next major release of PB as it generates some important problems (especially threading issue). I'm happy to see you wasn't lost when switching..
gpetersz
User
User
Posts: 39
Joined: Fri May 20, 2005 11:24 am
Location: Budapest, Hungary
Contact:

Post by gpetersz »

Thanks!
No I wasn't lost, I've been programming for some time, actually. :) (since around 1985) PureBasic is COOL, I am just got used to comfortable (and resource eating) programming, that's all.

It was just something I would prefer that I wouldn't rely on some "current" image/screen/anything but if I once created them (with #PB_Any), then I could address exactly which screen/printer/window I want to draw to and so.

I am happy with what I've got, I only asked others how they handle this thing (not a problem really, it requires attention, that's all).

By the way (if the creator himself turned up here :idea:)
can I put some kind of breakpoints? For example if I want the program to run to a specific point and then "switch to debug mode".
In Blitz there was a "Stop" command (sorry to mention Blitz all the time), where the execution stoped and I could continue to "Step" on.
gpetersz
User
User
Posts: 39
Joined: Fri May 20, 2005 11:24 am
Location: Budapest, Hungary
Contact:

Post by gpetersz »

"CallDebugger"

You see? I won't ask silly things again... ;)
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

Fred wrote:Just a word about the current object stuff, it will probably changed in the next major release of PB as it generates some important problems (especially threading issue). I'm happy to see you wasn't lost when switching..
Good.

I have had problems with current objects in threads.
viewtopic.php?t=15224
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 715
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

welcome aboard :)
gpetersz
User
User
Posts: 39
Joined: Fri May 20, 2005 11:24 am
Location: Budapest, Hungary
Contact:

Post by gpetersz »

If it is aimed to me then THANKS! :D

I want to delve deep into Purebasic (I can't stress enough: I liket it very much though I've been using it only for a week or so).
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

The bad news is that there is nothing 'deep' in PureBasic to delve into. The language and compiler are so simple that sometimes it can be shocking.

The good news is that this is the real power of PureBasic. It avoids all the complexity, keeps things simple, keeps things pure.

It means that you are free to delve deep into your computer, explore its processes, explore its memory. You're free to delve deep into the libraries and APIs that are usually reserved for 'C gurus.'

ps.

Do you know where I can get a copy of JetPac Willy?
gpetersz
User
User
Posts: 39
Joined: Fri May 20, 2005 11:24 am
Location: Budapest, Hungary
Contact:

Post by gpetersz »

That's what I suspected, thanks ;)

Yes, but you have to wait until I got home from work, I'll have the e-mail of the programmer (David, who is from Wales).
Actually, I am not on that project any more.
The coder took such a long break (about 2 months) that I couldnt wait, so I left what'd been done for him (it is the main character, 1 tileset, 2 enemies, splash screen, and GUI, don't know how the project's going now.
We planed to sell it as shareware, and halve the royalties.

I use the images in my portfolio though (since they were meant to be commercial). ... and only use the half pre-paid, half royalty or full pre-paid system since. 8)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Result = OpenScreen(Width, Height, Depth, Title$)

StartDrawing(ScreenOutput(Result))
No need to. You can only open one screen at a time!

For images you can use somthing like this:

Code: Select all

Image1 = LoadImage(#PB_Any, FileName$)
Image2 = LoadImage(#PB_Any, FileName$)
UseImage(Image1) : StartDrawing(ImageOutput())
gpetersz
User
User
Posts: 39
Joined: Fri May 20, 2005 11:24 am
Location: Budapest, Hungary
Contact:

Post by gpetersz »

Thanks!

Yep, If I understood right I have to "set" the current screen
just before I StartDrawing(). That's okay, I only "complained" that
it would be easier (for me). Maybe it is because I am used to Blitz's
handle-system.

Back to Willy (GedB's question). I asked David (the coder) if I
could PM his e-mail, I am still awaiting the answer.

I suspect that the project is on halt at the moment, I cannot find the web page either.
Post Reply