-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulator.lua
More file actions
100 lines (73 loc) · 3.65 KB
/
Copy pathsimulator.lua
File metadata and controls
100 lines (73 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--[[
PlayDate SDK Types Meta-File
A collection of type annotations for the PlayDate SDK
Compatible with SDK 1.12.3
This file should NOT actually be imported; VSCode should automatically reference it for type completion.
Importing this file will likely break things, as some functions are redefined for the sake of providing type definition.
Originally written by Minalien (https://cohost.org/Minalien).
Consider this file public domain.
https://sdk.play.date/1.12.3/Inside%20Playdate.html#api-reference
]]
---@meta
--[[
This variable—not a function, so don’t invoke with ()—it is set to 1 when running inside of the simulator and is nil otherwise.
https://sdk.play.date/inside-playdate/#v-isSimulator
]]
---@type 1|nil
playdate.isSimulator = nil
--[[
Writes an image to a PNG file at the path specified. Only available on the simulator.
path represents a path on your development computer, not the Playdate filesystem. It’s recommended you prefix your path with ~/ to ensure you are writing to a writeable directory, for example, ~/myImageFile.png. Please include the .png file extension in your path name. Any directories in your path must already exist on your development computer in order for the file to be written.
https://sdk.play.date/inside-playdate/#f-simulator.writeToFile
]]
---@param image playdate.graphics.image
---@param path string
function playdate.simulator.writeToFile(image, path) end
--[[
Quits the Playdate Simulator app.
https://sdk.play.date/inside-playdate/#f-simulator.exit
]]
function playdate.simulator.exit() end
--[[
Returns the contents of the URL url as a string.
https://sdk.play.date/inside-playdate/#f-simulator.getURL
]]
---@param url string
---@return string
function playdate.simulator.getURL(url) end
--[[
Clears the simulator console.
https://sdk.play.date/inside-playdate/#f-clearConsole
]]
function playdate.clearConsole() end
--[[
Sets the color of the playdate.debugDraw() overlay image.
https://sdk.play.date/inside-playdate/#f-setDebugDrawColor
]]
---@param r number
---@param g number
---@param b number
---@param a number
function playdate.setDebugDrawColor(r, g, b, a) end
--[[
Lets you act on keyboard keypresses when running in the Simulator ONLY. These can be useful for adding debugging functions that can be enabled via your keyboard.
It is possible test a game on Playdate hardware and trap computer keyboard keypresses if you are using the Simulator’s Control Device with Simulator option.
key is a string containing the character pressed or released on the keyboard. Note that:
The key in question needs to have a textual representation or these functions will not be called. For instance, alphanumeric keys will call these functions; keyboard directional arrows will not.
If the keypress in question is already in use by the Simulator for another purpose (say, to control the d-pad or A/B buttons), these functions will not be called.
https://sdk.play.date/inside-playdate/#c-keyPressed
]]
---@param key string
function playdate.keyPressed(key) end
--[[
Lets you act on keyboard key releases when running in the Simulator ONLY. These can be useful for adding debugging functions that can be enabled via your keyboard.
https://sdk.play.date/inside-playdate/#c-keyReleased
]]
---@param key string
function playdate.keyReleased(key) end
--[[
Called immediately after playdate.update(), any drawing performed during this callback is overlaid on the display in 50% transparent red (or another color selected with playdate.setDebugDrawColor()).
White pixels are drawn in the debugDrawColor. Black pixels are transparent.
https://sdk.play.date/inside-playdate/#c-debugDraw
]]
function playdate.debugDraw() end