mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Add stop demo button
This commit is contained in:
@@ -201,6 +201,7 @@ short RandomInt (short);
|
||||
long RandomLong (long);
|
||||
void RedAlert (short);
|
||||
void LoadGraphic (DrawSurface *surface, short resID); // Only loads from app resources
|
||||
void LoadGraphicNoDither (DrawSurface *surface, short resID);
|
||||
void LoadGraphicCustom (DrawSurface *surface, short resID); // Supports custom graphics
|
||||
void LoadScaledGraphic (DrawSurface *, short, Rect *); // Only loads from app resources
|
||||
void LoadScaledGraphicCustom (DrawSurface *, short, Rect *); // Supports custom graphics
|
||||
|
@@ -439,8 +439,8 @@ namespace touchScreenControlGraphics
|
||||
BandsDisabled,
|
||||
BandsActive,
|
||||
BandsIdle,
|
||||
FlipActive,
|
||||
FlipIdle,
|
||||
StopActive,
|
||||
StopIdle,
|
||||
MoveRightActive,
|
||||
MoveRightIdle,
|
||||
MoveLeftActive,
|
||||
|
@@ -494,6 +494,12 @@ void DoHeliumEngaged (gliderPtr thisGlider)
|
||||
if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl)))
|
||||
DoCommandKey();
|
||||
|
||||
// Cheesy - Use touchscreen menu as quit
|
||||
if (pendingTouchScreenMenu)
|
||||
{
|
||||
playing = false;
|
||||
paused = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -581,7 +581,11 @@ void ResetTouchScreenControlBounds (void)
|
||||
points[TouchScreenCtrlIDs::Movement] = Point::Create(mainWindowRect.left, mainWindowRect.top);
|
||||
points[TouchScreenCtrlIDs::BatteryHelium] = Point::Create(mainWindowRect.left + touchScreenControlEdgeSpacing, mainWindowRect.top + touchScreenControlEdgeSpacing);
|
||||
points[TouchScreenCtrlIDs::Bands] = Point::Create(mainWindowRect.right - touchScreenControlEdgeSpacing - touchScreenControlSize, mainWindowRect.top + touchScreenControlEdgeSpacing);
|
||||
points[TouchScreenCtrlIDs::Menu] = Point::Create(points[TouchScreenCtrlIDs::Bands].h - touchScreenControlInterSpacing - touchScreenControlSize, points[TouchScreenCtrlIDs::BatteryHelium].v);
|
||||
|
||||
if (demoGoing)
|
||||
points[TouchScreenCtrlIDs::Menu] = Point::Create(mainWindowRect.right - touchScreenControlEdgeSpacing - touchScreenControlSize, mainWindowRect.top + touchScreenControlEdgeSpacing);
|
||||
else
|
||||
points[TouchScreenCtrlIDs::Menu] = Point::Create(points[TouchScreenCtrlIDs::Bands].h - touchScreenControlInterSpacing - touchScreenControlSize, points[TouchScreenCtrlIDs::BatteryHelium].v);
|
||||
|
||||
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
|
||||
sizes[i] = Point::Create(touchScreenControlSize, touchScreenControlSize);
|
||||
@@ -622,7 +626,7 @@ void InitTouchScreenControlState(void)
|
||||
|
||||
Rect resRect = Rect::Create(0, 0, touchScreenControlSize, touchScreenControlSize);
|
||||
(void)CreateOffScreenGWorld(&touchScreen.graphics[i], &resRect);
|
||||
LoadGraphic(touchScreen.graphics[i], resID);
|
||||
LoadGraphicNoDither(touchScreen.graphics[i], resID);
|
||||
}
|
||||
|
||||
pendingTouchScreenMenu = false;
|
||||
|
@@ -611,43 +611,62 @@ void RenderShreds (void)
|
||||
|
||||
void RenderTouchScreenControls (void)
|
||||
{
|
||||
if (demoGoing)
|
||||
return;
|
||||
|
||||
DrawSurface *ctrlGraphics[TouchScreenCtrlIDs::Count];
|
||||
|
||||
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
|
||||
ctrlGraphics[i] = nullptr;
|
||||
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Movement] = nullptr;
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuIdle];
|
||||
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumIdle];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryIdle];
|
||||
if (demoGoing)
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = nullptr;
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = nullptr;
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::StopIdle];
|
||||
}
|
||||
else
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuIdle];
|
||||
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsIdle];
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumIdle];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryIdle];
|
||||
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsIdle];
|
||||
}
|
||||
|
||||
for (int i = 0; i < touchScreenControlState::kMaxFingers; i++)
|
||||
{
|
||||
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::BatteryHelium)
|
||||
if (demoGoing)
|
||||
{
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumActive];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryActive];
|
||||
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::StopActive];
|
||||
}
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Bands)
|
||||
else
|
||||
{
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsActive];
|
||||
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::BatteryHelium)
|
||||
{
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumActive];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryActive];
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Bands)
|
||||
{
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsActive];
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuActive];
|
||||
}
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuActive];
|
||||
}
|
||||
|
||||
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
|
||||
|
@@ -277,6 +277,22 @@ void LoadGraphic (DrawSurface *surface, short resID)
|
||||
thePicture.Dispose();
|
||||
}
|
||||
|
||||
void LoadGraphicNoDither(DrawSurface *surface, short resID)
|
||||
{
|
||||
Rect bounds;
|
||||
THandle<BitmapImage> thePicture;
|
||||
|
||||
thePicture = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', resID).StaticCast<BitmapImage>();
|
||||
if (thePicture == nil)
|
||||
RedAlert(kErrFailedGraphicLoad);
|
||||
|
||||
bounds = (*thePicture)->GetRect();
|
||||
OffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
surface->DrawPicture(thePicture, bounds, false);
|
||||
|
||||
thePicture.Dispose();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- LoadGraphicCustom
|
||||
// Same as LoadGraphic but supports custom graphics
|
||||
void LoadGraphicCustom(DrawSurface *surface, short resID)
|
||||
|
Reference in New Issue
Block a user