forked from MCJack123/PrimeUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawNft.lua
More file actions
21 lines (20 loc) · 901 Bytes
/
Copy pathdrawNft.lua
File metadata and controls
21 lines (20 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
local PrimeUI = require "util" -- DO NOT COPY THIS LINE
local expect = require "cc.expect".expect -- DO NOT COPY THIS LINE
-- Start copying below this line. --
local nft = require "cc.image.nft"
--- Draws a NFT-formatted image to the screen.
---@param win window The window to draw on
---@param x number The X position of the top left corner of the image
---@param y number The Y position of the top left corner of the image
---@param data string|table The path to the image to load, or the image data itself
function PrimeUI.drawNFT(win, x, y, data)
expect(1, win, "table")
expect(2, x, "number")
expect(3, y, "number")
expect(4, data, "string", "table")
-- Load the image file if a string was passed using nft.load.
if type(data) == "string" then
data = assert(nft.load("data/example.nft"), "File is not a valid NFT file")
end
nft.draw(data, x, y , win)
end