Page 1 of 1

Questions for Kent

Posted: Mon Aug 16, 2004 1:14 am
by Guest
Hello,

I have several questions. I hope you can help me.

Q1
With HUGO it's possible to recognize the key pressed through the system(read_key) command which returns a number associated to the key pressed. In hugolib.h the value related to some keys are given (11 for UP ARROW, 27 for ESCAPE, ...) but I found nowhere the complete list of the keys... In particular I'm looking for the values for the PAGE DOWN et PAGE UP keys.
Where can I find them?

Q2
The player can change the font used in the interface.
I'm making a graphic oriented game with a relatively complex interface and it's designed to run best with a specific font size. I wonder if there's a way to impose a font in a program?

Q3
The pictures are stored in the ressource files. Is it possible to know in the program the dimensions of a picture (in number of characters, the unit used by HUGO)? That way it would be possible to create a window to hold the picture with exact dimensions. I know HUGO resizes the pictures in the window so they are entirely displayed, but the ratio height/width can change a lot from a picture to another. Ideally the program should change the screen interface depending that ratio.

Thanks for helping

Posted: Wed Aug 18, 2004 8:52 pm
by Ice Cream Jonsey
Excellent questions, I'm quite curious myself. I'll fire 'em off to Kent next time I see him on the ifMud if they continue to go unanswered.

Hugo layout

Posted: Fri Aug 20, 2004 6:45 am
by Kent
Sorry for taking so long to get around to this. I'll preface my response with a couple of things about Hugo's layout design in general that may help explain some of these things.

The key thing is that Hugo's layout system was designed from the start to be platform-agnostic. In a perfect world, every Hugo game would display differently on any sized or shaped display. There were also issues with graphics libraries for the various early platforms, particularly with scaling up, which affected the defined behavior for graphics placement, etc.

It was decided that Hugo's "windows" (essentially clipping regions for output) would be defined in fixed-width character dimensions. In practise, this ends up being much like percentage measurements (if done properly, that is) without introducing another metric. (This last one is important: the integration between the Hugo Engine itself and the port/OS-specific layer is supposed to be relatively dumb. The less the former knows about the latter--and vice-versa--the better. Otherwise, it becomes harder to modify one without introducing bugs for the other--a problem that only becomes compounded across multiple platforms.)

Anyway, onto the questions:
Q1
With HUGO it's possible to recognize the key pressed through the system(read_key) command which returns a number associated to the key pressed. In hugolib.h the value related to some keys are given (11 for UP ARROW, 27 for ESCAPE, ...) but I found nowhere the complete list of the keys... In particular I'm looking for the values for the PAGE DOWN et PAGE UP keys.
Where can I find them?
They currently don't exist as keycode values. This could actually be implemented on the Hugo side without too much difficulty, but there are platforms that don't have PAGE UP/DOWN--most obviously Palm and Pocket PC--so some alternative would need to be implemented. But currently there are no defined key values for PAGE UP and PAGE DOWN.
Q2
The player can change the font used in the interface.
I'm making a graphic oriented game with a relatively complex interface and it's designed to run best with a specific font size. I wonder if there's a way to impose a font in a program?
Not a specific point size, no. Because different fonts look different at different point sizes, and because not all fonts are available on all machines, a decision was made under the platform-agnosticism column to not allow the games to directly control output fonts other than basic styles and coloring. Especially at the time (it was several years ago that this design decision was made) web pages were notorious for looking atrocious when the designer expected a certain font and didn't get it. (I also decided at a certain point to disallow the packaging of specific fonts as resources both for compatibility reasons--not every system used TrueType fonts, for instance--as well as legal reasons, being that almost every popular font is copyrighted.)
Q3
The pictures are stored in the ressource files. Is it possible to know in the program the dimensions of a picture (in number of characters, the unit used by HUGO)? That way it would be possible to create a window to hold the picture with exact dimensions. I know HUGO resizes the pictures in the window so they are entirely displayed, but the ratio height/width can change a lot from a picture to another. Ideally the program should change the screen interface depending that ratio.
This has come up a few times, and is a good idea for a future feature for Hugo. As mentioned above, the original ports and graphics libraries weren't quite as good at scaling as the current crop are, so it would be possible now to better implement scaling. That said, it isn't currently possible for the program to know how big a given picture it is. It will scale it downward if necessary (with very good quality depending on the port and options selected), so the best approach I have found is to design images at the maximum/ideal size, but to understand that they may be significantly scaled down depending on where and on what they're finally displayed.

Posted: Sat Aug 21, 2004 3:26 am
by cauldron
Hello,
Thanks for your answers.