Mercurial > games > semicongine
changeset 911:0a1e68f32fca
add: shortcut for loading of json files
| author | Sam <sam@basx.dev> | 
|---|---|
| date | Sat, 09 Mar 2024 23:06:27 +0700 | 
| parents | c62f7947d371 | 
| children | c72b246d8413 | 
| files | semicongine/resources.nim | 
| diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] | 
line wrap: on
 line diff
--- a/semicongine/resources.nim Sat Mar 09 20:30:08 2024 +0700 +++ b/semicongine/resources.nim Sat Mar 09 23:06:27 2024 +0700 @@ -1,4 +1,5 @@ import std/streams +import std/json import std/algorithm import std/strutils import std/sequtils @@ -179,6 +180,9 @@ else: raise newException(Exception, "Unsupported audio file type: " & path) +proc loadJson*(path: string, package = DEFAULT_PACKAGE): JsonNode = + path.loadResource_intern(package = package).readAll().parseJson() + proc loadFont*( path: string, name = "",
