summaryrefslogtreecommitdiff
path: root/imagefont/test.bmx
blob: b1da6df33a8bd6a9af997b6bc0a97e972632abcb (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
' $Id$

Import "imagefont.bmx"
Incbin "bmaxtest.bmi"

Graphics 800,600,32,60

fnt:ImageFont=ImageFont.Load("incbin::bmaxtest.bmi")

c=0
ci=5

Type Star
	Field x
	Field y,sp
	
	Function Create:Star()
		Local s:Star=New Star
		s.x=Rand(0,800)
		s.y=Rand(0,600)
		s.sp=Rand(1,3)
		Return s
	End Function
	
	Method Update()
		Plot(x,y)
		y:+sp
		y:Mod 600
	End Method
End Type

Const NO=10000

Local st:Star[]=New Star[NO]

For f=0 Until NO
	st[f]=Star.Create()
Next

While Not KeyHit(KEY_ESCAPE)
	Cls

	For f=0 Until NO
		st[f].Update()
	Next
	
	SetTransform(0,2,2)
	fnt.DrawColoured("DRAWCOLOURED",0,10,c/2,c/2,c)
	fnt.Draw("DRAW",0,20)
	fnt.CentreColoured("CENTRECOLOURED",30,c/2,c/2,c)
	fnt.Centre("CENTRE",40)

	c:+ci
	
	If (c=0 Or c=255) ci=-ci
	
	DrawText(MemAlloced(),0,100)

	If KeyHit(KEY_SPACE) Then FlushMem

	Flip
	
Wend

SetTransform(0,1,1)

ch=33

While Not KeyHit(KEY_ESCAPE)
	Cls

	For f=0 Until NO
		st[f].Update()
	Next
	
	a$=Chr$(ch)
	
	ch:+1
	If ch>Asc("Z") Then ch=33
	
	For x=0 To 800 Step 8
		For y=0 To 600 Step 8
			fnt.DrawColoured(a$,x,y,c,c,c)
		Next
	Next
	
	c:+ci
	
	If (c=0 Or c=255) ci=-ci
	
	DrawText(MemAlloced(),0,100)
	
	FlushMem

	Flip
	
Wend