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.

Newcomers DBPro Corner / Making a chat window.

Author
Message
Maxx illian
21
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 25th May 2003 14:59 Edited at: 25th May 2003 15:00
I want to make a chat window for my game. Ill have a space for it in a particular spot at the bottom of the screen. With a single line spot under that for what you type before it goes into the chat window.
Im just not sure how to update the chat window when the messages are updated and moves everything up to make room for the new message. Is there a way to make a window that keeps everything inside it?

*** Maxillian Software ***
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 25th May 2003 15:17 Edited at: 25th May 2003 15:17
my answer to this in previous projects was to dim an array and use it for storing incomming messages from other players. You can then draw the text using a for loop something like:



x_position can = the left most pixel of your chat box, then y_position can equal something like (presuming y_top equals the top pixel of your box): y_position = y_top + (N * 15) - that should space the lines of text out every 15 pixels unless i just did something stupid

This way, when a new message comes in, you can (if the array is full) delete the message at the bottom of the array, move all the messages down and insert the new one at the top, then it will automatically scroll. Hope that helps

p4 2.4ghz, 256ddr ram, Geforce4 MX 440
Innovate, redefine, recreate whats in your mind. It isnt fate, you decide, only you can cross that line.

Login to post a reply

Server time is: 2024-09-20 09:40:35
Your offset time is: 2024-09-20 09:40:35