Added arrows to indicate when there are multiple pages to look through.

This commit is contained in:
Robbie Antenesse 2016-04-13 17:32:56 -06:00
parent e8a43df0bc
commit 3d90f9639d
4 changed files with 15 additions and 0 deletions

View File

@ -147,6 +147,11 @@ function drawTradeGUI() {
guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5)); guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5));
guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6); guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6);
if (items.length > 1) {
guiControl.drawPageArrow("left", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5));
guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5));
}
// Amounts // Amounts
guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, "black", 4); guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, "black", 4);
guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] < G.stats.hold) ? "black" : "yellow", 4); guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] < G.stats.hold) ? "black" : "yellow", 4);
@ -241,6 +246,11 @@ function drawTradeGUI() {
guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5)); guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5));
guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6); guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6);
if (items.length > 1) {
guiControl.drawPageArrow("left", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5));
guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5));
}
// Amounts // Amounts
guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, "black", 4); guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, "black", 4);
guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] > 0) ? "black" : "yellow", 4); guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] > 0) ? "black" : "yellow", 4);

BIN
images/arrows.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

BIN
images/sources/arrows.pyxel Normal file

Binary file not shown.

View File

@ -29,12 +29,17 @@ var guiControl = {
}, },
drawCursor: function (xPosition, yPosition) { drawCursor: function (xPosition, yPosition) {
OS.context.drawImage(guiControl.cursor, xPosition, yPosition); OS.context.drawImage(guiControl.cursor, xPosition, yPosition);
},
drawPageArrow: function (direction, xPosition, yPosition) {
OS.context.drawImage(guiControl.arrows, (direction == "left") ? 0 : pixel(4), 0, pixel(4), pixel(7), xPosition, yPosition, pixel(4), pixel(7));
} }
} }
guiControl.background = new Image(); guiControl.background = new Image();
guiControl.background.src = "images/guiBackground.png"; guiControl.background.src = "images/guiBackground.png";
guiControl.cursor = new Image(); guiControl.cursor = new Image();
guiControl.cursor.src = "images/guiCursor.png"; guiControl.cursor.src = "images/guiCursor.png";
guiControl.arrows = new Image();
guiControl.arrows.src = "images/arrows.png";
guiControl.itemSheet = new Image(); guiControl.itemSheet = new Image();
guiControl.itemSheet.src = "images/items_sheet.png"; guiControl.itemSheet.src = "images/items_sheet.png";