Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Editing a bitmap?

Author
Message
Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 25th Aug 2004 06:45 Edited at: 25th Aug 2004 06:55
Hy!

i'm making a scorched earth re-make and was wondering if there is a way to edit a bitmap?

i need to do this so that when i draw the terrain i don't have to draw EVERY SINGLE PIXEL INDIVIDUALLY!

[edit] i just found the "make bitmap from memblock" command and it looks promising...but i don't know the exact commands to use memblocks and that command to essentially "edit"(or just destroy and re-create) a bitmap...

[edit2] okay i found the "make memblock from bitmap" command and now i need to know how to get info from the memblock and edit it...(all i need to do is change pixel color values...)

anyway thanks in advance!

--
teh warrior

"We make the worst games in the universe."
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 25th Aug 2004 07:29
er. why not use the 2D drawing commands?, you can draw circles, lines and boxes, plot pixels etc, if you use lock pixels before you do any drawing then they are quite fast, if you are planning a realtime deformable landscape then they should be able to manage that.
As for the memblocks, if you are in 32 bit mode for the bitmap then you have a byte for alpha, a byte for red, a byte for green and a byte for blue, so four bytes make a pixel (I think it`s argb format anyway, someone will correct me if I am wrong), just read the pixels from left to right and go down a line every xx pixels where xx is the width of the bitmap, CattleRustler did some work on effects using memblocks, you might like to ask him.

Mentor.

PC1: P4 3ghz, 1gig mem, 2x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Aug 2004 07:35
You could just use a filled circle of background colour to erase some of the landscape. I posted a filled circle command to CodeBase some time ago that you could use.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 25th Aug 2004 07:39 Edited at: 25th Aug 2004 07:42
so what exactly does the "lock pixels" command do?

anyway thanks for the help

"We make the worst games in the universe."
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 25th Aug 2004 08:25
You might want to take a look at this recent post which does some clever tricks with pixels and memblocks.

http://forum.thegamecreators.com/?m=forum_view&t=37695&b=4


Boo!
Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 25th Aug 2004 08:35
interesting thread...

but i've run into a problem when i use "cls" and then use the "dot" command to put pixels where i want them, then use the sync command..all i get is a black screen...

"We make the worst games in the universe."
Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 25th Aug 2004 09:02 Edited at: 25th Aug 2004 09:28
never mind..by using the lock pixels command before my editing and the unlock pixels command after my editing i've managed to get the FPS way up!

expect a demo soon!

like as in 2 minutes! lol...just had to fix one bug...

ok here is the link-
http://www.wakehosting.com/upload/files/OmCYdrgo/Scorched%20earth.zip
use the mouseclick to make explosions...
note: you can't do anything until the "loaded" text appears...

i will be adding sound effects and tanks(or something else) and explosion graphics...also the level was whipped up in paint but i can use any image that has black for the sky...

but i just started working on this last night so i'm pleased with myself

will move this to WIP soon...

"We make the worst games in the universe."

Login to post a reply

Server time is: 2025-06-09 04:11:40
Your offset time is: 2025-06-09 04:11:40