-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfont.kn
206 lines (189 loc) · 6.59 KB
/
font.kn
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
class Font()
var image: draw@Tex
var model: []char
var kugiri: int
var haba: int
var image_: draw@Tex
var model_: []char
var kugiri_: int
var haba_: int
*func ctor()
;do image :: draw@makeTex("")
end func
func filter(message: []char): []char
ret message
end func
func filter_(message: []char): []char
ret message
end func
+func mes(message: []char, x: int, y: int)
do message :: me.filter(message)
var reading: int :: 0
var ASCII: int :: 0
var search: []char
while(reading + me.kugiri <= ^message)
do search :: message.sub(reading, me.kugiri)
do ASCII :: me.model.findStr(search, -1)
if(ASCII = -1) {見つからないなら別手段を用いる?}
do me.mes_(search.sub(0, me.kugiri_), x + me.haba * 2 * reading / me.kugiri, y)
do reading :+ me.kugiri_
else {通常}
do me.image.drawScale(x $ float + (me.haba * 2 * reading / me.kugiri) $ float, y $ float, (me.haba * 2) $ float, 32.0, (me.haba * ASCII / me.kugiri) $ float, 0.0, me.haba $ float, 16.0, 0xFFFFFFFF)
do reading :+ me.kugiri
end if
end while
;余りぶんも描画
if(^message - reading > 0)
do search :: message.sub(reading, ^message - reading)
do me.mes_(search, x + me.haba * 2 * reading / me.kugiri, y)
end if
end func
+func mes_(message: []char, x: int, y: int)
do message :: me.filter_(message)
var reading: int :: 0
var ASCII: int :: 0
var search: []char
while(reading + me.kugiri_ <= ^message)
do search :: message.sub(reading, me.kugiri_)
do ASCII :: me.model_.findStr(search, -1)
do me.image_.drawScale(x $ float + (me.haba_ * 2 * reading / me.kugiri_) $ float, y $ float, (me.haba_ * 2) $ float, 32.0, (me.haba_ * ASCII / me.kugiri_) $ float, 0.0, me.haba_ $ float, 16.0, 0xFFFFFFFF)
do reading :+ me.kugiri_
end while
end func
+func mesTomei(message: []char, x: int, y: int) {たしかスタッフロール用だった気がする}
do message :: me.filter(message)
var reading: int :: 0
var ASCII: int :: 0
var search: []char
while(reading + me.kugiri <= ^message)
do search :: message.sub(reading, me.kugiri)
do ASCII :: me.model.findStr(search, -1)
do me.image.drawScale(x $ float + (me.haba * 2 * reading / me.kugiri) $ float, y $ float, (me.haba * 2) $ float, 32.0, (me.haba * ASCII / me.kugiri) $ float, 0.0, me.haba $ float, 16.0, 0xA0FFFFFF)
do reading :+ me.kugiri
end while
end func
+func mesTomei_(message: []char, x: int, y: int) {スコア加算演出用}
do message :: me.filter_(message)
var reading: int :: 0
var ASCII: int :: 0
var search: []char
while(reading + me.kugiri_ <= ^message)
do search :: message.sub(reading, me.kugiri_)
do ASCII :: me.model_.findStr(search, -1)
do me.image_.drawScale(x $ float + (me.haba_ * 2 * reading / me.kugiri_) $ float, y $ float, (me.haba_ * 2) $ float, 32.0, (me.haba_ * ASCII / me.kugiri_) $ float, 0.0, me.haba_ $ float, 16.0, 0xA0FFFFFF)
do reading :+ me.kugiri_
end while
end func
+func mesMigi(message: []char, x: int, y: int)
do message :: me.filter(message)
var reading: int :: 0
var ASCII: int :: 0
var search: []char
while(reading + me.kugiri <= ^message)
do search :: message.sub(^message - me.kugiri - reading, me.kugiri)
do ASCII :: me.model.findStr(search, -1)
if(ASCII = -1) {見つからないなら別手段を用いる?}
do me.mes_(search.sub(0, me.kugiri_), x + me.haba * 2 * reading / me.kugiri, y)
do reading :+ me.kugiri_
else {通常}
do me.image.drawScale(x $ float - (me.haba * 2 * (reading / me.kugiri + 1)) $ float, y $ float, (me.haba * 2) $ float, 32.0, (me.haba * ASCII / me.kugiri) $ float, 0.0, me.haba $ float, 16.0, 0xFFFFFFFF)
do reading :+ me.kugiri
end if
end while
;余りぶんも描画
if(^message - reading > 0)
do search :: message.sub(reading, ^message - reading)
do me.mes_(search, x + me.haba * 2 * reading / me.kugiri, y)
end if
end func
+func mesMigizoroe(message: []char, x: int, y: int)
do me.mes(message, x - ^message / me.kugiri_ * me.haba_ * 2, y)
end func
end class
class Font1(@Font)
*func ctor()
do me.image :: draw@makeTex("res/font1.png")
do me.model :: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZde."
do me.kugiri :: 1
do me.haba :: 16
end func
end class
class Font2(@Font)
*func ctor()
do me.image :: draw@makeTex("res/font2.png")
do me.model :: "NOW_NEXTBOMBSPED/200_1_2_4_816243248_61218203036404280__/"
do me.kugiri :: 2
do me.haba :: 16
end func
end class
class Font3(@Font)
*func ctor()
do me.image :: draw@makeTex("res/font3.png")
do me.model :: "NOnebosp><."
do me.kugiri :: 1
do me.haba :: 8
end func
*func filter(message: []char): []char
ret message.replace("/200", ">").replace("/180", "<")
end func
end class
class Font4(@Font)
*func ctor()
do me.image :: draw@makeTex("res/font3.png")
do me.model :: "NOW*NEXTBOMBSPED/***/***_.0123456789"
do me.kugiri :: 1
do me.haba :: 8
end func
end class
+class FontTag(@Font) {Ranking Tag}
*func ctor()
do me.image :: draw@makeTex("res/rankingtag.png")
do me.model :: "RNST_"
do me.kugiri :: 1
do me.haba :: 48
end func
end class
+class FontBN(@Font) {Blue Number}
*func ctor()
do me.image :: draw@makeTex("res/font_bn.png")
do me.model :: "0123456789._"
do me.kugiri :: 1
do me.haba :: 8
end func
end class
+class FontWN(@Font) {Water Number}
*func ctor()
do me.image :: draw@makeTex("res/font_wn.png")
do me.model :: "0123456789._"
do me.kugiri :: 1
do me.haba :: 8
end func
end class
+class FontBC(@Font) {Blue Character}
*func ctor()
do me.image :: draw@makeTex("res/font_bc.png")
do me.model :: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789de_"
do me.kugiri :: 1
do me.haba :: 16
end func
end class
+class FontGT(@Font) {Green Tag}
*func ctor()
do me.image :: draw@makeTex("res/font_gt.png")
do me.model :: "NOW*NEXTBOMBSPD*CELL__"
do me.kugiri :: 2
do me.haba :: 16
do me.image_ :: draw@makeTex("res/font_gn.png")
do me.model_ :: "/:.0123456789+_"
do me.kugiri_ :: 1
do me.haba_ :: 8
end func
end class
+class FontHR(@Font) {HIRAGANA}
*func ctor()
do me.image :: draw@makeTex("res/font_hr.png")
do me.model :: "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゐゆゑよらりるれろわをんがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽぁぃぅぇぉっゃゅょ・0、。!?「」ー~ヒャ "
do me.kugiri :: 1
do me.haba :: 16
end func
end class