mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Added easter egg (Click about window animation 10 times)
This commit is contained in:
parent
67969f098f
commit
a18f6909c3
3 changed files with 97 additions and 21 deletions
|
@ -37,6 +37,11 @@ public static Rectangle GetScreenBounds()
|
|||
return SystemInformation.VirtualScreen;
|
||||
}
|
||||
|
||||
public static Rectangle GetScreenWorkingArea()
|
||||
{
|
||||
return SystemInformation.WorkingArea;
|
||||
}
|
||||
|
||||
public static Rectangle GetScreenBounds2()
|
||||
{
|
||||
Point topLeft = Point.Empty;
|
||||
|
|
41
ShareX/Forms/AboutForm.Designer.cs
generated
41
ShareX/Forms/AboutForm.Designer.cs
generated
|
@ -17,6 +17,9 @@ protected override void Dispose(bool disposing)
|
|||
{
|
||||
components.Dispose();
|
||||
}
|
||||
|
||||
if (bounceTimer != null) bounceTimer.Dispose();
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
|
@ -35,14 +38,14 @@ private void InitializeComponent()
|
|||
this.rtbCredits = new System.Windows.Forms.RichTextBox();
|
||||
this.rtbShareXInfo = new System.Windows.Forms.RichTextBox();
|
||||
this.lblOwners = new System.Windows.Forms.Label();
|
||||
this.cLogo = new HelpersLib.Canvas();
|
||||
this.uclUpdate = new HelpersLib.UpdateCheckerLabel();
|
||||
this.pbMikeSteamURL = new System.Windows.Forms.PictureBox();
|
||||
this.pbBerkSteamURL = new System.Windows.Forms.PictureBox();
|
||||
this.pbMikeURL = new System.Windows.Forms.PictureBox();
|
||||
this.pbAU = new System.Windows.Forms.PictureBox();
|
||||
this.pbBerkURL = new System.Windows.Forms.PictureBox();
|
||||
this.pbTR = new System.Windows.Forms.PictureBox();
|
||||
this.cLogo = new HelpersLib.Canvas();
|
||||
this.uclUpdate = new HelpersLib.UpdateCheckerLabel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbMikeSteamURL)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbBerkSteamURL)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbMikeURL)).BeginInit();
|
||||
|
@ -126,23 +129,6 @@ private void InitializeComponent()
|
|||
this.lblOwners.TabIndex = 3;
|
||||
this.lblOwners.Text = "Owners:";
|
||||
//
|
||||
// cLogo
|
||||
//
|
||||
this.cLogo.Interval = 100;
|
||||
this.cLogo.Location = new System.Drawing.Point(224, -8);
|
||||
this.cLogo.Name = "cLogo";
|
||||
this.cLogo.Size = new System.Drawing.Size(208, 200);
|
||||
this.cLogo.TabIndex = 7;
|
||||
this.cLogo.Draw += new HelpersLib.Canvas.DrawEventHandler(this.cLogo_Draw);
|
||||
this.cLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.cLogo_MouseDown);
|
||||
//
|
||||
// uclUpdate
|
||||
//
|
||||
this.uclUpdate.Location = new System.Drawing.Point(13, 36);
|
||||
this.uclUpdate.Name = "uclUpdate";
|
||||
this.uclUpdate.Size = new System.Drawing.Size(224, 24);
|
||||
this.uclUpdate.TabIndex = 1;
|
||||
//
|
||||
// pbMikeSteamURL
|
||||
//
|
||||
this.pbMikeSteamURL.BackColor = System.Drawing.Color.Transparent;
|
||||
|
@ -217,6 +203,23 @@ private void InitializeComponent()
|
|||
this.pbTR.TabIndex = 8;
|
||||
this.pbTR.TabStop = false;
|
||||
//
|
||||
// cLogo
|
||||
//
|
||||
this.cLogo.Interval = 100;
|
||||
this.cLogo.Location = new System.Drawing.Point(240, -8);
|
||||
this.cLogo.Name = "cLogo";
|
||||
this.cLogo.Size = new System.Drawing.Size(200, 200);
|
||||
this.cLogo.TabIndex = 7;
|
||||
this.cLogo.Draw += new HelpersLib.Canvas.DrawEventHandler(this.cLogo_Draw);
|
||||
this.cLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.cLogo_MouseDown);
|
||||
//
|
||||
// uclUpdate
|
||||
//
|
||||
this.uclUpdate.Location = new System.Drawing.Point(13, 36);
|
||||
this.uclUpdate.Name = "uclUpdate";
|
||||
this.uclUpdate.Size = new System.Drawing.Size(224, 24);
|
||||
this.uclUpdate.TabIndex = 1;
|
||||
//
|
||||
// AboutForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
|
@ -49,7 +49,6 @@ public AboutForm()
|
|||
private void AboutForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
this.ShowActivate();
|
||||
|
||||
cLogo.Start(50);
|
||||
}
|
||||
|
||||
|
@ -96,6 +95,7 @@ private void rtb_LinkClicked(object sender, LinkClickedEventArgs e)
|
|||
private int direction = speed;
|
||||
private Color lineColor = new HSB(0d, 1d, 0.9d);
|
||||
private bool isPaused;
|
||||
private int clickCount = 0;
|
||||
|
||||
private void cLogo_Draw(Graphics g)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ private void cLogo_Draw(Graphics g)
|
|||
g.Transform = m;
|
||||
}
|
||||
|
||||
using (Pen pen = new Pen(lineColor))
|
||||
using (Pen pen = new Pen(lineColor, 2))
|
||||
{
|
||||
for (int i = 0; i <= mX; i += step)
|
||||
{
|
||||
|
@ -154,8 +154,76 @@ private void cLogo_Draw(Graphics g)
|
|||
private void cLogo_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
isPaused = !isPaused;
|
||||
clickCount++;
|
||||
if (clickCount >= 10)
|
||||
{
|
||||
cLogo.Stop();
|
||||
RunEasterEgg();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Animation
|
||||
|
||||
#region Easter egg
|
||||
|
||||
private bool easterEggIsStarted;
|
||||
private Rectangle screenRect;
|
||||
private Timer bounceTimer;
|
||||
private const int windowGravityPower = 3;
|
||||
private const int windowBouncePower = -50;
|
||||
private const int windowSpeed = 20;
|
||||
private Point windowVelocity = new Point(windowSpeed, windowGravityPower);
|
||||
|
||||
private void RunEasterEgg()
|
||||
{
|
||||
if (!easterEggIsStarted)
|
||||
{
|
||||
easterEggIsStarted = true;
|
||||
|
||||
screenRect = CaptureHelpers.GetScreenWorkingArea();
|
||||
|
||||
bounceTimer = new Timer();
|
||||
bounceTimer.Interval = 20;
|
||||
bounceTimer.Tick += bounceTimer_Tick;
|
||||
bounceTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void bounceTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsDisposed)
|
||||
{
|
||||
int x = Location.X + windowVelocity.X;
|
||||
int windowRight = screenRect.X + screenRect.Width - 1 - Width;
|
||||
|
||||
if (x <= screenRect.X)
|
||||
{
|
||||
x = screenRect.X;
|
||||
windowVelocity.X = windowSpeed;
|
||||
}
|
||||
else if (x >= windowRight)
|
||||
{
|
||||
x = windowRight;
|
||||
windowVelocity.X = -windowSpeed;
|
||||
}
|
||||
|
||||
int y = Location.Y + windowVelocity.Y;
|
||||
int windowBottom = screenRect.Y + screenRect.Height - 1 - Height;
|
||||
|
||||
if (y >= windowBottom)
|
||||
{
|
||||
y = windowBottom;
|
||||
windowVelocity.Y = windowBouncePower;
|
||||
}
|
||||
else
|
||||
{
|
||||
windowVelocity.Y += windowGravityPower;
|
||||
}
|
||||
|
||||
Location = new Point(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Easter egg
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue