comparison semiconginev2/resources.nim @ 1236:176383220123

add: first font-rendering test
author sam <sam@basx.dev>
date Sat, 20 Jul 2024 17:45:44 +0700
parents 5dcb503ef0c0
children e8b3dc80e48e
comparison
equal deleted inserted replaced
1235:c70fee6568f6 1236:176383220123
154 path.loadResource_intern(package = package).readAll().parseJson() 154 path.loadResource_intern(package = package).readAll().parseJson()
155 155
156 proc LoadConfig*(path: string, package = DEFAULT_PACKAGE): Config = 156 proc LoadConfig*(path: string, package = DEFAULT_PACKAGE): Config =
157 path.loadResource_intern(package = package).loadConfig(filename = path) 157 path.loadResource_intern(package = package).loadConfig(filename = path)
158 158
159 proc LoadFont*(
160 path: string,
161 name = "",
162 lineHeightPixels = 80'f32,
163 additional_codepoints: openArray[Rune] = [],
164 charset = ASCII_CHARSET,
165 package = DEFAULT_PACKAGE
166 ): Font =
167 var thename = name
168 if thename == "":
169 thename = path.splitFile().name
170 loadResource_intern(path, package = package).ReadTrueType(name, charset & additional_codepoints.toSeq, lineHeightPixels)
171
172 proc LoadMeshes*(path: string, defaultMaterial: MaterialType, package = DEFAULT_PACKAGE): seq[MeshTree] = 159 proc LoadMeshes*(path: string, defaultMaterial: MaterialType, package = DEFAULT_PACKAGE): seq[MeshTree] =
173 loadResource_intern(path, package = package).ReadglTF(defaultMaterial) 160 loadResource_intern(path, package = package).ReadglTF(defaultMaterial)
174 161
175 proc LoadFirstMesh*(path: string, defaultMaterial: MaterialType, package = DEFAULT_PACKAGE): Mesh = 162 proc LoadFirstMesh*(path: string, defaultMaterial: MaterialType, package = DEFAULT_PACKAGE): Mesh =
176 loadResource_intern(path, package = package).ReadglTF(defaultMaterial)[0].toSeq[0] 163 loadResource_intern(path, package = package).ReadglTF(defaultMaterial)[0].toSeq[0]