static void DrawDevices (DEVICES_STATE *devState, COUNT OldDevice, COUNT NewDevice) { LockMutex (GraphicsLock); BatchGraphics (); SetContext (StatusContext); if (OldDevice > NUM_DEVICES) { // Asked for the initial display or refresh DrawDevicesDisplay (devState); // do not draw unselected again this time OldDevice = NewDevice; } if (OldDevice != NewDevice) { // unselect the previous element DrawDevice (devState->list[OldDevice], OldDevice - devState->topIndex, false); } if (NewDevice < NUM_DEVICES) { // select the new element DrawDevice (devState->list[NewDevice], NewDevice - devState->topIndex, true); } UnbatchGraphics (); UnlockMutex (GraphicsLock); }
static void DrawDevicesDisplay (DEVICES_STATE *devState) { TEXT t; RECT r; STAMP s; COORD cy; COUNT i; r.corner.x = 2; r.corner.y = 20; r.extent.width = FIELD_WIDTH + 1; // XXX: Shouldn't the height be 1 less? This draws the bottom border // 1 pixel too low. Or if not, why do we need another box anyway? r.extent.height = 129 - r.corner.y; DrawStarConBox (&r, 1, SHADOWBOX_MEDIUM_COLOR, SHADOWBOX_DARK_COLOR, TRUE, DEVICES_BACK_COLOR); // print the "DEVICES" title SetContextFont (StarConFont); t.baseline.x = (STATUS_WIDTH >> 1) - 1; t.baseline.y = r.corner.y + 7; t.align = ALIGN_CENTER; t.pStr = GAME_STRING (DEVICE_STRING_BASE); t.CharCount = (COUNT)~0; SetContextForeGroundColor (DEVICES_SELECTED_NAME_COLOR); font_DrawText (&t); s.origin.x = DEVICE_COL_0; cy = DEVICE_ORG_Y; // draw device icons and print names for (i = 0; i < MAX_VIS_DEVICES; ++i, cy += DEVICE_SPACING_Y) { COUNT devIndex = devState->topIndex + i; if (devIndex >= devState->count) break; // draw device icon s.origin.y = cy + ICON_OFS_Y; s.frame = SetAbsFrameIndex (MiscDataFrame, 77 + devState->list[devIndex]); DrawStamp (&s); DrawDevice (devState->list[devIndex], i, false); } }
static void DrawDevicesDisplay (DEVICES_STATE *devState) { TEXT t; RECT r; STAMP s; COORD cy; COUNT i; r.corner.x = RES_CASE(2,2,3); // JMS_GFX r.corner.y = RES_STAT_SCALE(20) - RES_CASE(0,1,0); // JMS_GFX r.extent.width = FIELD_WIDTH + 1; // JMS_GFX // XXX: Shouldn't the height be 1 less? This draws the bottom border // 1 pixel too low. Or if not, why do we need another box anyway? r.extent.height = RES_STAT_SCALE(129) - r.corner.y + RES_CASE(0,6,19); // JMS_GFX DrawStarConBox (&r, 1, SHADOWBOX_MEDIUM_COLOR, SHADOWBOX_DARK_COLOR, TRUE, DEVICES_BACK_COLOR); DrawBorder(12); // print the "DEVICES" title SetContextFont (StarConFont); t.baseline.x = (STATUS_WIDTH >> 1) - RES_STAT_SCALE(1); // JMS_GFX t.baseline.y = r.corner.y + RES_STAT_SCALE(7); // JMS_GFX t.align = ALIGN_CENTER; t.pStr = GAME_STRING (DEVICE_STRING_BASE); t.CharCount = (COUNT)~0; SetContextForeGroundColor (DEVICES_SELECTED_NAME_COLOR); font_DrawText (&t); s.origin.x = DEVICE_COL_0; cy = DEVICE_ORG_Y; // draw device icons and print names for (i = 0; i < MAX_VIS_DEVICES; ++i, cy += DEVICE_SPACING_Y) { COUNT devIndex = devState->topIndex + i; if (devIndex >= devState->count) break; // draw device icon s.origin.y = cy + ICON_OFS_Y; s.frame = SetAbsFrameIndex (MiscDataFrame, 77 + devState->list[devIndex]); if (RESOLUTION_FACTOR < 2) { DrawStamp (&s); } else { int oldMode, oldScale; oldMode = SetGraphicScaleMode (TFB_SCALE_BILINEAR); oldScale = SetGraphicScale ((int)(GSCALE_IDENTITY / 2)); DrawStamp (&s); SetGraphicScale (oldScale); SetGraphicScaleMode (oldMode); } DrawDevice (devState->list[devIndex], i, false); } }