API 레퍼런스는 소스 코드의 Go 문서 주석에서 추출되며 영어로 작성되어 있습니다.
package placeholder
import "github.com/nsgo-dev/game/pkg/placeholder"개요
Package placeholder is a small asset pack for prototypes, tutorials and the examples, dedicated to the public domain under CC0 1.0 (License): sprite sheets, a tileset with a Tiled tileset and a sample level, a pixel font, sound effects and a music loop, and three glTF models.
Every file was drawn, synthesized or modeled in Go for this repository by the generator under internal/gen, which writes the same bytes on every run, and the package embeds them and FS returns them. Each image and sound has the import settings sidecar game assets reads (package importsettings): a sprite sheet's slices it into 16 by 16 frames, the tileset's and the font page's keep their pixels sharp, and a sound's sets its loudness and, for the music, its loop. CREDITS.md in FS() lists every file with its license, so a game that ships the pack's files can ship its credits too.
Sheet, Font, Level, Model and Sound load the pack's assets ready for packages sprite, text, tilemap, gltf and NSGo's audio. A game that copies the files into its own project instead builds them with game assets like any other art.
색인
상수
const License = "CC0-1.0"License is the SPDX identifier of the license of every file in the pack: Creative Commons Zero v1.0 Universal, a dedication to the public domain.
함수
func FS() fs.FSFS returns the pack's files, read-only, by their slash-separated paths, such as "sprites/player.png": the sprite sheets with their JSON and import settings sidecars under sprites/, the tileset, its Tiled tileset and a sample level under tiles/, the bitmap font under fonts/, the sounds under sounds/, the models under models/, and CREDITS.md, which lists every file with its license.
func Font() (*text.Font, error)Font loads the pack's proportional pixel font, fonts/pixel.fnt and its page fonts/pixel.png: printable ASCII, 7 pixels tall above the baseline with descenders below it, lines 10 pixels apart.
func Image(file string) (core.ImageSource, error)Image returns the PNG image at the slash-separated path file in the pack as an image source of its PNG data, sized in points as it is in pixels.
func Level() (*tilemap.Tilemap, error)Level loads the sample level tiles/level.tmj: 40 by 15 tiles of 16 pixels on the tileset tiles/tileset.tsj, with a "decor" and a "ground" tile layer and an "objects" layer of points whose types are spawn, coin, gem, slime and bat, and an exit rectangle. The tileset's tiles carry the properties solid, oneWay, ladder, hazard and water, so the map's tile flags mark solid and one-way tiles, and water, lava and the torch are animated.
func Model(file string) (*gltf.Document, error)Model loads the glTF model models/<file>: "crate.glb", a 1 m cube; "robot_arm.gltf", a two-bone arm, skinned, with a "Wave" animation; or "gem.glb", a gem 1 m tall. Each stands on the origin, +Y up and -Z forward.
func Sheet(name string) (*sprite.Atlas, error)Sheet loads the sprite sheet sprites/<name>.png with its frames and animations from sprites/<name>.json: "player", "slime", "bat", "coin", "items", "effects" or "ui". Frame i is named <name>_<i>, and each animation is named after its Aseprite tag, such as "run" in the player's sheet or "heart" in the items'.
func Sound(name string) (core.AudioSource, error)Sound returns the WAV file sounds/<name>.wav as an audio source: the effects "jump", "coin", "hit", "explosion", "shoot", "powerup", "click" and "select", or "music_loop", four bars that loop without a seam.