Attempt to fix issue #80 (incorrect position of ship model on status screen in non-4/3 aspect ratio resolutions). This fixes SDL builds only. For Mac, it should be sufficient to add a call to [PLAYER doGuiScreenResizeUpdates] after a window resize event, but I cannot test this here.
This commit is contained in:
parent
2be5513f1d
commit
f553455a98
@ -999,6 +999,8 @@ typedef enum
|
||||
|
||||
- (void) showShipModelWithKey:(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context;
|
||||
|
||||
- (void) doGuiScreenResizeUpdates;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -3019,6 +3019,11 @@ static GLfloat sBaseMass = 0.0;
|
||||
if (shipData == nil) shipData = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
|
||||
if (shipData == nil) return;
|
||||
|
||||
// Correct the position of the displayed model in the status screen when viewed in non-4/3 resolutions. Other screens displaying
|
||||
// demoship models remain unaltered - Nikos 20140129
|
||||
NSSize screenSize = [[UNIVERSE gameView] viewSize];
|
||||
GLfloat screenSizeCorrectionFactor = [context isEqualToString:@"GUI_SCREEN_STATUS"] ? screenSize.height / screenSize.width * (4.0f/3.0f) : 1.0f;
|
||||
|
||||
Quaternion q2 = { (GLfloat)M_SQRT1_2, (GLfloat)M_SQRT1_2, (GLfloat)0.0f, (GLfloat)0.0f };
|
||||
// MKW - retrieve last demo ships' orientation and release it
|
||||
if( demoShip != nil )
|
||||
@ -3036,7 +3041,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
|
||||
GLfloat cr = [ship collisionRadius];
|
||||
[ship setOrientation: q2];
|
||||
[ship setPositionX:factorX * cr y:factorY * cr z:factorZ * cr];
|
||||
[ship setPositionX:factorX * cr * screenSizeCorrectionFactor y:factorY * cr * screenSizeCorrectionFactor z:factorZ * cr];
|
||||
[ship setScanClass: CLASS_NO_DRAW];
|
||||
[ship setRoll: M_PI/10.0];
|
||||
[ship setPitch: M_PI/25.0];
|
||||
@ -3055,6 +3060,28 @@ static GLfloat sBaseMass = 0.0;
|
||||
}
|
||||
|
||||
|
||||
// Game options and status screens (for now) may require an immediate window redraw after
|
||||
// said window has been resized. This method must be called after such resize events, including
|
||||
// toggle to/from full screen - Nikos 20140129
|
||||
- (void) doGuiScreenResizeUpdates
|
||||
{
|
||||
switch ([self guiScreen])
|
||||
{
|
||||
case GUI_SCREEN_GAMEOPTIONS:
|
||||
//refresh play windowed / full screen
|
||||
[[PlayerEntity sharedPlayer] setGuiToGameOptionsScreen];
|
||||
break;
|
||||
case GUI_SCREEN_STATUS:
|
||||
// status screen must be redone in order to possibly
|
||||
// refresh displayed model's draw position
|
||||
[[PlayerEntity sharedPlayer] setGuiToStatusScreen];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for lost targeting - both on the ships' main target as well as each
|
||||
// missile.
|
||||
// If we're actively scanning and we don't have a current target, then check
|
||||
@ -6640,7 +6667,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
{
|
||||
[UNIVERSE removeDemoShips];
|
||||
[self showShipModelWithKey:[self shipDataKey] shipData:nil personality:[self entityPersonalityInt]
|
||||
factorX:2.5 factorY:1.7 factorZ:8.0 inContext:nil];
|
||||
factorX:2.5 factorY:1.7 factorZ:8.0 inContext:@"GUI_SCREEN_STATUS"];
|
||||
[self setShowDemoShips:YES];
|
||||
}
|
||||
else
|
||||
|
@ -1561,11 +1561,9 @@ if (shift) { keys[a] = YES; keys[b] = NO; } else { keys[a] = NO; keys[b] = YES;
|
||||
|
||||
case SDLK_F12:
|
||||
[self toggleScreenMode];
|
||||
if([[PlayerEntity sharedPlayer] guiScreen]==GUI_SCREEN_GAMEOPTIONS)
|
||||
{
|
||||
//refresh play windowed / full screen
|
||||
[[PlayerEntity sharedPlayer] setGuiToGameOptionsScreen];
|
||||
}
|
||||
// normally we would want to do a gui screen resize update here, but
|
||||
// toggling full screen mode executes an SDL_VIDEORESIZE event, which
|
||||
// takes care of this for us - Nikos 20140129
|
||||
break;
|
||||
|
||||
case SDLK_ESCAPE:
|
||||
@ -1782,6 +1780,12 @@ keys[a] = NO; keys[b] = NO; \
|
||||
#else
|
||||
[self saveWindowSize: newSize];
|
||||
#endif
|
||||
// certain gui screens will require an immediate redraw after
|
||||
// a resize event - Nikos 20140129
|
||||
if ([PlayerEntity sharedPlayer])
|
||||
{
|
||||
[[PlayerEntity sharedPlayer] doGuiScreenResizeUpdates];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user