🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

text engine

Started by
3 comments, last by Fitore 22 years, 11 months ago
im thinking about adding a chatBox in my MUD, and im just not sure if i should use the win GUI or write my own textEngine(using blt() to load text bitmaps),
Advertisement
Hi, as no one has replied.. ill have a go

im a little unsure of the problem.. are u using direct x for your mud ??? please explain your program a bit more and ill try to get back to you :-)

Tim

<>
~ Tim
finally, ok, im using dx7 right now, but im thinking about switching to dx8, i know there''re functions that come with the sdk like drawText or something, but those are just for displaying text, i need something that works like a textbox, the text display itself as you type alone, but to achieve that with drawText, you need a nasty loop that eats up all the cpu cycles, and gets my graphics all jumpy and everything(im using a celeron 400). anyway, im just wondering how they did it in the ages of empires
ok.. so its a text box in direct x you want ;-)

well.. the way i have gone about this is to write a whole set of my own directX components (like text box, list box etc).. basically you need to capture the messages going to your form and then forward them to your DXEditBox component which then deals with it..

well I went the whole hog and did the following :

[TDXFormFM] - my apps form
capture the WhdProc ( where your messages will be sent 1st) and filter out the ones u are interested in and forward them to the TDXFormManager.. my delphi code is : Note ( i captured the virtual keys like arrow keys and forwarded them as un-used normal characters to my DX components

procedure TDXFormFM.WndProc(var Message: TMessage);
Var
Key : Word;
begin
inherited WndProc(Message);
If Message.Msg = WM_Char Then
Begin
fDXFM.KeyPress(Chr(Message.WParam));
End
Else
If Message.Msg = WM_KeyDown Then
Begin
Key := Message.WParam;
If Key = VK_DELETE Then
fDXFM.KeyPress(#249)
Else
If Key = VK_LEFT Then
fDXFM.KeyPress(#250)
Else
If Key = VK_RIGHT Then
fDXFM.KeyPress(#251)
Else
If Key = VK_RIGHT Then
fDXFM.KeyPress(#252)
Else
If Key = VK_RIGHT Then
fDXFM.KeyPress(#253)
Else
If Key = VK_HOME Then
fDXFM.KeyPress(#254)
Else
If Key = VK_END Then
fDXFM.KeyPress(#255);
End;
end;


[TFormManager] -
has a linked list of DXcomponents (type DXComponent)
keeps track of which component has focus and forwards the messages to that component

[TDXComponent] - the super class for all DXComponents.. ie everything inherites from this but its not used as it stands :-)
Has methods like Draw, KeyPress etc which can be called from the form manager
Has properties like top, left, width, height etc

[TDXEditBox] - the edit box (inherited from TDXComponent)
overrides KeyPress procedure from TDXComponent and deals with the key.. ie adds it to a string at the cursor pos.
the draw method will draw a box and the text inside (i use the textout command)


Im guessing u are using C .. if not and u are using delphi then give me a buz and ill help ya out more if you need it :-)

AIM name : WRATH Game

-tim
~ Tim
thanx tim,
by the way, im using c++, but dont worry, i can understand your basic structure,

peace

Edited by - Fitore on August 8, 2001 2:04:46 PM

This topic is closed to new replies.

Advertisement