Sidebar now renders

This commit is contained in:
Justin Marshall
2020-06-03 21:19:01 -07:00
parent 2a5867f872
commit 36a8e28afe
2 changed files with 37 additions and 26 deletions
+14 -6
View File
@@ -76,6 +76,8 @@
#include "function.h" #include "function.h"
//#undef RESFACTOR
//#define RESFACTOR 1
void * SidebarClass::SidebarShape = NULL; void * SidebarClass::SidebarShape = NULL;
void * SidebarClass::SidebarMiddleShape = NULL; void * SidebarClass::SidebarMiddleShape = NULL;
@@ -204,7 +206,7 @@ void SidebarClass::One_Time(void)
** code so that as the sidebar buildable buttons scroll, they get properly ** code so that as the sidebar buildable buttons scroll, they get properly
** clipped at the top and bottom edges. ** clipped at the top and bottom edges.
*/ */
WindowList[WINDOW_SIDEBAR][WINDOWX] = ScreenWidth - (SIDE_X + 8); WindowList[WINDOW_SIDEBAR][WINDOWX] = (SIDE_X + 8);
WindowList[WINDOW_SIDEBAR][WINDOWY] = SIDE_Y + 1 + TOP_HEIGHT; WindowList[WINDOW_SIDEBAR][WINDOWY] = SIDE_Y + 1 + TOP_HEIGHT;
WindowList[WINDOW_SIDEBAR][WINDOWWIDTH] = SIDE_WIDTH; 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;
@@ -217,10 +219,16 @@ void SidebarClass::One_Time(void)
new (&Column[0]) StripClass(InitClass()); new (&Column[0]) StripClass(InitClass());
new (&Column[1]) StripClass(InitClass()); new (&Column[1]) StripClass(InitClass());
Column[0].X = ScreenWidth - (640 - (COLUMN_ONE_X * RESFACTOR)); int column_one_x = (COLUMN_ONE_X * RESFACTOR);
Column[0].Y = (COLUMN_ONE_Y * RESFACTOR); int column_one_y = (COLUMN_ONE_Y * RESFACTOR);
Column[1].X = ScreenWidth - (640 - (COLUMN_TWO_X * RESFACTOR));
Column[1].Y = (COLUMN_TWO_Y * RESFACTOR); int column_two_x = (COLUMN_TWO_X * RESFACTOR);
int column_two_y = (COLUMN_TWO_Y * RESFACTOR);
Column[0].X = column_one_x;
Column[0].Y = column_one_y;
Column[1].X = column_two_x;
Column[1].Y = column_two_y;
/* /*
** This sets up the clipping window. This window is used by the shape drawing ** This sets up the clipping window. This window is used by the shape drawing
@@ -1845,7 +1853,7 @@ void SidebarClass::StripClass::Draw_It(bool complete)
CC_Draw_Shape(ClockShapes, 0, CC_Draw_Shape(ClockShapes, 0,
x-(WindowList[WINDOW_SIDEBAR][WINDOWX])+(LEFT_EDGE_OFFSET * RESFACTOR), x-(WindowList[WINDOW_SIDEBAR][WINDOWX])+(LEFT_EDGE_OFFSET * RESFACTOR),
y-WindowList[WINDOW_SIDEBAR][WINDOWY], y-WindowList[WINDOW_SIDEBAR][WINDOWY],
WINDOW_SIDEBAR, WINDOW_SIDEBAR,
SHAPE_NORMAL|SHAPE_WIN_REL|SHAPE_GHOST, SHAPE_NORMAL|SHAPE_WIN_REL|SHAPE_GHOST,
NULL, ClockTranslucentTable); NULL, ClockTranslucentTable);
} }
+23 -20
View File
@@ -41,6 +41,27 @@
class InitClass {}; class InitClass {};
extern int ScreenWidth;
#define BUTTON_ACTIVATOR 100 // Button ID for the activator.
#define SIDE_X ((ScreenWidth / 2) - 80) // The X position of sidebar upper left corner.
#define SIDE_Y (7 + 70) // The Y position of sidebar upper left corner.
#define SIDE_WIDTH SIDEBAR_WID // Width of the entire sidebar (in pixels).
#define SIDE_HEIGHT (200 - (7 + 70) ) // Height of the entire sidebar (in pixels).
#define TOP_HEIGHT 13 // Height of top section (with repair/sell buttons).
#define COLUMN_ONE_X (int)((SIDE_X) + 8) // Sidestrip upper left coordinates...
#define COLUMN_ONE_Y (int)(SIDE_Y + (TOP_HEIGHT))
#define COLUMN_TWO_X (int)((SIDE_X) + 8 + ((80 - 16) / 2) + 3)
#define COLUMN_TWO_Y (int)(7 + 70 + 13)
#define BUTTON_ONE_WIDTH 32 // Button width.
#define BUTTON_TWO_WIDTH 20 // Button width.
#define BUTTON_THREE_WIDTH 20 // Button width.
#define BUTTON_HEIGHT 9 // Button height.
#define BUTTON_ONE_X (int)(SIDE_X + 2) // Left button X coordinate.
#define BUTTON_ONE_Y (int)(SIDE_Y + 2) // Left button Y coordinate.
#define BUTTON_TWO_X (int)(SIDE_X + 36) // Right button X coordinate.
#define BUTTON_TWO_Y (int)(SIDE_Y + 2) // Right button Y coordinate.
#define BUTTON_THREE_X (int)(SIDE_X + 58) // Right button X coordinate.
#define BUTTON_THREE_Y (int)(SIDE_Y + 2) // Right button Y coordinate.
class SidebarClass: public PowerClass class SidebarClass: public PowerClass
{ {
public: public:
@@ -49,16 +70,7 @@ class SidebarClass: public PowerClass
** as enumerations since C++ cannot use "const" in this context. ** as enumerations since C++ cannot use "const" in this context.
*/ */
enum SideBarClassEnums { enum SideBarClassEnums {
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 //BGA: changes to all buttons
#ifdef GERMAN #ifdef GERMAN
@@ -88,16 +100,7 @@ class SidebarClass: public PowerClass
#endif #endif
#ifdef ENGLISH #ifdef ENGLISH
BUTTON_ONE_WIDTH=32, // Button width.
BUTTON_TWO_WIDTH=20, // Button width.
BUTTON_THREE_WIDTH=20, // Button width.
BUTTON_HEIGHT=9, // Button height.
BUTTON_ONE_X=(int)SIDE_X+2, // Left button X coordinate.
BUTTON_ONE_Y=(int)SIDE_Y+2, // Left button Y coordinate.
BUTTON_TWO_X=(int)SIDE_X+36, // Right button X coordinate.
BUTTON_TWO_Y=(int)SIDE_Y+2, // Right button Y coordinate.
BUTTON_THREE_X=(int)SIDE_X+58, // Right button X coordinate.
BUTTON_THREE_Y=(int)SIDE_Y+2, // Right button Y coordinate.
#endif #endif
COLUMNS=2 // Number of side strips on sidebar. COLUMNS=2 // Number of side strips on sidebar.