Sign in to follow this  
Derakon

Implementing arbitrary dialog boxes

Recommended Posts

I'm working on an all-purpose 2D sprite-based scripted game engine, and one of the features I want it to have is user-specifiable dialog boxes (where the "user" is someone developing a game that uses my engine). However, I'm no layouts guru, so I'm coming here for advice. I want the dialog boxes to be purely in-game (that is, not making use of OS-specific widgets, but rather drawn as a "sprite" in the game window). What I need is basic text formatting (ideally including word wrap that intelligently handles in-line images), images, buttons, and tables. Here's an image that looks like the kind of thing I want to be able to achieve, taken from the excellent shareware game Escape Velocity: Nova. I thought of finding an open-source HTML renderer and adding it in, but that would significantly bloat the engine, while adding tons of features that I really don't need at all (e.g. executable javascript; I already have a scripting language hooked in!). Does anyone have recommendations for lighter-weight modules that would: 1) accept text input and renders it to an image (or better, SDL_Surface) with the requirements I listed above (text formats, inline images, buttons, tables) and 2) tell me where "actionable" items (e.g. buttons can be clicked on) are located so I can properly handle user input? If not, where should I start researching this kind of thing? I just know that if I try to homebrew something without any background knowledge, the results will be so far from optimal as to be barely usable.

Share this post


Link to post
Share on other sites
TinyXML could be an option, there is a smaller/better one according to a few others but the name escapes me at this time. This would let you load XML files easily with little code bloat. Now it only solves one of a lot of your issues. I assume you're using SDL as a graphics library. I've never worked with it so the details how how to implement this is beyond me. But a few simple classes and you could be on your way, I've read a few topics like this on these forums so you might want to search them for GUI, interfaces, etc and see if you cannot get some ideas.

Edit: Found this last night, check out the last tutorial/example see if it helps: http://www.walterreid.com/opengl

Hope this helps.

[Edited by - Mike2343 on April 4, 2006 11:38:19 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this