-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample_1.bmx
40 lines (30 loc) · 871 Bytes
/
example_1.bmx
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
33
34
35
36
37
38
39
40
Strict
Framework Brl.StandardIO
Import "renderimage.bmx"
SetGraphicsDriver GLMax2DDriver()
Local gc:TGraphics = Graphics(800, 600)
Local rt:TRenderImage = CreateRenderImage(gc, 300, 150, False)
Local r2:TRenderImage = CreateRenderImage(gc, 300, 150)
SetClsColor 40, 80, 160
' render into the texture
SetRenderImage(rt)
Cls
For Local i :Int = 0 To 100
SetColor Rand(0,255), Rand(0,255), Rand(0,255)
DrawText("Hey", Rand(0, rt.width-50), Rand(0, rt.height-20))
Next
While Not KeyDown(KEY_ESCAPE)
' switch back to render to the original backbuffer
SetRenderImage(Null)
Cls
SetColor 255,255,255
SetScale 2,2
DrawImage(rt,MouseX(),MouseY())
SetScale 1,1
SetRenderImage(r2)
DrawText "Render 2 texture: " + GetGraphicsDriver().ToString(), 0, 0
SetRenderImage(Null)
DrawImage(r2, GraphicsWidth() - MouseX(), GraphicsHeight() - MouseY())
Flip
Wend
End