Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Chicken way:Dealing with a set area and text

This topic is 5122 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I''ve been working on this problem for a couple of days now and I am currently in a deadlock. What I want to do is have an area where the user can type in commands and have the results displayed in the same area. My problem is the act of actually creating another line i.e. another row beneith what the user has typed. Say for example my area is a 256x256 character grid. I was at first trying to see if I could allocate/de-allocate memory within that grid so if the user types a couple of letters and pushes return a 2D array will be allocated. Like so:
This is a test on the first line0000000000000
This is a test on the second line000000000000

The zeros are not printed and are there to let the print function know that it is the end of the line. The zeros also serve the purpose of keeping the array uniform plus I don''t think you can allocate a 2D array that has four columns on one row and sixth on the next. I then started contemplating that why not fill in the whole 256x256 grid full of zeros and don''t allocate or de-allocate memory as the user enters in text/deletes it. This way it is easier on the programmer, I''m lazy, and the risk of memory leaks is almost eliminated.
This is a test on the first line0000000000000
This is a test on the second line000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
...

Would it be better to utilize the program this way since the area is small and if the user tries to type out of bounds, the information above it is erased since the program I''m making will not have any commands that have that long of syntax? Thank you.

##### Share on other sites
In order to better find a solution to your problem, I would need to know what your platform you are making this on, and what APIs your using. For example, DOS window, Windows, Text, GDI, DirectX. They all handle text placement a little differently. If you want, stop by our forum where it is a little less congested and maybe we can sort this out.

Sincerely,
Randy Trulson
www.GamePotato.com
www.NeuronGames.com

• 38
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631365
• Total Posts
2999585
×