• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Player-Missile Graphics Reloaded: EZ_Sprite 1.0 and more ....

Started by Theo Gottwald, October 09, 2011, 10:11:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

Those few here who had an Atari 8-bit Computer may remember the term "Player Missile Graphics". It were single-color "Sprites", small hardware-accelerated 2D Bitmaps you could define and move around on the screen. The word "Sprites" became modern later, with the old "Commodore 64" who had real "Sprites" which you could move also vertically without copying Memory. In fact if you had a C64 and "Simons Basic" you may have had more Sprite commands then PowerBasic today (without - see below). Hey that was 1983!

PowerBasic has no builtin Support for Sprites, means if you want to use them you have to do a little more handwork.
To avoid that you can choose which way to go.

There are several different 3rd Party add ons making it easy to use "Sprites" with PowerBasic.. Let me share some.

At first one that is already builtin:

Direct X9 Example from Jose Roca
Look for the post with this text:
QuoteDemonstrates how to create an animated 2D sprite using D3DXSprite which is hardware accelerated and fully compatible with 3D generated content.

In my case i did not want a separate screen but use it for animating a GUI-Object. Also i wanted to be independent from DX9.

Let's see another option, maybe the DeLuxe Option:
GDImage

Quote
• Create child controls, popup layered windows, popup shapped windows (window based on region).
• Sprite animation, dynamic image rotation.

I guess that this one is the best sollution, if you can afford the price (450 Euro) and you have no problem with adding an additional DLL to the final project.
Both things were not acceptable for my "Micro Project". It would have been an Overkill for my case.

Then I had the chance just to use PureBasic as PowerBasic AddOn and make my own "Sprite DLL" with PureBasics Sprite Features.
PureBasic is an good AddOn for PowerBasic, as it has a lot of useful libraries, including a extensive DX7/9 2D-Sprite Library and even a DX9 Sprite 3D-Library.
I could have made my tasks into a DLL and use it from PowerBasic. Anyway, again i did not want to be dependent on DX9 and i did not want an external DLL.
For 79 Euro the price of PureBasic is acceptable as an AddOn.

Then there is another sollution - again a DLL, also using DX9 or OpenGL from the graphics card.  It's the N3XtD Engine. While the price is a perfect zero, again this is a DLL and would have been for my case an overkill. Also it depends on DX9 or OpenGL, what i try to avoid for my programs.

Next I comes the product i have been choosing this time, it was EZ_Sprite 1.0 - the SLL. The price of 29 $ is acceptable even for small projects. EZ_Sprite 1.0 comes as a DLL and a SLL version. If it would have been only a DLL I would not have taken it, but as a SLL its a fine thing.

I can just #LINK it into the PowerBasic programm and i have additional Sprite commands. EZ_Sprite integrates just as if it would be already part of the PowerBasic runtime/language.

EZ_Sprite 1.0 is a small component (46 kb) and its independent of any installed DirectX or like that. Which was important for my case.

Chris Boss wrote:
QuoteEZ_Sprite requires no special hardware (no DirectX, OpenGl, etc.)
...
- EZSprite does not use the Windows API for the actual sprite drawing. While it uses the DIB API's for the sprite buffers and BitBlting to the screen, EZSprite uses my own proprietary sprite drawing engine which is optimized for speed. EZSprite was compiled using PB 10 so you know you are getting a fast engine.
Which sounds really good for my case.

Of course it leaves wishes open for that price and size. And i doubt i would use it to make a game. The world is full of games, really good games.
Using the ~20 Sprite commands from EZ_Sprite, we will not compete with them. But for simple GUI-Animations, this is a fine thing.

It works fine, the help is easy to understand, and the support is fast. In short I can recommend it.

Theo Gottwald

Let me add something techniocally about Sprites.

Originally - even on the C64 - Sprites can move over the complete desktop, and over any window borders.
Just like today the Mouse-Pointer. For technical reasons, this is not so easy any more.

At least with EZ_Sprite, the Sprites must stay inside a Control and can not cross the Control boundary.
For GUI Animations this is completely Ok.

If you want to have Sprites "like on the C64" moving over the full desktop across any windows, you need to do something else.
You will need to make Forms around the Sprites, cut them using Regions and "move them your around self".

Christopher Boss

If you use the SetLayeredWindowAttributes API and the  %WS_EX_LAYERED extended window style, you can make a Dialog totally transparent (define a transparent color).

Create a Dialog the size of the screen (desktop) with no borders or caption bar. Using the API's above you can make it totally transparent.
Create a PB Graphic control the same size as the dialog and color it using the transparent color you define.

Now create your sprites in this Graphic control and they will appear to be free floating over the entire desktop.

Now I should note that while this works on Windows XP to Windows 7, on Windows 8 Preview it didn't work. I don't know if they changed some API's or not or whether it is simply a bug and will be fixed. Windows 8 isn't even a beta yet, so this doesn't necessarily mean anything.

EZ_Sprite has been recently tested on Windows 8 Preview and it works great.

Patrice Terrier

#3
Theo,

You should look more closely at the source code examples that have been posted on this forum a few years ago.

A quick search with "setlayered" should popups some.

Search also for "Boing" or "AeroGL", and do not forget to look at the DeLuxe "Of The Bay" project source code.

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Theo Gottwald

#4
Thanks for reminding me, Patrice. 

That Boing was the first impressive Demo on the AMIGA Computers that time. You revived it.
i did not find it in the forum search. So i attach it to this post. I kept it because it looks sooo nice!

It's a very nice example "How to do a sprite".
As its using "GLDrawDIB.inc", i  imagine that it needs / is dependent on something with "GL"?

QuoteNow I should note that while this works on Windows XP to Windows 7, on Windows 8 Preview it didn't work. I don't know if they changed some API's or not or whether it is simply a bug and will be fixed. Windows 8 isn't even a beta yet, so this doesn't necessarily mean anything.

Chris, can you keep an eye on what exactly is not working as expected oin windows 8?
You have the code, you can look which API has been changed/is not working.

Win 8 is at least for me an important point. Possibly you will find a bug this way?
Keep us informed whats changed. Your idea with the transparent control sounds most easy to do for me.

And why not post that code as an example how to make it with EZ_Sprites?
Attach it here.


Patrice Terrier

#5
Theo,

The original Boing2 thread, is already there:
http://www.jose.it-berater.org/smfforum/index.php?topic=2865.msg8611#msg8611

No need to post another (old) zip.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Theo Gottwald

#6
Ok, Patrice, i have removed the ZIP, as you found that Post with the original zip-file.

Quote
Now I should note that while this works on Windows XP to Windows 7, on Windows 8 Preview it didn't work. I don't know if they changed some API's or not or whether it is simply a bug and will be fixed.

...

EZ_Sprite has been recently tested on Windows 8 Preview and it works great.

Chris these two sentence do not really fit together. You are the only person to find out what really happens, and why it (in fact ) doesn't work on windows 8. Nobody (private)  else has the source code.