Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Learning Delphi | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
ETG

Tektite
Level: 14

Posts: 8/60
EXP: 11348
For next: 1723

Since: 03-16-04
From: Texas

Since last post: 6 days
Last activity: 5 hours
Posted on 04-10-04 03:27 AM Link | Quote
I have a copy of Delphi 7 enterprise edition, which I choose because it seems to work alot like Director, and am trying to learn to program with it.

I've done a little bit of many things (C++, x86 ASM, Lingo, Qbasic) but never enough to do anything usefull. I've got some books and searched online, but nothing I have found really helps to do what I want to do, so I'm gonna do it this way.

My end goal is to create a full featured editor bit by bit.
To do this I'll state a funtion I want to work on and someone (like you there reading this.... you do know Delphi don't you?) can teach me or atleast direct me to where the answer can be found. This way it will be half being taught and half learning on my own and should be quite effective.

So far I have made a program where you push the button and it changes the text of a label (from an online tutorial.)


I'd like to start off with an editor to move and change the proporties of the sprites on the title screen.

To do this I need to load a file, get bytes from a certian offset in the file, and display them in the proper boxes. Then I'll need to change them and save them back in the rom.

What options do I have to do this?
dan

Snap Dragon
Level: 43

Posts: 39/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 04-10-04 03:24 PM Link | Quote
Well, to if you want to load a few bytes from a reasonably small file (say, a NES file), you could always load the file into memory.

Declare an array of bytes in the 'interface' section of your code like so:


var
_ROM : Array of Byte;


Then, create a function called LoadFile:

procedure LoadFile(pFilename: String);
var
FileSizeInBytes : Longword;
Mem : TMemoryStream;
ByteCounter : Longword;
begin

Mem := TMemoryStream.Create(); // open the file
try
Mem.LoadFromFile(pFilename);
FileSizeInBytes := Mem.Size;

SetLength(_ROM, FileSizeInBytes); // re-dimension the array to hold the file

ByteCounter := 0; // start at the beginning of the array

// hooray for streams...no loop
Mem.Read(_ROM[ByteCounter], FileSizeInBytes);

finally
FreeAndNil(Mem); // memory cleanup
end;
end;


As for the displaying of graphics, that is a bit more work. I definitely recommend getting a book on Delphi, such as one of the Mastering Delphi series by Marco Cantu (depending on which version of Delphi you have). You should be able to get the PDF version off your local friendly file sharing application maybe.


(edited by dan on 04-10-04 06:26 AM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - Learning Delphi | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.004 seconds.