Text color question

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

As for changing the whole screen color without clearing what's already there, I'm pretty sure you can't. If I recall, I spent hours trying to figure that out for The Traveling Swordsman, and ended up having no choice but to clear the screen in order to change the background color (and the foreground color of any already-printed text). Load the game and type >STYLE DEFAULT and >STYLE CUSTOM to see what I mean.

As for changing the color for a block of text without the screen's background being to the right of lines that wrap before the screen's rightmost edge, you *might* be able to do that by setting a window. I haven't tried it, but I think you'd be able to get the current line, start a text window with the colors you want, then end then window when you're done. Check pages 147 and 148 in The Hugo Book. Might be a dead-end, but it's about the only way I know of to do what you want.

Well, there is probably one other way, but it'd be a pain. If you set the font to fixed-width and write a routine that pads you each line out to the display width, it might work. Basically you'd have to print the line then use the "print to" command specifying the column width of the display to fill in the empty space. But I'm not sure how you'd dynamically break the lines apart offhand. I could probably figure it out given a few hours. Ha ha.

Isxek
Posts: 10
Joined: Sat Aug 15, 2009 11:08 am
Contact:

Post by Isxek »

Would display.needs_repaint have anything to do with it? Or is it really just for the GUI version of the runtime?

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

I don't remember what I found out setting that on the display. I don't think that does the trick. It seems like it's just a flag for the engine itself to know that a repaint is required, but I don't think it alters how things look otherwise. I would have to test it.

Roody_Yogurt
Posts: 2181
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Sorry to bump an old thread, but I've long thought the problem presented here was an interesting one and have wanted to throw in my two cents.

Now, it's likely that Sca went and wrote his game with another system. There was an interesting game released later that year called Works of Fiction that used Glulx's splitscreen functionality to interesting effect.

Anyhow, Hugo doesn't have such functionality, so there'd have to be some trickery involved. Personally, I would draw two windows on the top of the screen. They would represent the two character the player can switch to. All they would show is the room descriptions of the room each character is in, and maybe some event text if there is anything going on.

You'd have to be careful to not write more text in either of those windows to cause a MORE prompt, though, as that'd just look ugly.

So, three windows (the top two and the main window). Three color schemes. When the player switches characters, the two windows switch colors and everything is cleared and redrawn. I bet, in the end, it'd feel pretty natural to the player.

Post Reply