summaryrefslogtreecommitdiffhomepage
path: root/samples/07_advanced_rendering/00_rotating_label/app/main.rb
diff options
context:
space:
mode:
author_Tradam <[email protected]>2021-12-16 19:22:26 -0500
committerGitHub <[email protected]>2021-12-16 19:22:26 -0500
commit5954b9beb4d4a3b4f248d72d1851195f030558a8 (patch)
treefecd8aa840a25afdb502915b0fdb4d03b7ed339a /samples/07_advanced_rendering/00_rotating_label/app/main.rb
parent2f845281f133849256b57bb08fd3e9ae57600784 (diff)
parenteaa29e72939f5edf61735ccbb73c36ee89369f65 (diff)
downloaddragonruby-game-toolkit-contrib-5954b9beb4d4a3b4f248d72d1851195f030558a8.tar.gz
dragonruby-game-toolkit-contrib-5954b9beb4d4a3b4f248d72d1851195f030558a8.zip
Merge branch 'DragonRuby:master' into masterHEADmaster
Diffstat (limited to 'samples/07_advanced_rendering/00_rotating_label/app/main.rb')
-rw-r--r--samples/07_advanced_rendering/00_rotating_label/app/main.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/samples/07_advanced_rendering/00_rotating_label/app/main.rb b/samples/07_advanced_rendering/00_rotating_label/app/main.rb
new file mode 100644
index 0000000..8b21fb8
--- /dev/null
+++ b/samples/07_advanced_rendering/00_rotating_label/app/main.rb
@@ -0,0 +1,32 @@
+def tick args
+ # set the render target width and height to match the label
+ args.outputs[:scene].w = 220
+ args.outputs[:scene].h = 30
+
+
+ # make the background transparent
+ args.outputs[:scene].background_color = [255, 255, 255, 0]
+
+ # set the blendmode of the label to 0 (no blending)
+ # center it inside of the scene
+ # set the vertical_alignment_enum to 1 (center)
+ args.outputs[:scene].labels << { x: 0,
+ y: 15,
+ text: "label in render target",
+ blendmode_enum: 0,
+ vertical_alignment_enum: 1 }
+
+ # add a border to the render target
+ args.outputs[:scene].borders << { x: 0,
+ y: 0,
+ w: args.outputs[:scene].w,
+ h: args.outputs[:scene].h }
+
+ # add the rendertarget to the main output as a sprite
+ args.outputs.sprites << { x: 640 - args.outputs[:scene].w.half,
+ y: 360 - args.outputs[:scene].h.half,
+ w: args.outputs[:scene].w,
+ h: args.outputs[:scene].h,
+ angle: args.state.tick_count,
+ path: :scene }
+end