Make Bitmap In game
by arnaux · in Torque Game Builder · 10/12/2009 (12:21 pm) · 2 replies
Hello,
I work on a photographers' games. For it I must be able to create miniature of from the photographs of the player.
How can I create, resize or crop a bitmap with Torque script ?
Thx for reply
I work on a photographers' games. For it I must be able to create miniature of from the photographs of the player.
How can I create, resize or crop a bitmap with Torque script ?
Thx for reply
About the author
#2
Like you sugest, I have allready create an imageMapDataBlock and resize the image in a t2dStaticSprite. But I was looking for an easiest/lightest way. The image are created from shootscreen 1024/768.
I do have the source code. The things is, i 'am trying to not change the code source to ensure the portability. I might be wrong.
Thank you again for your answer
10/13/2009 (5:02 am)
Thanks William,Like you sugest, I have allready create an imageMapDataBlock and resize the image in a t2dStaticSprite. But I was looking for an easiest/lightest way. The image are created from shootscreen 1024/768.
I do have the source code. The things is, i 'am trying to not change the code source to ensure the portability. I might be wrong.
Thank you again for your answer
Associate William Lee Sims
Machine Code Games
First, you should probably take a glance at tdn.garagegames.com/wiki/Torque_2D/ImageMap_Tutorial and tdn.garagegames.com/wiki/TGB/Reference:_t2dImageMapDatablock.
You'll need to create a new ImageMapDataBlock and modify the cellOffsetX/Y along with the cellWidth/Height to crop the image. To resize, you'll just need to change the size of the t2dStaticSprite that the datablock is applied to.
If you had the source code (I assume you have the demo right now), it would be very trivial to do this. You could copy the t2dStaticSprite class to a t2dStaticCroppedSprite class. Then you'd just have to add the 4 bounding lines as member variables and make minor modifications to the render function.