Controlling message GUI with the hud.plist - How to do it?
Posted: Thu Nov 30, 2006 7:55 pm
Does the following in any way mean that there already is a way to make the sticky messages bug less intrusive by moving and resizing the message display with the hud.plist? If yes, does anybody have an idea of what a plist entry for doing that should look like?
http://svn.berlios.de/viewcvs/oolite-li ... iew=markup- (void) resizeGuis:(NSDictionary*) info
{
// check for entries in hud plist for comm_log_gui and message_gui
// resize and reposition them accordingly
if (!player)
return;
Universe* universe = [player universe];
if (!universe)
return;
GuiDisplayGen* message_gui = [universe message_gui];
if ((message_gui)&&([info objectForKey:@"message_gui"]))
{
NSDictionary* gui_info = (NSDictionary*)[info objectForKey:@"message_gui"];
Vector pos = [message_gui drawPosition];
if ([gui_info objectForKey:X_KEY])
pos.x = [[gui_info objectForKey:X_KEY] floatValue];
if ([gui_info objectForKey:Y_KEY])
pos.y = [[gui_info objectForKey:Y_KEY] floatValue];
[message_gui setDrawPosition:pos];
NSSize siz = [message_gui size];
int rht = [message_gui rowHeight];
NSString* title = [message_gui title];
if ([gui_info objectForKey:WIDTH_KEY])
siz.width = [[gui_info objectForKey:WIDTH_KEY] floatValue];
if ([gui_info objectForKey:HEIGHT_KEY])
siz.height = [[gui_info objectForKey:HEIGHT_KEY] floatValue];
if ([gui_info objectForKey:ROW_HEIGHT_KEY])
rht = [[gui_info objectForKey:ROW_HEIGHT_KEY] intValue];
if ([gui_info objectForKey:TITLE_KEY])
title = [NSString stringWithFormat:@"%@", [gui_info objectForKey:TITLE_KEY]];
[message_gui resizeTo: siz characterHeight: rht Title: title];
if ([gui_info objectForKey:ALPHA_KEY])
[message_gui setAlpha: [[gui_info objectForKey:ALPHA_KEY] floatValue]];
else
[message_gui setAlpha: 1.0];
if ([gui_info objectForKey:BACKGROUND_RGBA_KEY])
[message_gui setBackgroundColor:[OOColor colorFromString:(NSString *)[gui_info objectForKey:BACKGROUND_RGBA_KEY]]];
}