Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlightData HUD Update: Positioning HUD Buttons #3212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions ExtLibs/Controls/HUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@ internal void doPaint()
if (displayicons)
{
var bottomsize = ((fontsize + 2) * 3) + fontoffset - 2;
DrawImage(icon, 3, this.Height - bottomsize, bottomsize / 2, bottomsize);
DrawImage(icon, 2, this.Height - bottomsize, bottomsize / 2, bottomsize);

text = _batterylevel.ToString("0.00v") + " " + _current.ToString("0.0 A") + " " + (_batteryremaining) + "%";
drawstring(text, font, fontsize + 1, textcolor, bottomsize / 2 + 6, yPos[1]);
Expand Down Expand Up @@ -3108,8 +3108,16 @@ internal void doPaint()
if (displayicons)
{
var width = (fontsize + 8) * 3;
vibehitzone = new Rectangle(this.Width - (width * 4) + width / 2 - 5, this.Height - (fontsize + 13), (fontsize + 8) * 3, fontsize + 8);

//When the width is greater or equal to 325, the vibe button must be placed at half of the HUD's width
if (this.Width >= 325)
{
vibehitzone = new Rectangle((int)(this.Width * 0.5), this.Height - (fontsize + 13), width, fontsize + 8);
}
//When the width is less than 325, the vibe button must be placed just passed half of the HUD's width
else if (this.Width < 325)
{
vibehitzone = new Rectangle((int)(this.Width * 0.535), this.Height - (fontsize + 13), width, fontsize + 8);
}
}
else
{
Expand Down Expand Up @@ -3161,10 +3169,15 @@ internal void doPaint()

if (displayekf)
{
//Set the starting Position for the EKF button based off of the VIBE Button
//Variable for the Vibe width
var vibeWidth = vibehitzone.Width;
//Variable for the start position of EKF
var eKFLocationX = vibehitzone.X - vibeWidth - 2;
if (displayicons)
{
var width = (fontsize + 8) * 3;
ekfhitzone = new Rectangle(this.Width - width * 5 + width / 2 - 10 , this.Height - (fontsize + 13), (fontsize + 8) * 3, fontsize + 8);
ekfhitzone = new Rectangle((int)(eKFLocationX), this.Height - (fontsize + 13), width, fontsize + 8);
}
else
{
Expand Down Expand Up @@ -3211,10 +3224,12 @@ internal void doPaint()

if (displayprearm && status == false) // not armed
{
//Set the starting Position for the PreArm button - Variable for the start position of PreArm button
var readyToArmLocationX = ekfhitzone.X;
if (displayicons)
{
var width = (fontsize + 8) * 3;
prearmhitzone = new Rectangle(this.Width - width * 5 + width / 2 - 7, this.Height - (fontsize*2 + 25), width * 2, fontsize + 8);
prearmhitzone = new Rectangle(readyToArmLocationX, this.Height - (fontsize*2 + 25), width * 2, fontsize + 8);
}
else
{
Expand Down
Loading