print sprite from a DLL

Just starting out? Need help? Post your questions and find answers here.
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

print sprite from a DLL

Post by MadMax »

Is it posible to make a DLL that will place a sprite on the screen?
TIGER
User
User
Posts: 81
Joined: Mon Feb 23, 2004 8:33 pm

Post by TIGER »

Yes but all drawing routines (like open screen and load sprite)
you must put inside the DLL

Othervise you shoud use pointers.
PIII450 128RAM TNT2
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

Othervise you shoud use pointers.
Pointers it will have to be then 8O . Any hint on how I should use this. I now what pointers are more or less, but I'm not sure how I would use them. I imagine that I would need to pass the screen to the dll and tell it to use that screen's buffer, but have no idea how I would do this. :oops:
TIGER
User
User
Posts: 81
Joined: Mon Feb 23, 2004 8:33 pm

Post by TIGER »

Its depends.
You can pass a screen pointer (screen ID) and
a sprite pointer (sprite ID) to a dll
Its not easy.
Its changes every time when you change a screen depth or resouluiton.

What do you want to do anyway ?


pointer - is a memory adress where your screen,sprite,sound are.
PIII450 128RAM TNT2
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

well, I was just playing around trying to make dll's for practice, and I have a procedure that does that. Being a lazy typist, I prefer to write pinta() to DisplayTransparentSprite() :roll:

I get the idea of passing the screenID, but then I don't see a way of using that information in the DLL, could it be UseBuffer(ScreenID) ?
TIGER
User
User
Posts: 81
Joined: Mon Feb 23, 2004 8:33 pm

Post by TIGER »

Hm not exactly.

Well first of all you need to know a screen structure.

I dont know because i never had a need to do that.
But i ve done some graphics DLL for "darkbasic" (know that one ?)

Anyway the screen type might match but i cant tell you for sure.

Once you got a screen pointe (screen id ar screen memory adress)
you have to know the resolution and depth.
Theh you can calculate the memory lenght of screen using this formula.

width*height*depth/8 the result is in bytes.-

Now you can poke your pixels on the screen.
And its different for any screen depth.

The easier one is for 24 bit depth.I think you inderstand why.



Anyway the complete process is not simple.
You need to know how to work with memory and pointers.
And be carefull because wrong use might crash your PC.
PIII450 128RAM TNT2
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

Well, I' ve been playing around with the memory buffer(), after much pain and searching around, I've more or less sussed out how this works 8) . Getting the colours right, specialy in 16bit mode is a bit troublesome, but fine once you realize how this works. Of course as you say 24bit is much more straight forward.

Haven't tryied it out in a DLL yet, I've got a bit side tracked playing around with this way of plotting, could prove very usefull for real time effects in 2D.
Post Reply