mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
graphics: Rename EBITEN_DUMP_IMAGES_KEY to EBITEN_INTERNAL_IMAGES_KEY
This commit is contained in:
parent
a36bb5dffd
commit
452a9b14a4
2
doc.go
2
doc.go
@ -42,6 +42,6 @@
|
|||||||
// `EBITEN_SCREENSHOT_KEY=q`, you can take a game screen's screenshot
|
// `EBITEN_SCREENSHOT_KEY=q`, you can take a game screen's screenshot
|
||||||
// by pressing Q key.
|
// by pressing Q key.
|
||||||
//
|
//
|
||||||
// The EBITEN_DUMP_IMAGES_KEY environment variable specifies the key
|
// The EBITEN_INTERNAL_IMAGES_KEY environment variable specifies the key
|
||||||
// to dump all the internal images.
|
// to dump all the internal images.
|
||||||
package ebiten
|
package ebiten
|
||||||
|
26
run.go
26
run.go
@ -103,9 +103,9 @@ type imageDumper struct {
|
|||||||
screenshotKey Key
|
screenshotKey Key
|
||||||
toTakeScreenshot bool
|
toTakeScreenshot bool
|
||||||
|
|
||||||
hasDumpImagesKey bool
|
hasDumpInternalImagesKey bool
|
||||||
dumpImagesKey Key
|
dumpInternalImagesKey Key
|
||||||
toDumpImages bool
|
toDumpInternalImages bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *imageDumper) update(screen *Image) error {
|
func (i *imageDumper) update(screen *Image) error {
|
||||||
@ -123,10 +123,10 @@ func (i *imageDumper) update(screen *Image) error {
|
|||||||
i.screenshotKey = key
|
i.screenshotKey = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if keyname := os.Getenv("EBITEN_DUMP_IMAGES_KEY"); keyname != "" {
|
if keyname := os.Getenv("EBITEN_INTERNAL_IMAGES_KEY"); keyname != "" {
|
||||||
if key, ok := keyNameToKey(keyname); ok {
|
if key, ok := keyNameToKey(keyname); ok {
|
||||||
i.hasDumpImagesKey = true
|
i.hasDumpInternalImagesKey = true
|
||||||
i.dumpImagesKey = key
|
i.dumpInternalImagesKey = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,8 +135,8 @@ func (i *imageDumper) update(screen *Image) error {
|
|||||||
if i.hasScreenshotKey {
|
if i.hasScreenshotKey {
|
||||||
keys[i.screenshotKey] = struct{}{}
|
keys[i.screenshotKey] = struct{}{}
|
||||||
}
|
}
|
||||||
if i.hasDumpImagesKey {
|
if i.hasDumpInternalImagesKey {
|
||||||
keys[i.dumpImagesKey] = struct{}{}
|
keys[i.dumpInternalImagesKey] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
for key := range keys {
|
for key := range keys {
|
||||||
@ -146,8 +146,8 @@ func (i *imageDumper) update(screen *Image) error {
|
|||||||
if i.hasScreenshotKey && key == i.screenshotKey {
|
if i.hasScreenshotKey && key == i.screenshotKey {
|
||||||
i.toTakeScreenshot = true
|
i.toTakeScreenshot = true
|
||||||
}
|
}
|
||||||
if i.hasDumpImagesKey && key == i.dumpImagesKey {
|
if i.hasDumpInternalImagesKey && key == i.dumpInternalImagesKey {
|
||||||
i.toDumpImages = true
|
i.toDumpInternalImages = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -185,8 +185,8 @@ func (i *imageDumper) update(screen *Image) error {
|
|||||||
fmt.Fprintf(os.Stderr, "Saved screenshot: %s.png\n", name)
|
fmt.Fprintf(os.Stderr, "Saved screenshot: %s.png\n", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if i.toDumpImages {
|
if i.toDumpInternalImages {
|
||||||
dir, err := ioutil.TempDir("", "ebiten_textures_")
|
dir, err := ioutil.TempDir("", "ebiten_internal_images_")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ func (i *imageDumper) update(screen *Image) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i.toDumpImages = false
|
i.toDumpInternalImages = false
|
||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "Dumped the internal images at: %s\n", dir)
|
fmt.Fprintf(os.Stderr, "Dumped the internal images at: %s\n", dir)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user