summaryrefslogtreecommitdiffhomepage
path: root/samples/07_advanced_rendering/00_rotating_label/app/main.rb
blob: 8b21fb8ccba8ad8b853db358996359470a88deb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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