summaryrefslogtreecommitdiffhomepage
path: root/dragon/outputs_docs.rb
diff options
context:
space:
mode:
authorKevin Fischer <[email protected]>2020-10-06 21:55:39 +0900
committerKevin Fischer <[email protected]>2020-10-06 21:55:39 +0900
commit4cdcf0fe7205a8897dab7294eab9cbdc67a3d34a (patch)
treee77c2fc5d7883bcca391d0218969814affbf2f56 /dragon/outputs_docs.rb
parentcdf663a63bf59af5eddfd6e9f4ba065516082c13 (diff)
downloaddragonruby-game-toolkit-contrib-4cdcf0fe7205a8897dab7294eab9cbdc67a3d34a.tar.gz
dragonruby-game-toolkit-contrib-4cdcf0fe7205a8897dab7294eab9cbdc67a3d34a.zip
Add docs for outputs.screenshots
Diffstat (limited to 'dragon/outputs_docs.rb')
-rw-r--r--dragon/outputs_docs.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/dragon/outputs_docs.rb b/dragon/outputs_docs.rb
index 16c97ec..7d47510 100644
--- a/dragon/outputs_docs.rb
+++ b/dragon/outputs_docs.rb
@@ -149,6 +149,33 @@ Here is an example:
S
end
+
+ def docs_screenshots
+ <<-S
+* DOCS: ~GTK::Outputs#screenshots~
+
+Add a hash to this collection to take a screenshot and save as png file.
+The keys of the hash can be provided in any order.
+
+#+begin_src
+ def tick args
+ args.outputs.screenshots << {
+ x: 0, y: 0, w: 100, h: 100, # Which portion of the screen should be captured
+ path: 'screenshot.png', # Output path of PNG file (inside game directory)
+ r: 255, g: 255, b: 255, a: 0 # Optional chroma key
+ }
+ end
+#+end_src
+
+** Chroma key (Making a color transparent)
+
+By specifying the r, g, b and a keys of the hash you change the transparency of a color in the resulting PNG file.
+This can be useful if you want to create files with transparent background like spritesheets.
+The transparency of the color specified by ~r~, ~g~, ~b~ will be set to the transparency specified by ~a~.
+
+The example above sets the color white (255, 255, 255) as transparent.
+S
+ end
end
class GTK::Outputs