Skip to content

Commit 6aa7c1f

Browse files
committed
Add missing SimpleGraphic definitions and recommend including them as a library
1 parent 7ae2e27 commit 6aa7c1f

2 files changed

Lines changed: 63 additions & 8 deletions

File tree

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ If you prefer to not use EmmyLua, the following configuration works well for Sum
255255
"Lua.runtime.special": {
256256
"LoadModule": "require"
257257
},
258+
"Lua.workspace.library": [
259+
"src/_SimpleGraphic.def.lua"
260+
],
258261
}
259262
```
260263

src/_SimpleGraphic.def.lua

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ function artHandleClass:Size() end
4949

5050
---@alias ArtFlag "CLAMP"|"MIPMAP"|"NEAREST"
5151

52-
---@param art userdata ArtHandle
52+
---@param art ArtHandle
5353
---@param x1 integer
5454
---@param y1 integer
5555
---@param x2 integer
5656
---@param y2 integer
5757
---@param ... ArtFlag
5858
function imageHandleClass:LoadArtRectangle(art, x1, y1, x2, y2, ...) end
5959

60-
---@param art userdata ArtHandle
60+
---@param art ArtHandle
6161
---@param xC integer
6262
---@param yC integer
6363
---@param rMin integer
@@ -74,6 +74,11 @@ function imageHandleClass:IsValid()
7474
return self.valid
7575
end
7676

77+
---@return boolean
78+
function imageHandleClass:IsLoading()
79+
return false
80+
end
81+
7782
---@param priority number
7883
function imageHandleClass:SetLoadingPriority(priority) end
7984

@@ -87,6 +92,52 @@ end
8792
---@return userdata
8893
function NewArtHandle(fileName) end
8994

95+
---@class TexHandle
96+
local texHandleClass = {}
97+
98+
---@class TextureInfo
99+
---@field formatStr "<unknown>"|"RGB"|"RGBA"|"BC1"|"BC7"
100+
---@field width integer
101+
---@field height integer
102+
---@field layerCount integer
103+
---@field mipCount integer
104+
local textureInfoClass = {}
105+
106+
---@class Texture
107+
local Texture = {}
108+
109+
---@return TexHandle
110+
function Texture.new() end
111+
112+
-- `gli::format` id, or a matching format string. see `core_tex_manipulation.cpp`
113+
---@alias TextureFormat integer|"RGB"|"RGBA"|"BC1"|"BC7"
114+
115+
---@param format TextureFormat
116+
---@param width integer
117+
---@param height integer
118+
---@param layerCount integer
119+
---@param mipCount integer
120+
---@return boolean success
121+
function texHandleClass:Allocate(format, width, height, layerCount, mipCount) end
122+
123+
---@param fileName string
124+
---@return boolean success
125+
function texHandleClass:Load(fileName) end
126+
127+
---@param fileName string
128+
---@return boolean success
129+
function texHandleClass:Save(fileName) end
130+
131+
---@return TextureInfo
132+
function texHandleClass:Info() end
133+
134+
---@return boolean
135+
function texHandleClass:IsValid() end
136+
137+
---@param textures TexHandle[]
138+
---@return boolean success
139+
function texHandleClass:StackTextures(textures) end
140+
90141
---@return integer width
91142
---@return integer height
92143
function GetScreenSize()
@@ -144,14 +195,14 @@ function GetDPIScaleOverridePercent()
144195
return 1
145196
end
146197

147-
---@param imgHandle? userdata
198+
---@param imgHandle? ImageHandle
148199
---@param left number
149200
---@param top number
150201
---@param width number
151202
---@param height number
152203
function DrawImage(imgHandle, left, top, width, height) end
153204

154-
---@param imgHandle? userdata
205+
---@param imgHandle? ImageHandle
155206
---@param left number
156207
---@param top number
157208
---@param width number
@@ -162,7 +213,7 @@ function DrawImage(imgHandle, left, top, width, height) end
162213
---@param tcBottom number
163214
function DrawImage(imgHandle, left, top, width, height, tcLeft, tcTop, tcRight, tcBottom) end
164215

165-
---@param imgHandle? userdata
216+
---@param imgHandle? ImageHandle
166217
---@param left number
167218
---@param top number
168219
---@param width number
@@ -171,7 +222,7 @@ function DrawImage(imgHandle, left, top, width, height, tcLeft, tcTop, tcRight,
171222
---@param mask? integer must be positive
172223
function DrawImage(imgHandle, left, top, width, height, tcLeft, tcTop, tcRight, tcBottom, stackIdx, mask) end
173224

174-
---@param imgHandle? userdata
225+
---@param imgHandle? ImageHandle
175226
---@param x1 number
176227
---@param y1 number
177228
---@param x2 number
@@ -182,7 +233,7 @@ function DrawImage(imgHandle, left, top, width, height, tcLeft, tcTop, tcRight,
182233
---@param y4 number
183234
function DrawImageQuad(imgHandle, x1, y1, x2, y2, x3, y3, x4, y4) end
184235

185-
---@param imgHandle? userdata
236+
---@param imgHandle? ImageHandle
186237
---@param x1 number
187238
---@param y1 number
188239
---@param x2 number
@@ -200,7 +251,7 @@ function DrawImageQuad(imgHandle, x1, y1, x2, y2, x3, y3, x4, y4) end
200251
---@param t4 number
201252
function DrawImageQuad(imgHandle, x1, y1, x2, y2, x3, y3, x4, y4, s1, t1, s2, t2, s3, t3, s4, t4) end
202253

203-
---@param imgHandle? userdata
254+
---@param imgHandle? ImageHandle
204255
---@param x1 number
205256
---@param y1 number
206257
---@param x2 number
@@ -427,6 +478,7 @@ function PCall(func, ...)
427478
end
428479
end
429480

481+
--- A function similar to C `printf` which prints to the console (`^~` on US layout) of the program.
430482
---@param fmt string
431483
---@param ... any
432484
function ConPrintf(fmt, ...)

0 commit comments

Comments
 (0)