Board index » delphi » Reading and writing files...

Reading and writing files...

I am making my own tile based RPG, and currently, I am having it read 40x40
arrays for the different pictures of objects and putpixeling them to the
screen.  I'm using 640x480x16 mode.  First question, is there any easy way
to change that to 640x480x256?  Also, using the putpixel command with an
array is extremely slow.  I would eventually like to make my own object
editor for making monsters, roomtiles, weapons, etc.  I was wondering what
kind of file I should use for the objects.  Is there any way to getimage
off the screen and then save that to a file, and later putimage the image
back from the file on the screen?  Also, the file can't just be the image
'cause I am going to add other stuff in it like what type of obj it is, how
much it weighs, that kind of stuff.

        Thank you for your help,
                                Gregory

 

Re:Reading and writing files...


Quote
Gregory Johnson wrote:

> I am making my own tile based RPG, and currently, I am having it read 40x40
> arrays for the different pictures of objects and putpixeling them to the
> screen.  I'm using 640x480x16 mode.  First question, is there any easy way
> to change that to 640x480x256?

This is so simple you've already thought of it yourself but perhaps you
found it to be unpractical. Anyway: if the image is not yet in an array
just put it to the 16color-vga-screen, read it in an array with
getpixel, swap th 256-color-mode and put it on the screen again. I can't
think of anything better, because you can't put a 16-color-image
directly to a 256-color screen with putimage.

 Also, using the putpixel command with an

Quote
> array is extremely slow.  I would eventually like to make my own object
> editor for making monsters, roomtiles, weapons, etc.  I was wondering what
> kind of file I should use for the objects.  Is there any way to getimage
> off the screen and then save that to a file, and later putimage the image
> back from the file on the screen?  

You've already said it: use getimage and putimage, they're quite fast.

Also, the file can't just be the image

Quote
> 'cause I am going to add other stuff in it like what type of obj it is, how
> much it weighs, that kind of stuff.

Declare a record with all the information and write it to an untyped
file together with the image and whatever else you want to store there.
If you want more info on this you could have a look at my
programming-page or email me.

Quote

>         Thank you for your help,
>                                 Gregory

Good luck!

Remco de Korte
Soft Machine
Nederland
http://www.xs4all.nl/~remcodek/program.html

Other Threads