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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
| #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Text Input
# par cybersam
# revu et corrigé par berka
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Game_Interpreter
def command_303
if $data_actors[@params[0]] != nil
data, top_text, text, font, size =
[], "Entrez votre nom: ", "", "Arial", 24
$game_temp.name_actor_id = @params[0]
$game_temp.name_max_char = @params[1]
max =$game_temp.name_max_char
actor = $game_actors[$game_temp.name_actor_id]
$game_actors[$game_temp.name_actor_id].name=Text_input.new(actor,top_text, text, font, max, size).text
end
@index += 1
return false
end
end
class Text_input < Window_Base
attr_reader :name
def initialize(actor, top_text, text, font, max, size, free = "_", max2=20)
@toptext, @actor, @text, @font, @max, @max2, @size, @free =
top_text, actor, actor.name, font, max, max2, size, free
super(272 - (@max2*@size+@size)/2, 208-@size*2-32, @max2 * @size + 32, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = @font
self.contents.font.size = @size
self.z = 256
@twidth, @twidth2 = @max2*@size, @max2*@size-(1/4*@max2)
refresh
update
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, @twidth, @size, @toptext, 1)
for i in 0...@max
text = @text[i]
if text == nil
text = @free
else
text = text.chr
end
self.contents.font.color = normal_color
self.contents.draw_text(@size * i+ (@max2*@size+@size)/2-(@max*@size+@size)/2, @size + 24, @size, @size, text.to_s, 1)#
draw_actor_graphic(@actor, 20, 45)
end
end
def update
loop do
Graphics.update
refresh
if Kboard.keyboard($R_Key_BACK)
text = ""
if @text.size != 0
for i in 0... @text.size - 1
text += @text[i].chr
end
@text = text
else
end
end
return if Kboard.keyboard($R_Key_RETURN)
if @text.size < @max
@text += " " if Kboard.keyboard($R_Key_SPACE)
if Kboard.key($R_Key_CAPITAL, 1) or
Kboard.key($R_Key_LSHIFT)
@text += "A" if Kboard.keyboard($R_Key_A)
@text += "B" if Kboard.keyboard($R_Key_B)
@text += "C" if Kboard.keyboard($R_Key_C)
@text += "D" if Kboard.keyboard($R_Key_D)
@text += "E" if Kboard.keyboard($R_Key_E)
@text += "F" if Kboard.keyboard($R_Key_F)
@text += "G" if Kboard.keyboard($R_Key_G)
@text += "H" if Kboard.keyboard($R_Key_H)
@text += "I" if Kboard.keyboard($R_Key_I)
@text += "J" if Kboard.keyboard($R_Key_J)
@text += "K" if Kboard.keyboard($R_Key_K)
@text += "L" if Kboard.keyboard($R_Key_L)
@text += "M" if Kboard.keyboard($R_Key_M)
@text += "N" if Kboard.keyboard($R_Key_N)
@text += "O" if Kboard.keyboard($R_Key_O)
@text += "P" if Kboard.keyboard($R_Key_P)
@text += "Q" if Kboard.keyboard($R_Key_Q)
@text += "R" if Kboard.keyboard($R_Key_R)
@text += "S" if Kboard.keyboard($R_Key_S)
@text += "T" if Kboard.keyboard($R_Key_T)
@text += "U" if Kboard.keyboard($R_Key_U)
@text += "V" if Kboard.keyboard($R_Key_V)
@text += "W" if Kboard.keyboard($R_Key_W)
@text += "X" if Kboard.keyboard($R_Key_X)
@text += "Y" if Kboard.keyboard($R_Key_Y)
@text += "Z" if Kboard.keyboard($R_Key_Z)
elsif Kboard.key($R_Key_CAPITAL)
@text += "a" if Kboard.keyboard($R_Key_A)
@text += "b" if Kboard.keyboard($R_Key_B)
@text += "c" if Kboard.keyboard($R_Key_C)
@text += "d" if Kboard.keyboard($R_Key_D)
@text += "e" if Kboard.keyboard($R_Key_E)
@text += "f" if Kboard.keyboard($R_Key_E)
@text += "g" if Kboard.keyboard($R_Key_G)
@text += "h" if Kboard.keyboard($R_Key_H)
@text += "i" if Kboard.keyboard($R_Key_I)
@text += "j" if Kboard.keyboard($R_Key_J)
@text += "k" if Kboard.keyboard($R_Key_K)
@text += "l" if Kboard.keyboard($R_Key_L)
@text += "m" if Kboard.keyboard($R_Key_M)
@text += "n" if Kboard.keyboard($R_Key_N)
@text += "o" if Kboard.keyboard($R_Key_O)
@text += "p" if Kboard.keyboard($R_Key_P)
@text += "q" if Kboard.keyboard($R_Key_Q)
@text += "r" if Kboard.keyboard($R_Key_R)
@text += "s" if Kboard.keyboard($R_Key_S)
@text += "t" if Kboard.keyboard($R_Key_T)
@text += "u" if Kboard.keyboard($R_Key_U)
@text += "v" if Kboard.keyboard($R_Key_V)
@text += "w" if Kboard.keyboard($R_Key_W)
@text += "x" if Kboard.keyboard($R_Key_X)
@text += "y" if Kboard.keyboard($R_Key_Y)
@text += "z" if Kboard.keyboard($R_Key_Z)
end
if Kboard.key($R_Key_CAPITAL, 1)
@text += "0" if Kboard.keyboard($R_Key_0)
@text += "1" if Kboard.keyboard($R_Key_1)
@text += "2" if Kboard.keyboard($R_Key_2)
@text += "3" if Kboard.keyboard($R_Key_3)
@text += "4" if Kboard.keyboard($R_Key_4)
@text += "5" if Kboard.keyboard($R_Key_5)
@text += "6" if Kboard.keyboard($R_Key_6)
@text += "7" if Kboard.keyboard($R_Key_7)
@text += "8" if Kboard.keyboard($R_Key_8)
@text += "9" if Kboard.keyboard($R_Key_9)
elsif Kboard.key($R_Key_CAPITAL)
@text += "à" if Kboard.keyboard($R_Key_0)
@text += "&" if Kboard.keyboard($R_Key_1)
@text += "é" if Kboard.keyboard($R_Key_2)
@text += "'" if Kboard.keyboard($R_Key_4)
@text += "(" if Kboard.keyboard($R_Key_5)
@text += ")" if Kboard.keyboard($R_Key_6)
@text += "è" if Kboard.keyboard($R_Key_7)
@text += "_" if Kboard.keyboard($R_Key_8)
@text += "ç" if Kboard.keyboard($R_Key_9)
end
@text += "0" if Kboard.keyboard($R_Key_NUMPAD0)
@text += "1" if Kboard.keyboard($R_Key_NUMPAD1)
@text += "2" if Kboard.keyboard($R_Key_NUMPAD2)
@text += "3" if Kboard.keyboard($R_Key_NUMPAD3)
@text += "4" if Kboard.keyboard($R_Key_NUMPAD4)
@text += "5" if Kboard.keyboard($R_Key_NUMPAD5)
@text += "6" if Kboard.keyboard($R_Key_NUMPAD6)
@text += "7" if Kboard.keyboard($R_Key_NUMPAD7)
@text += "8" if Kboard.keyboard($R_Key_NUMPAD8)
@text += "9" if Kboard.keyboard($R_Key_NUMPAD9)
@text += "+" if Kboard.keyboard($R_Key_ADD)
@text += "-" if Kboard.keyboard($R_Key_SUBTRACT)
@text += "/" if Kboard.keyboard($R_Key_DIVIDE)
@text += "*" if Kboard.keyboard($R_Key_MULTIPLY)
if Kboard.key($R_Key_CAPITAL)
@text += "," if Kboard.keyboard($R_Key_SEP)
@text += "-" if Kboard.keyboard($R_Key_DASH)
@text += "." if Kboard.keyboard($R_Key_DOTT)
elsif Kboard.key($R_Key_CAPITAL, 1)
@text += ";" if Kboard.keyboard($R_Key_SEP)
@text += "_" if Kboard.keyboard($R_Key_DASH)
@text += ":" if Kboard.keyboard($R_Key_DOTT)
end
else
end
refresh
end
end
def text()
self.contents.dispose
self.dispose
return @text
end
end |