Sidebar for previous bits now uses correct math.

This commit is contained in:
Justin Marshall
2020-06-03 19:56:42 -07:00
parent be480a28a9
commit 2a5867f872
2 changed files with 36 additions and 34 deletions
+26 -24
View File
@@ -146,28 +146,7 @@ SidebarClass::SidebarClass(void) :
IsUpgradeActive(false),
IsDemolishActive(false)
{
/*
** This sets up the clipping window. This window is used by the shape drawing
** code so that as the sidebar buildable buttons scroll, they get properly
** clipped at the top and bottom edges.
*/
WindowList[WINDOW_SIDEBAR][WINDOWX] = (SIDE_X+8);
WindowList[WINDOW_SIDEBAR][WINDOWY] = SIDE_Y + 1 + TOP_HEIGHT;
WindowList[WINDOW_SIDEBAR][WINDOWWIDTH] = SIDE_WIDTH;
WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = StripClass::MAX_VISIBLE * StripClass::OBJECT_HEIGHT;
// WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = StripClass::MAX_VISIBLE * StripClass::OBJECT_HEIGHT-1;
/*
** Set up the coordinates for the sidebar strips. These coordinates are for
** the upper left corner.
*/
new (&Column[0]) StripClass(InitClass());
new (&Column[1]) StripClass(InitClass());
Column[0].X = COLUMN_ONE_X * RESFACTOR;
Column[0].Y = COLUMN_ONE_Y * RESFACTOR;
Column[1].X = COLUMN_TWO_X * RESFACTOR;
Column[1].Y = COLUMN_TWO_Y * RESFACTOR;
}
@@ -220,6 +199,29 @@ void SidebarClass::One_Time(void)
{
PowerClass::One_Time();
/*
** This sets up the clipping window. This window is used by the shape drawing
** code so that as the sidebar buildable buttons scroll, they get properly
** clipped at the top and bottom edges.
*/
WindowList[WINDOW_SIDEBAR][WINDOWX] = ScreenWidth - (SIDE_X + 8);
WindowList[WINDOW_SIDEBAR][WINDOWY] = SIDE_Y + 1 + TOP_HEIGHT;
WindowList[WINDOW_SIDEBAR][WINDOWWIDTH] = SIDE_WIDTH;
WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = StripClass::MAX_VISIBLE * StripClass::OBJECT_HEIGHT;
// WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = StripClass::MAX_VISIBLE * StripClass::OBJECT_HEIGHT-1;
/*
** Set up the coordinates for the sidebar strips. These coordinates are for
** the upper left corner.
*/
new (&Column[0]) StripClass(InitClass());
new (&Column[1]) StripClass(InitClass());
Column[0].X = ScreenWidth - (640 - (COLUMN_ONE_X * RESFACTOR));
Column[0].Y = (COLUMN_ONE_Y * RESFACTOR);
Column[1].X = ScreenWidth - (640 - (COLUMN_TWO_X * RESFACTOR));
Column[1].Y = (COLUMN_TWO_Y * RESFACTOR);
/*
** This sets up the clipping window. This window is used by the shape drawing
** code so that as the sidebar buildable buttons scroll, they get properly
@@ -308,7 +310,7 @@ void SidebarClass::Init_IO(void)
Repair.IsSticky = true;
Repair.ID = BUTTON_REPAIR;
Repair.X = (0x1f2/2)*RESFACTOR;
Repair.X = ScreenWidth - (640 - (0x1f2/2)*RESFACTOR);
Repair.Y = (0x96/2)*RESFACTOR;
Repair.IsPressed = false;
Repair.IsToggleType = true;
@@ -318,7 +320,7 @@ void SidebarClass::Init_IO(void)
Upgrade.IsSticky = true;
Upgrade.ID = BUTTON_UPGRADE;
#ifdef WIN32
Upgrade.X = 0x21f;
Upgrade.X = ScreenWidth - (640 - 0x21f);
#else
Upgrade.X = ((0x21f/2)+1)*RESFACTOR;
#endif
@@ -330,7 +332,7 @@ void SidebarClass::Init_IO(void)
Zoom.IsSticky = true;
Zoom.ID = BUTTON_ZOOM;
Zoom.X = (0x24c/2)*RESFACTOR;
Zoom.X = 1024 - (640 - ((0x24c/2)*RESFACTOR));
Zoom.Y = (0x96/2)*RESFACTOR;
Zoom.IsPressed = false;
Zoom.Set_Shape(MFCD::Retrieve("MAP.SHP"));
+10 -10
View File
@@ -49,16 +49,16 @@ class SidebarClass: public PowerClass
** as enumerations since C++ cannot use "const" in this context.
*/
enum SideBarClassEnums {
BUTTON_ACTIVATOR=100, // Button ID for the activator.
SIDE_X=640-80, // The X position of sidebar upper left corner.
SIDE_Y=7+70, // The Y position of sidebar upper left corner.
SIDE_WIDTH=SIDEBAR_WID, // Width of the entire sidebar (in pixels).
SIDE_HEIGHT=200-(7+70), // Height of the entire sidebar (in pixels).
TOP_HEIGHT=13, // Height of top section (with repair/sell buttons).
COLUMN_ONE_X=(510-80)+8, // Sidestrip upper left coordinates...
COLUMN_ONE_Y=int(SIDE_Y)+int(TOP_HEIGHT),
COLUMN_TWO_X=(510-80)+8+((80-16)/2)+3,
COLUMN_TWO_Y=7+70+13,
BUTTON_ACTIVATOR = 100, // Button ID for the activator.
SIDE_X = 320 - 80, // The X position of sidebar upper left corner.
SIDE_Y = 7 + 70, // The Y position of sidebar upper left corner.
SIDE_WIDTH = SIDEBAR_WID, // Width of the entire sidebar (in pixels).
SIDE_HEIGHT = 200 - (7 + 70), // Height of the entire sidebar (in pixels).
TOP_HEIGHT = 13, // Height of top section (with repair/sell buttons).
COLUMN_ONE_X = (320 - 80) + 8, // Sidestrip upper left coordinates...
COLUMN_ONE_Y = int(SIDE_Y) + int(TOP_HEIGHT),
COLUMN_TWO_X = (320 - 80) + 8 + ((80 - 16) / 2) + 3,
COLUMN_TWO_Y = 7 + 70 + 13,
//BGA: changes to all buttons
#ifdef GERMAN