gosu 0.7.19-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.txt +30 -0
- data/README.txt +17 -0
- data/examples/ChipmunkIntegration.rb +275 -0
- data/examples/CptnRuby.rb +231 -0
- data/examples/MoreChipmunkAndRMagick.rb +155 -0
- data/examples/OpenGLIntegration.rb +232 -0
- data/examples/RMagickIntegration.rb +449 -0
- data/examples/TextInput.rb +145 -0
- data/examples/Tutorial.rb +137 -0
- data/examples/media/Beep.wav +0 -0
- data/examples/media/CptnRuby Gem.png +0 -0
- data/examples/media/CptnRuby Map.txt +25 -0
- data/examples/media/CptnRuby Tileset.png +0 -0
- data/examples/media/CptnRuby.png +0 -0
- data/examples/media/Cursor.png +0 -0
- data/examples/media/Earth.png +0 -0
- data/examples/media/Explosion.wav +0 -0
- data/examples/media/LargeStar.png +0 -0
- data/examples/media/Sky.jpg +0 -0
- data/examples/media/Smoke.png +0 -0
- data/examples/media/Soldier.png +0 -0
- data/examples/media/Space.png +0 -0
- data/examples/media/Star.png +0 -0
- data/examples/media/Starfighter.bmp +0 -0
- data/lib/fmod.dll +0 -0
- data/lib/gosu.for_1_8.so +0 -0
- data/lib/gosu.for_1_9.so +0 -0
- data/lib/gosu.rb +19 -0
- data/lib/gosu/patches.rb +64 -0
- data/lib/gosu/swig_patches.rb +21 -0
- data/reference/rdoc/classes/Gosu.html +1546 -0
- data/reference/rdoc/classes/Gosu/Color.html +660 -0
- data/reference/rdoc/classes/Gosu/Font.html +545 -0
- data/reference/rdoc/classes/Gosu/GLTexInfo.html +412 -0
- data/reference/rdoc/classes/Gosu/Image.html +706 -0
- data/reference/rdoc/classes/Gosu/Sample.html +476 -0
- data/reference/rdoc/classes/Gosu/SampleInstance.html +523 -0
- data/reference/rdoc/classes/Gosu/Song.html +568 -0
- data/reference/rdoc/classes/Gosu/TextInput.html +444 -0
- data/reference/rdoc/classes/Gosu/Window.html +911 -0
- data/reference/rdoc/classes/Numeric.html +479 -0
- data/reference/rdoc/created.rid +1 -0
- data/reference/rdoc/files/COPYING_txt.html +391 -0
- data/reference/rdoc/files/README_txt.html +387 -0
- data/reference/rdoc/files/reference/Deployment on OS X_rdoc.html +381 -0
- data/reference/rdoc/files/reference/Deployment on Windows_rdoc.html +385 -0
- data/reference/rdoc/files/reference/Drawing with Colors_rdoc.html +363 -0
- data/reference/rdoc/files/reference/Order of Corners_rdoc.html +358 -0
- data/reference/rdoc/files/reference/Tileability_rdoc.html +374 -0
- data/reference/rdoc/files/reference/Z Ordering_rdoc.html +361 -0
- data/reference/rdoc/files/reference/gosu_rb.html +348 -0
- data/reference/rdoc/fr_class_index.html +12 -0
- data/reference/rdoc/fr_file_index.html +10 -0
- data/reference/rdoc/fr_method_index.html +66 -0
- data/reference/rdoc/index.html +1 -0
- data/reference/rdoc/rdoc-style.css +320 -0
- metadata +111 -0
@@ -0,0 +1,444 @@
|
|
1
|
+
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Class: Gosu::TextInput</title><link type="text/css" href="../.././rdoc-style.css" rel="stylesheet" media="screen"/><script type="text/javascript">
|
2
|
+
// Allison template
|
3
|
+
// Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file.
|
4
|
+
|
5
|
+
var href_base = '../.././rdoc-style.css'.replace(/(.*\/).*/, '$1'); // inline js is good for something
|
6
|
+
|
7
|
+
function $(id) {
|
8
|
+
if (document.getElementById)
|
9
|
+
elem = document.getElementById(id);
|
10
|
+
else if ( document.all )
|
11
|
+
elem = eval("document.all." + id);
|
12
|
+
else
|
13
|
+
return false;
|
14
|
+
return elem;
|
15
|
+
}
|
16
|
+
|
17
|
+
function toggle(id) {
|
18
|
+
elem = $(id);
|
19
|
+
elemStyle = elem.style;
|
20
|
+
if (elemStyle.display == "block") {
|
21
|
+
elemStyle.display = "none"
|
22
|
+
} else {
|
23
|
+
elemStyle.display = "block"
|
24
|
+
}
|
25
|
+
return true;
|
26
|
+
}
|
27
|
+
|
28
|
+
function toggleText(id) {
|
29
|
+
elem = $(id)
|
30
|
+
if (m = elem.innerHTML.match(/(Hide)(.*)/)) {
|
31
|
+
elem.innerHTML = "Show" + m[2];
|
32
|
+
} else if (m = elem.innerHTML.match(/(Show)(.*)/)) {
|
33
|
+
elem.innerHTML = "Hide" + m[2];
|
34
|
+
}
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
function span(s, klass) {
|
39
|
+
return '<span class="' + klass + '">' + s + '</span>';
|
40
|
+
}
|
41
|
+
|
42
|
+
function highlightSymbols() {
|
43
|
+
pres = document.getElementsByTagName('pre');
|
44
|
+
for(var i = 0; i < pres.length; i++) {
|
45
|
+
pre = pres[i];
|
46
|
+
spans = pre.getElementsByTagName('span');
|
47
|
+
for(var k = 0; k < spans.length; k++) {
|
48
|
+
span = spans[k];
|
49
|
+
if (span.className.match(/ruby-identifier/)) {
|
50
|
+
if (span.innerHTML.match(/^:/)) {
|
51
|
+
span.className += " ruby-symbol";
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
function hasClass(obj) {
|
59
|
+
var result = false;
|
60
|
+
if (obj.getAttributeNode("class") != null) {
|
61
|
+
result = obj.getAttributeNode("class").value;
|
62
|
+
}
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
66
|
+
function stripe() {
|
67
|
+
var even = true;
|
68
|
+
var color = "#e4ebed";
|
69
|
+
var tables = document.getElementsByTagName('table');
|
70
|
+
if (tables.length == 0) { return; }
|
71
|
+
for (var h = 0; h < tables.length; h++) {
|
72
|
+
var trs = tables[h].getElementsByTagName("tr");
|
73
|
+
for (var i = 0; i < trs.length; i++) {
|
74
|
+
var tds = trs[i].getElementsByTagName("td");
|
75
|
+
for (var j = 0; j < tds.length; j++) {
|
76
|
+
if (hasClass(tds[j]) != "first") {
|
77
|
+
var mytd = tds[j];
|
78
|
+
if (even) {
|
79
|
+
mytd.style.backgroundColor = color;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
even = ! even;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
function ajaxGet(url) {
|
89
|
+
url = (href_base + url).replace('/./', '/')
|
90
|
+
var req = false;
|
91
|
+
|
92
|
+
if (window.ActiveXObject) {
|
93
|
+
try {
|
94
|
+
// stupid hack because IE7 disables local Ajax with the native xmlhttprequest object
|
95
|
+
// for security purposes. Yet ActiveX still works. Thanks, Microsoft. I hate you. Die.
|
96
|
+
req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
|
97
|
+
} catch (e) {
|
98
|
+
try {
|
99
|
+
/* IE 6 and maybe 5, don't know, don't care */
|
100
|
+
req = new ActiveXObject("Msxml2.XMLHTTP");
|
101
|
+
} catch (e) {
|
102
|
+
try {
|
103
|
+
req = new ActiveXObject("Microsoft.XMLHTTP");
|
104
|
+
} catch (e) {
|
105
|
+
req = false;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
/* real browsers */
|
112
|
+
if (!req && window.XMLHttpRequest) {
|
113
|
+
try {
|
114
|
+
req = new XMLHttpRequest();
|
115
|
+
} catch (e) {
|
116
|
+
req = false;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
if (req) {
|
121
|
+
req.open('GET', url, false);
|
122
|
+
req.send(null);
|
123
|
+
return req.responseText;
|
124
|
+
} else {
|
125
|
+
return "Ajax error";
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
function addEvent(elm, evType, fn, useCapture) {
|
131
|
+
if (elm.addEventListener) {
|
132
|
+
elm.addEventListener(evType, fn, useCapture);
|
133
|
+
return true;
|
134
|
+
} else if (elm.attachEvent) {
|
135
|
+
var r = elm.attachEvent('on' + evType, fn);
|
136
|
+
return r;
|
137
|
+
} else {
|
138
|
+
elm['on' + evType] = fn;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
function insertIndices() {
|
143
|
+
pages = ["class", "file", "method"]
|
144
|
+
for (x in pages) {
|
145
|
+
$(pages[x]).innerHTML += ajaxGet('fr_' + pages[x] + '_index.html').replace(/(href=")/g, '$1' + href_base);
|
146
|
+
}
|
147
|
+
/* mouseoverify method links */
|
148
|
+
links = $('method').getElementsByTagName('a');
|
149
|
+
for (var x = 0; x < links.length; x++) {
|
150
|
+
if (m = links[x].innerHTML.match(/(.*)\s\((.*)\)/)) {
|
151
|
+
links[x].innerHTML = m[1] + '<br>';
|
152
|
+
links[x].title = m[2];
|
153
|
+
}
|
154
|
+
}
|
155
|
+
/* this is stupid */
|
156
|
+
$('class').style.display = "block";
|
157
|
+
$('file').style.display = "block";
|
158
|
+
|
159
|
+
/* has to be here because IE7 does not guarantee the onLoad callback order */
|
160
|
+
abbreviateIndicesInner(["class", "file"], 25, "a");
|
161
|
+
/* same, linkTitle() depends on the class link list */
|
162
|
+
linkTitle();
|
163
|
+
}
|
164
|
+
|
165
|
+
function abbreviateIndices() {
|
166
|
+
var ids = ["defined_in", "child_of", "includes", "requires", "method", "methods"];
|
167
|
+
abbreviateIndicesInner(ids, 25, 'a');
|
168
|
+
abbreviateIndicesInner(ids, 25, 'span');
|
169
|
+
}
|
170
|
+
|
171
|
+
function abbreviateIndicesInner(indices, amount, tag) {
|
172
|
+
for (var x = 0; x < indices.length; x++) {
|
173
|
+
var the_index = $(indices[x]);
|
174
|
+
if (the_index) {
|
175
|
+
links = the_index.getElementsByTagName(tag);
|
176
|
+
for (var y = 0; y < links.length; y++) {
|
177
|
+
var link = links[y];
|
178
|
+
if (link.getElementsByTagName('span').length == 0 && link.getElementsByTagName('a').length == 0) {
|
179
|
+
// avoid nesting
|
180
|
+
link.innerHTML = link.innerHTML.replace(/<br>|\n/gi, '');
|
181
|
+
link.title = link.innerHTML;
|
182
|
+
link.innerHTML = abbreviate(link.innerHTML, amount) + '<br>';
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
function linkTitle() {
|
190
|
+
|
191
|
+
/* grab the correct title element from the index */
|
192
|
+
var index_page = ajaxGet('index.html');
|
193
|
+
title_text = index_page.match(/<title>(.*)<\/title>/m)[1];
|
194
|
+
document.title = title_text + " - " + document.title;
|
195
|
+
var p = $('header').getElementsByTagName('p')[0]
|
196
|
+
if (p.innerHTML.match(/^\s*$/)) {
|
197
|
+
p.innerHTML = title_text;
|
198
|
+
} else {
|
199
|
+
p.innerHTML = title_text + ": " + p.innerHTML;
|
200
|
+
}
|
201
|
+
|
202
|
+
/* set the link properly */
|
203
|
+
title_link = index_page.match(/<a\s+href="(.*?)"/)[1];
|
204
|
+
var element = $('title');
|
205
|
+
var item_type = "";
|
206
|
+
var item_name = "";
|
207
|
+
if (m = element.innerHTML.match(/(Class:|Module:|File:)\s*(.*)/)) {
|
208
|
+
item_type = m[1];
|
209
|
+
item_name = m[2];
|
210
|
+
} else {
|
211
|
+
item_name = element.innerHTML;
|
212
|
+
}
|
213
|
+
element.innerHTML = '<a href="' + href_base + title_link + '">' + item_type + " " + abbreviate(item_name, 45) + '</a>';
|
214
|
+
element.getElementsByTagName('a')[0].title = item_name
|
215
|
+
|
216
|
+
/* breadcrumb navigation */
|
217
|
+
items = item_name.split("::");
|
218
|
+
items_new = item_name.split("::");
|
219
|
+
file_links = $('class').getElementsByTagName('a');
|
220
|
+
for (var x = 0; x < items.length - 1; x++ ){
|
221
|
+
var item = items[x];
|
222
|
+
link = ("/classes/" + items.slice(0,x).join("/") + "/" + item + ".html").replace('//', '/');
|
223
|
+
regex = new RegExp(RegExp.escape(link) + '$');
|
224
|
+
for (var y = 0; y < file_links.length; y++) {
|
225
|
+
if (file_links[y].href.match(regex)) {
|
226
|
+
items_new[x] = '<a href="' + href_base + link + '">' + item + '</a>';
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
$('item_name').innerHTML = item_type + ' ' + items_new.join(" :: ");
|
232
|
+
}
|
233
|
+
|
234
|
+
function abbreviate(s, size) {
|
235
|
+
// Try to get rid of path and extension in any case. These are not
|
236
|
+
// even interesting if there is enough space.
|
237
|
+
|
238
|
+
s = s.replace(/\..*$/, '');
|
239
|
+
s = s.replace(/.*\//g, '');
|
240
|
+
|
241
|
+
// Now this is a blatant hack.
|
242
|
+
|
243
|
+
if (s == 'gosu')
|
244
|
+
return ''; // Noone will ever see the link, harhar!
|
245
|
+
|
246
|
+
while (s.length > size) {
|
247
|
+
var old_s = s;
|
248
|
+
s = s.replace(/\s|\n/mg, '');
|
249
|
+
s = s.replace(/([A-Z])[a-z]+/m, '$1');
|
250
|
+
if (!s || old_s == s) {
|
251
|
+
return "..." + s.substring(s.length - size, s.length);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
return s;
|
255
|
+
}
|
256
|
+
|
257
|
+
function disableSubmit(event) {
|
258
|
+
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
259
|
+
if (keyCode == 13) {
|
260
|
+
return false;
|
261
|
+
} else {
|
262
|
+
return true;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
function filterList(id, s, event) {
|
267
|
+
|
268
|
+
/* some weak escaping */
|
269
|
+
s = s.replace(/[^\w\d\.\_\-\/\:\=\[\]\?\!]/g, '');
|
270
|
+
s = RegExp.escape(s);
|
271
|
+
|
272
|
+
var show_all = false;
|
273
|
+
if (s.match(/^\s*$/)) {
|
274
|
+
show_all = true;
|
275
|
+
}
|
276
|
+
|
277
|
+
links = $(id).getElementsByTagName('a')
|
278
|
+
regex = new RegExp(s, 'i');
|
279
|
+
|
280
|
+
for (var x = 0; x < links.length; x++) {
|
281
|
+
var link = links[x];
|
282
|
+
if (show_all) {
|
283
|
+
link.style.display = 'inline';
|
284
|
+
} else {
|
285
|
+
if (link.innerHTML.match(regex)) {
|
286
|
+
link.style.display = 'inline';
|
287
|
+
} else {
|
288
|
+
link.style.display = 'none';
|
289
|
+
}
|
290
|
+
}
|
291
|
+
}
|
292
|
+
return true;
|
293
|
+
}
|
294
|
+
|
295
|
+
RegExp.escape = function(text) {
|
296
|
+
if (!arguments.callee.sRE) {
|
297
|
+
var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
|
298
|
+
arguments.callee.sRE = new RegExp(
|
299
|
+
'(\\' + specials.join('|\\') + ')', 'g'
|
300
|
+
);
|
301
|
+
}
|
302
|
+
return text.replace(arguments.callee.sRE, '\\$1');
|
303
|
+
}
|
304
|
+
|
305
|
+
function hacks() {
|
306
|
+
// show the spacer if necessary,
|
307
|
+
divs = document.getElementsByTagName('div');
|
308
|
+
for(var x = 0; x < divs.length; x++) {
|
309
|
+
if (divs[x].className && divs[x].className.match(/top/)) {
|
310
|
+
document.getElementById('spacer').style.display = 'block';
|
311
|
+
}
|
312
|
+
}
|
313
|
+
// remove extra colons from tables
|
314
|
+
tds = document.getElementsByTagName('td');
|
315
|
+
for(var x = 0; x < tds.length; x++) {
|
316
|
+
str = tds[x].innerHTML
|
317
|
+
if (str.charAt(str.length - 1) == ":") {
|
318
|
+
tds[x].innerHTML = str.slice(0, str.length - 1)
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
addEvent(window, 'load', insertIndices, false);
|
324
|
+
addEvent(window, 'load', abbreviateIndices, false);
|
325
|
+
addEvent(window, 'load', stripe, false);
|
326
|
+
addEvent(window, 'load', highlightSymbols, false);
|
327
|
+
addEvent(window, 'load', hacks, false);
|
328
|
+
</script></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div id="header"><span><h1 id="title">
|
329
|
+
Class: Gosu::TextInput
|
330
|
+
</h1></span></div><div class="clear"></div><div id="left">
|
331
|
+
<div class="navigation darker top" id="child_of"><h3>Child of</h3><span>
|
332
|
+
|
333
|
+
Object
|
334
|
+
</span></div>
|
335
|
+
|
336
|
+
<div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
|
337
|
+
|
338
|
+
<a href="../../files/reference/gosu_rb.html">reference/gosu.rb</a>
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
<div class="navigation top" id="methods"><h3>Methods</h3>
|
345
|
+
|
346
|
+
|
347
|
+
<a href='#M000065'>
|
348
|
+
filter<br/>
|
349
|
+
</a>
|
350
|
+
|
351
|
+
|
352
|
+
</div>
|
353
|
+
<div id="spacer"></div><div class="navigation darker index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter: </label><input type="text" onKeyUp="return filterList('class', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_class"></input></form></div></div><div class="navigation darker index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter: </label><input type="text" onKeyUp="return filterList('file', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_file"></input></form></div></div><div class="navigation darker index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter: </label><input type="text" onKeyUp="return filterList('method', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_method"></input></form></div></div></div><div id="content">
|
354
|
+
<div id="description"><p>
|
355
|
+
<a href="TextInput.html">TextInput</a> instances are invisible objects that
|
356
|
+
build a text string from input, using the current operating system‘s
|
357
|
+
keyboard layout.
|
358
|
+
</p>
|
359
|
+
<p>
|
360
|
+
At its most basic form, you only need to create a new <a
|
361
|
+
href="TextInput.html">TextInput</a> instance and pass it to your window via
|
362
|
+
text_input=. Until you call this function again, passing nil, the <a
|
363
|
+
href="TextInput.html">TextInput</a> object will build a text that can be
|
364
|
+
accessed via TextInput#text.
|
365
|
+
</p>
|
366
|
+
<p>
|
367
|
+
A <a href="TextInput.html">TextInput</a> object is purely abstract, though;
|
368
|
+
drawing the input field is left to the user. As with most of <a
|
369
|
+
href="../Gosu.html">Gosu</a>, how this is handled is completely left open.
|
370
|
+
</p>
|
371
|
+
<p>
|
372
|
+
<a href="TextInput.html">TextInput</a> only aims to provide enough code for
|
373
|
+
your own GUIs to build upon.
|
374
|
+
</p>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
<p></p>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
<h1>Attributes</h1><p><table><tr><th>Name</th><th>Read/write?</th></tr>
|
386
|
+
<tr>
|
387
|
+
<td class="highlight">caret_pos</td>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
<td class="normal">R</td>
|
393
|
+
</tr>
|
394
|
+
<tr>
|
395
|
+
<td class="highlight">selection_start</td>
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
<td class="normal">R</td>
|
401
|
+
</tr>
|
402
|
+
<tr>
|
403
|
+
<td class="highlight">text</td>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
<td class="normal">RW</td>
|
409
|
+
</tr>
|
410
|
+
</table></p>
|
411
|
+
|
412
|
+
|
413
|
+
<h1>Public Instance Methods</h1>
|
414
|
+
|
415
|
+
|
416
|
+
<a class="small" name="M000065"><br/></a>
|
417
|
+
<div class="method_block"><h3>
|
418
|
+
<a href='#M000065'>
|
419
|
+
|
420
|
+
|
421
|
+
filter
|
422
|
+
|
423
|
+
(text_in)
|
424
|
+
|
425
|
+
</a>
|
426
|
+
</h3>
|
427
|
+
<p>
|
428
|
+
Overridable <a href="TextInput.html#M000065">filter</a> that is applied to
|
429
|
+
all new text that is entered. Allows for context-sensitive
|
430
|
+
filtering/extending/… of the text. The text will be inserted at
|
431
|
+
caretPos afterwards.
|
432
|
+
</p>
|
433
|
+
|
434
|
+
<p class="source_link" id="M000065-show-link"><a href="#" onclick="toggle('M000065-source'); toggleText('M000065-link'); return false;" id="M000065-link">Show source...</a></p><div class="source" id="M000065-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 350</span>
|
435
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">filter</span> <span class="ruby-identifier">text_in</span>
|
436
|
+
<span class="ruby-identifier">text_in</span>
|
437
|
+
<span class="ruby-keyword kw">end</span></pre></div>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
</div><div class="clear" id="footer">Allison 2 © 2007 <a href="http://cloudbur.st">Cloudburst, LLC</a><br/>slightly adapted for the Gosu project by Julian Raschke</div></div></body></html>
|
@@ -0,0 +1,911 @@
|
|
1
|
+
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Class: Gosu::Window</title><link type="text/css" href="../.././rdoc-style.css" rel="stylesheet" media="screen"/><script type="text/javascript">
|
2
|
+
// Allison template
|
3
|
+
// Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file.
|
4
|
+
|
5
|
+
var href_base = '../.././rdoc-style.css'.replace(/(.*\/).*/, '$1'); // inline js is good for something
|
6
|
+
|
7
|
+
function $(id) {
|
8
|
+
if (document.getElementById)
|
9
|
+
elem = document.getElementById(id);
|
10
|
+
else if ( document.all )
|
11
|
+
elem = eval("document.all." + id);
|
12
|
+
else
|
13
|
+
return false;
|
14
|
+
return elem;
|
15
|
+
}
|
16
|
+
|
17
|
+
function toggle(id) {
|
18
|
+
elem = $(id);
|
19
|
+
elemStyle = elem.style;
|
20
|
+
if (elemStyle.display == "block") {
|
21
|
+
elemStyle.display = "none"
|
22
|
+
} else {
|
23
|
+
elemStyle.display = "block"
|
24
|
+
}
|
25
|
+
return true;
|
26
|
+
}
|
27
|
+
|
28
|
+
function toggleText(id) {
|
29
|
+
elem = $(id)
|
30
|
+
if (m = elem.innerHTML.match(/(Hide)(.*)/)) {
|
31
|
+
elem.innerHTML = "Show" + m[2];
|
32
|
+
} else if (m = elem.innerHTML.match(/(Show)(.*)/)) {
|
33
|
+
elem.innerHTML = "Hide" + m[2];
|
34
|
+
}
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
function span(s, klass) {
|
39
|
+
return '<span class="' + klass + '">' + s + '</span>';
|
40
|
+
}
|
41
|
+
|
42
|
+
function highlightSymbols() {
|
43
|
+
pres = document.getElementsByTagName('pre');
|
44
|
+
for(var i = 0; i < pres.length; i++) {
|
45
|
+
pre = pres[i];
|
46
|
+
spans = pre.getElementsByTagName('span');
|
47
|
+
for(var k = 0; k < spans.length; k++) {
|
48
|
+
span = spans[k];
|
49
|
+
if (span.className.match(/ruby-identifier/)) {
|
50
|
+
if (span.innerHTML.match(/^:/)) {
|
51
|
+
span.className += " ruby-symbol";
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
function hasClass(obj) {
|
59
|
+
var result = false;
|
60
|
+
if (obj.getAttributeNode("class") != null) {
|
61
|
+
result = obj.getAttributeNode("class").value;
|
62
|
+
}
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
66
|
+
function stripe() {
|
67
|
+
var even = true;
|
68
|
+
var color = "#e4ebed";
|
69
|
+
var tables = document.getElementsByTagName('table');
|
70
|
+
if (tables.length == 0) { return; }
|
71
|
+
for (var h = 0; h < tables.length; h++) {
|
72
|
+
var trs = tables[h].getElementsByTagName("tr");
|
73
|
+
for (var i = 0; i < trs.length; i++) {
|
74
|
+
var tds = trs[i].getElementsByTagName("td");
|
75
|
+
for (var j = 0; j < tds.length; j++) {
|
76
|
+
if (hasClass(tds[j]) != "first") {
|
77
|
+
var mytd = tds[j];
|
78
|
+
if (even) {
|
79
|
+
mytd.style.backgroundColor = color;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
even = ! even;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
function ajaxGet(url) {
|
89
|
+
url = (href_base + url).replace('/./', '/')
|
90
|
+
var req = false;
|
91
|
+
|
92
|
+
if (window.ActiveXObject) {
|
93
|
+
try {
|
94
|
+
// stupid hack because IE7 disables local Ajax with the native xmlhttprequest object
|
95
|
+
// for security purposes. Yet ActiveX still works. Thanks, Microsoft. I hate you. Die.
|
96
|
+
req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
|
97
|
+
} catch (e) {
|
98
|
+
try {
|
99
|
+
/* IE 6 and maybe 5, don't know, don't care */
|
100
|
+
req = new ActiveXObject("Msxml2.XMLHTTP");
|
101
|
+
} catch (e) {
|
102
|
+
try {
|
103
|
+
req = new ActiveXObject("Microsoft.XMLHTTP");
|
104
|
+
} catch (e) {
|
105
|
+
req = false;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
/* real browsers */
|
112
|
+
if (!req && window.XMLHttpRequest) {
|
113
|
+
try {
|
114
|
+
req = new XMLHttpRequest();
|
115
|
+
} catch (e) {
|
116
|
+
req = false;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
if (req) {
|
121
|
+
req.open('GET', url, false);
|
122
|
+
req.send(null);
|
123
|
+
return req.responseText;
|
124
|
+
} else {
|
125
|
+
return "Ajax error";
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
function addEvent(elm, evType, fn, useCapture) {
|
131
|
+
if (elm.addEventListener) {
|
132
|
+
elm.addEventListener(evType, fn, useCapture);
|
133
|
+
return true;
|
134
|
+
} else if (elm.attachEvent) {
|
135
|
+
var r = elm.attachEvent('on' + evType, fn);
|
136
|
+
return r;
|
137
|
+
} else {
|
138
|
+
elm['on' + evType] = fn;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
function insertIndices() {
|
143
|
+
pages = ["class", "file", "method"]
|
144
|
+
for (x in pages) {
|
145
|
+
$(pages[x]).innerHTML += ajaxGet('fr_' + pages[x] + '_index.html').replace(/(href=")/g, '$1' + href_base);
|
146
|
+
}
|
147
|
+
/* mouseoverify method links */
|
148
|
+
links = $('method').getElementsByTagName('a');
|
149
|
+
for (var x = 0; x < links.length; x++) {
|
150
|
+
if (m = links[x].innerHTML.match(/(.*)\s\((.*)\)/)) {
|
151
|
+
links[x].innerHTML = m[1] + '<br>';
|
152
|
+
links[x].title = m[2];
|
153
|
+
}
|
154
|
+
}
|
155
|
+
/* this is stupid */
|
156
|
+
$('class').style.display = "block";
|
157
|
+
$('file').style.display = "block";
|
158
|
+
|
159
|
+
/* has to be here because IE7 does not guarantee the onLoad callback order */
|
160
|
+
abbreviateIndicesInner(["class", "file"], 25, "a");
|
161
|
+
/* same, linkTitle() depends on the class link list */
|
162
|
+
linkTitle();
|
163
|
+
}
|
164
|
+
|
165
|
+
function abbreviateIndices() {
|
166
|
+
var ids = ["defined_in", "child_of", "includes", "requires", "method", "methods"];
|
167
|
+
abbreviateIndicesInner(ids, 25, 'a');
|
168
|
+
abbreviateIndicesInner(ids, 25, 'span');
|
169
|
+
}
|
170
|
+
|
171
|
+
function abbreviateIndicesInner(indices, amount, tag) {
|
172
|
+
for (var x = 0; x < indices.length; x++) {
|
173
|
+
var the_index = $(indices[x]);
|
174
|
+
if (the_index) {
|
175
|
+
links = the_index.getElementsByTagName(tag);
|
176
|
+
for (var y = 0; y < links.length; y++) {
|
177
|
+
var link = links[y];
|
178
|
+
if (link.getElementsByTagName('span').length == 0 && link.getElementsByTagName('a').length == 0) {
|
179
|
+
// avoid nesting
|
180
|
+
link.innerHTML = link.innerHTML.replace(/<br>|\n/gi, '');
|
181
|
+
link.title = link.innerHTML;
|
182
|
+
link.innerHTML = abbreviate(link.innerHTML, amount) + '<br>';
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
function linkTitle() {
|
190
|
+
|
191
|
+
/* grab the correct title element from the index */
|
192
|
+
var index_page = ajaxGet('index.html');
|
193
|
+
title_text = index_page.match(/<title>(.*)<\/title>/m)[1];
|
194
|
+
document.title = title_text + " - " + document.title;
|
195
|
+
var p = $('header').getElementsByTagName('p')[0]
|
196
|
+
if (p.innerHTML.match(/^\s*$/)) {
|
197
|
+
p.innerHTML = title_text;
|
198
|
+
} else {
|
199
|
+
p.innerHTML = title_text + ": " + p.innerHTML;
|
200
|
+
}
|
201
|
+
|
202
|
+
/* set the link properly */
|
203
|
+
title_link = index_page.match(/<a\s+href="(.*?)"/)[1];
|
204
|
+
var element = $('title');
|
205
|
+
var item_type = "";
|
206
|
+
var item_name = "";
|
207
|
+
if (m = element.innerHTML.match(/(Class:|Module:|File:)\s*(.*)/)) {
|
208
|
+
item_type = m[1];
|
209
|
+
item_name = m[2];
|
210
|
+
} else {
|
211
|
+
item_name = element.innerHTML;
|
212
|
+
}
|
213
|
+
element.innerHTML = '<a href="' + href_base + title_link + '">' + item_type + " " + abbreviate(item_name, 45) + '</a>';
|
214
|
+
element.getElementsByTagName('a')[0].title = item_name
|
215
|
+
|
216
|
+
/* breadcrumb navigation */
|
217
|
+
items = item_name.split("::");
|
218
|
+
items_new = item_name.split("::");
|
219
|
+
file_links = $('class').getElementsByTagName('a');
|
220
|
+
for (var x = 0; x < items.length - 1; x++ ){
|
221
|
+
var item = items[x];
|
222
|
+
link = ("/classes/" + items.slice(0,x).join("/") + "/" + item + ".html").replace('//', '/');
|
223
|
+
regex = new RegExp(RegExp.escape(link) + '$');
|
224
|
+
for (var y = 0; y < file_links.length; y++) {
|
225
|
+
if (file_links[y].href.match(regex)) {
|
226
|
+
items_new[x] = '<a href="' + href_base + link + '">' + item + '</a>';
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
$('item_name').innerHTML = item_type + ' ' + items_new.join(" :: ");
|
232
|
+
}
|
233
|
+
|
234
|
+
function abbreviate(s, size) {
|
235
|
+
// Try to get rid of path and extension in any case. These are not
|
236
|
+
// even interesting if there is enough space.
|
237
|
+
|
238
|
+
s = s.replace(/\..*$/, '');
|
239
|
+
s = s.replace(/.*\//g, '');
|
240
|
+
|
241
|
+
// Now this is a blatant hack.
|
242
|
+
|
243
|
+
if (s == 'gosu')
|
244
|
+
return ''; // Noone will ever see the link, harhar!
|
245
|
+
|
246
|
+
while (s.length > size) {
|
247
|
+
var old_s = s;
|
248
|
+
s = s.replace(/\s|\n/mg, '');
|
249
|
+
s = s.replace(/([A-Z])[a-z]+/m, '$1');
|
250
|
+
if (!s || old_s == s) {
|
251
|
+
return "..." + s.substring(s.length - size, s.length);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
return s;
|
255
|
+
}
|
256
|
+
|
257
|
+
function disableSubmit(event) {
|
258
|
+
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
259
|
+
if (keyCode == 13) {
|
260
|
+
return false;
|
261
|
+
} else {
|
262
|
+
return true;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
function filterList(id, s, event) {
|
267
|
+
|
268
|
+
/* some weak escaping */
|
269
|
+
s = s.replace(/[^\w\d\.\_\-\/\:\=\[\]\?\!]/g, '');
|
270
|
+
s = RegExp.escape(s);
|
271
|
+
|
272
|
+
var show_all = false;
|
273
|
+
if (s.match(/^\s*$/)) {
|
274
|
+
show_all = true;
|
275
|
+
}
|
276
|
+
|
277
|
+
links = $(id).getElementsByTagName('a')
|
278
|
+
regex = new RegExp(s, 'i');
|
279
|
+
|
280
|
+
for (var x = 0; x < links.length; x++) {
|
281
|
+
var link = links[x];
|
282
|
+
if (show_all) {
|
283
|
+
link.style.display = 'inline';
|
284
|
+
} else {
|
285
|
+
if (link.innerHTML.match(regex)) {
|
286
|
+
link.style.display = 'inline';
|
287
|
+
} else {
|
288
|
+
link.style.display = 'none';
|
289
|
+
}
|
290
|
+
}
|
291
|
+
}
|
292
|
+
return true;
|
293
|
+
}
|
294
|
+
|
295
|
+
RegExp.escape = function(text) {
|
296
|
+
if (!arguments.callee.sRE) {
|
297
|
+
var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
|
298
|
+
arguments.callee.sRE = new RegExp(
|
299
|
+
'(\\' + specials.join('|\\') + ')', 'g'
|
300
|
+
);
|
301
|
+
}
|
302
|
+
return text.replace(arguments.callee.sRE, '\\$1');
|
303
|
+
}
|
304
|
+
|
305
|
+
function hacks() {
|
306
|
+
// show the spacer if necessary,
|
307
|
+
divs = document.getElementsByTagName('div');
|
308
|
+
for(var x = 0; x < divs.length; x++) {
|
309
|
+
if (divs[x].className && divs[x].className.match(/top/)) {
|
310
|
+
document.getElementById('spacer').style.display = 'block';
|
311
|
+
}
|
312
|
+
}
|
313
|
+
// remove extra colons from tables
|
314
|
+
tds = document.getElementsByTagName('td');
|
315
|
+
for(var x = 0; x < tds.length; x++) {
|
316
|
+
str = tds[x].innerHTML
|
317
|
+
if (str.charAt(str.length - 1) == ":") {
|
318
|
+
tds[x].innerHTML = str.slice(0, str.length - 1)
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
addEvent(window, 'load', insertIndices, false);
|
324
|
+
addEvent(window, 'load', abbreviateIndices, false);
|
325
|
+
addEvent(window, 'load', stripe, false);
|
326
|
+
addEvent(window, 'load', highlightSymbols, false);
|
327
|
+
addEvent(window, 'load', hacks, false);
|
328
|
+
</script></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div id="header"><span><h1 id="title">
|
329
|
+
Class: Gosu::Window
|
330
|
+
</h1></span></div><div class="clear"></div><div id="left">
|
331
|
+
<div class="navigation darker top" id="child_of"><h3>Child of</h3><span>
|
332
|
+
|
333
|
+
Object
|
334
|
+
</span></div>
|
335
|
+
|
336
|
+
<div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
|
337
|
+
|
338
|
+
<a href="../../files/reference/gosu_rb.html">reference/gosu.rb</a>
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
<div class="navigation top" id="methods"><h3>Methods</h3>
|
345
|
+
|
346
|
+
|
347
|
+
<a href='#M000041'>
|
348
|
+
button_down<br/>
|
349
|
+
</a>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
<a href='#M000046'>
|
355
|
+
button_down?<br/>
|
356
|
+
</a>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
<a href='#M000047'>
|
362
|
+
button_id_to_char<br/>
|
363
|
+
</a>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
<a href='#M000042'>
|
369
|
+
button_up<br/>
|
370
|
+
</a>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
<a href='#M000048'>
|
376
|
+
char_to_button_id<br/>
|
377
|
+
</a>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
<a href='#M000050'>
|
383
|
+
clip_to<br/>
|
384
|
+
</a>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
<a href='#M000036'>
|
390
|
+
close<br/>
|
391
|
+
</a>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
<a href='#M000038'>
|
397
|
+
draw<br/>
|
398
|
+
</a>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
<a href='#M000043'>
|
404
|
+
draw_line<br/>
|
405
|
+
</a>
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
<a href='#M000045'>
|
411
|
+
draw_quad<br/>
|
412
|
+
</a>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
<a href='#M000044'>
|
418
|
+
draw_triangle<br/>
|
419
|
+
</a>
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
<a href='#M000049'>
|
425
|
+
gl<br/>
|
426
|
+
</a>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
<a href='#M000039'>
|
432
|
+
needs_redraw?<br/>
|
433
|
+
</a>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
<a href='#M000034'>
|
439
|
+
new<br/>
|
440
|
+
</a>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<a href='#M000040'>
|
446
|
+
set_mouse_position<br/>
|
447
|
+
</a>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
<a href='#M000035'>
|
453
|
+
show<br/>
|
454
|
+
</a>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
<a href='#M000037'>
|
460
|
+
update<br/>
|
461
|
+
</a>
|
462
|
+
|
463
|
+
|
464
|
+
</div>
|
465
|
+
<div id="spacer"></div><div class="navigation darker index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter: </label><input type="text" onKeyUp="return filterList('class', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_class"></input></form></div></div><div class="navigation darker index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter: </label><input type="text" onKeyUp="return filterList('file', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_file"></input></form></div></div><div class="navigation darker index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter: </label><input type="text" onKeyUp="return filterList('method', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_method"></input></form></div></div></div><div id="content">
|
466
|
+
<div id="description"><p>
|
467
|
+
Main class that serves as the foundation of a standard <a
|
468
|
+
href="../Gosu.html">Gosu</a> application. Manages initialization of all of
|
469
|
+
<a href="../Gosu.html">Gosu</a>‘s core components and provides timing
|
470
|
+
functionality.
|
471
|
+
</p>
|
472
|
+
<p>
|
473
|
+
Note that all coordinates, even the mouse position, are in client
|
474
|
+
coordinates relative to the window. This means that the mouse position can
|
475
|
+
be negative or larger than the window size.
|
476
|
+
</p>
|
477
|
+
<p>
|
478
|
+
Note that you should really only use one instance of this class at the same
|
479
|
+
time. This may or may not change later.
|
480
|
+
</p>
|
481
|
+
<p>
|
482
|
+
Right now, having two or more windows and loading samples or songs on both
|
483
|
+
of them will result in an exception.
|
484
|
+
</p>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
<p></p>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
<h1>Attributes</h1><p><table><tr><th>Name</th><th>Read/write?</th></tr>
|
496
|
+
<tr>
|
497
|
+
<td class="highlight">caption</td>
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
<td class="normal">RW</td>
|
503
|
+
</tr>
|
504
|
+
<tr>
|
505
|
+
<td class="highlight">height</td>
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
<td class="normal">R</td>
|
511
|
+
</tr>
|
512
|
+
<tr>
|
513
|
+
<td class="highlight">mouse_x</td>
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
<td class="normal">RW</td>
|
519
|
+
</tr>
|
520
|
+
<tr>
|
521
|
+
<td class="highlight">mouse_y</td>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
<td class="normal">RW</td>
|
527
|
+
</tr>
|
528
|
+
<tr>
|
529
|
+
<td class="highlight">text_input</td>
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
<td class="normal">RW</td>
|
535
|
+
</tr>
|
536
|
+
<tr>
|
537
|
+
<td class="highlight">update_interval</td>
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
<td class="normal">R</td>
|
543
|
+
</tr>
|
544
|
+
<tr>
|
545
|
+
<td class="highlight">width</td>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
<td class="normal">R</td>
|
551
|
+
</tr>
|
552
|
+
</table></p>
|
553
|
+
|
554
|
+
|
555
|
+
<h1>Public Class Methods</h1>
|
556
|
+
|
557
|
+
|
558
|
+
<a class="small" name="M000047"><br/></a>
|
559
|
+
<div class="method_block"><h3>
|
560
|
+
<a href='#M000047'>
|
561
|
+
|
562
|
+
|
563
|
+
button_id_to_char
|
564
|
+
|
565
|
+
(id)
|
566
|
+
|
567
|
+
</a>
|
568
|
+
</h3>
|
569
|
+
<p>
|
570
|
+
DEPRECATED: Returns the character a button usually produces, or nil. Please
|
571
|
+
use <a href="TextInput.html">TextInput</a> instead.
|
572
|
+
</p>
|
573
|
+
|
574
|
+
<p class="source_link" id="M000047-show-link"><a href="#" onclick="toggle('M000047-source'); toggleText('M000047-link'); return false;" id="M000047-link">Show source...</a></p><div class="source" id="M000047-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 424</span>
|
575
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">button_id_to_char</span>(<span class="ruby-identifier">id</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
576
|
+
</div>
|
577
|
+
|
578
|
+
<a class="small" name="M000048"><br/></a>
|
579
|
+
<div class="method_block"><h3>
|
580
|
+
<a href='#M000048'>
|
581
|
+
|
582
|
+
|
583
|
+
char_to_button_id
|
584
|
+
|
585
|
+
(char)
|
586
|
+
|
587
|
+
</a>
|
588
|
+
</h3>
|
589
|
+
<p>
|
590
|
+
DEPRECATED: Returns the button that has to be pressed to produce the given
|
591
|
+
character, or nil. Please use <a href="TextInput.html">TextInput</a>
|
592
|
+
instead.
|
593
|
+
</p>
|
594
|
+
|
595
|
+
<p class="source_link" id="M000048-show-link"><a href="#" onclick="toggle('M000048-source'); toggleText('M000048-link'); return false;" id="M000048-link">Show source...</a></p><div class="source" id="M000048-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 428</span>
|
596
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">char_to_button_id</span>(<span class="ruby-identifier">char</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
597
|
+
</div>
|
598
|
+
|
599
|
+
<a class="small" name="M000034"><br/></a>
|
600
|
+
<div class="method_block"><h3>
|
601
|
+
<a href='#M000034'>
|
602
|
+
|
603
|
+
|
604
|
+
new
|
605
|
+
|
606
|
+
(width, height, fullscreen, update_interval = 16.666666)
|
607
|
+
|
608
|
+
</a>
|
609
|
+
</h3>
|
610
|
+
<table>
|
611
|
+
<tr><td valign="top">update_interval:</td><td>Interval in milliseconds between two calls
|
612
|
+
|
613
|
+
</td></tr>
|
614
|
+
</table>
|
615
|
+
<p>
|
616
|
+
to the <a href="Window.html#M000037">update</a> member function. The
|
617
|
+
default means the game will run at 60 FPS, which is ideal on standard 60 Hz
|
618
|
+
TFT screens.
|
619
|
+
</p>
|
620
|
+
|
621
|
+
<p class="source_link" id="M000034-show-link"><a href="#" onclick="toggle('M000034-source'); toggleText('M000034-link'); return false;" id="M000034-link">Show source...</a></p><div class="source" id="M000034-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 377</span>
|
622
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>, <span class="ruby-identifier">fullscreen</span>, <span class="ruby-identifier">update_interval</span> = <span class="ruby-value">16.666666</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
623
|
+
</div>
|
624
|
+
|
625
|
+
|
626
|
+
<h1>Public Instance Methods</h1>
|
627
|
+
|
628
|
+
|
629
|
+
<a class="small" name="M000041"><br/></a>
|
630
|
+
<div class="method_block"><h3>
|
631
|
+
<a href='#M000041'>
|
632
|
+
|
633
|
+
|
634
|
+
button_down
|
635
|
+
|
636
|
+
(id)
|
637
|
+
|
638
|
+
</a>
|
639
|
+
</h3>
|
640
|
+
<p>
|
641
|
+
Called before <a href="Window.html#M000037">update</a> when the user
|
642
|
+
pressed a button while the window had the focus.
|
643
|
+
</p>
|
644
|
+
|
645
|
+
<p class="source_link" id="M000041-show-link"><a href="#" onclick="toggle('M000041-source'); toggleText('M000041-link'); return false;" id="M000041-link">Show source...</a></p><div class="source" id="M000041-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 406</span>
|
646
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">button_down</span>(<span class="ruby-identifier">id</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
647
|
+
</div>
|
648
|
+
|
649
|
+
<a class="small" name="M000046"><br/></a>
|
650
|
+
<div class="method_block"><h3>
|
651
|
+
<a href='#M000046'>
|
652
|
+
|
653
|
+
|
654
|
+
button_down?
|
655
|
+
|
656
|
+
(id)
|
657
|
+
|
658
|
+
</a>
|
659
|
+
</h3>
|
660
|
+
<p>
|
661
|
+
Returns true if a button is currently pressed. Updated every tick.
|
662
|
+
</p>
|
663
|
+
|
664
|
+
<p class="source_link" id="M000046-show-link"><a href="#" onclick="toggle('M000046-source'); toggleText('M000046-link'); return false;" id="M000046-link">Show source...</a></p><div class="source" id="M000046-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 421</span>
|
665
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">button_down?</span>(<span class="ruby-identifier">id</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
<a class="small" name="M000042"><br/></a>
|
669
|
+
<div class="method_block"><h3>
|
670
|
+
<a href='#M000042'>
|
671
|
+
|
672
|
+
|
673
|
+
button_up
|
674
|
+
|
675
|
+
(id)
|
676
|
+
|
677
|
+
</a>
|
678
|
+
</h3>
|
679
|
+
<p>
|
680
|
+
Same as buttonDown. Called then the user released a button.
|
681
|
+
</p>
|
682
|
+
|
683
|
+
<p class="source_link" id="M000042-show-link"><a href="#" onclick="toggle('M000042-source'); toggleText('M000042-link'); return false;" id="M000042-link">Show source...</a></p><div class="source" id="M000042-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 408</span>
|
684
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">button_up</span>(<span class="ruby-identifier">id</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
<a class="small" name="M000050"><br/></a>
|
688
|
+
<div class="method_block"><h3>
|
689
|
+
<a href='#M000050'>
|
690
|
+
|
691
|
+
|
692
|
+
clip_to
|
693
|
+
|
694
|
+
(x, y, w, h, &drawing_code)
|
695
|
+
|
696
|
+
</a>
|
697
|
+
</h3>
|
698
|
+
<p>
|
699
|
+
Limits the drawing area to a given rectangle while evaluating the code
|
700
|
+
inside of the block.
|
701
|
+
</p>
|
702
|
+
|
703
|
+
<p class="source_link" id="M000050-show-link"><a href="#" onclick="toggle('M000050-source'); toggleText('M000050-link'); return false;" id="M000050-link">Show source...</a></p><div class="source" id="M000050-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 434</span>
|
704
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clip_to</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">w</span>, <span class="ruby-identifier">h</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">drawing_code</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
705
|
+
</div>
|
706
|
+
|
707
|
+
<a class="small" name="M000036"><br/></a>
|
708
|
+
<div class="method_block"><h3>
|
709
|
+
<a href='#M000036'>
|
710
|
+
|
711
|
+
|
712
|
+
close
|
713
|
+
|
714
|
+
()
|
715
|
+
|
716
|
+
</a>
|
717
|
+
</h3>
|
718
|
+
<p>
|
719
|
+
Tells the window to end the current <a href="Window.html#M000035">show</a>
|
720
|
+
loop as soon as possible.
|
721
|
+
</p>
|
722
|
+
|
723
|
+
<p class="source_link" id="M000036-show-link"><a href="#" onclick="toggle('M000036-source'); toggleText('M000036-link'); return false;" id="M000036-link">Show source...</a></p><div class="source" id="M000036-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 383</span>
|
724
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>; <span class="ruby-keyword kw">end</span></pre></div>
|
725
|
+
</div>
|
726
|
+
|
727
|
+
<a class="small" name="M000038"><br/></a>
|
728
|
+
<div class="method_block"><h3>
|
729
|
+
<a href='#M000038'>
|
730
|
+
|
731
|
+
|
732
|
+
draw
|
733
|
+
|
734
|
+
()
|
735
|
+
|
736
|
+
</a>
|
737
|
+
</h3>
|
738
|
+
<p>
|
739
|
+
Called after every <a href="Window.html#M000037">update</a> and when the OS
|
740
|
+
wants the window to repaint itself. Your application‘s rendering code
|
741
|
+
goes here.
|
742
|
+
</p>
|
743
|
+
|
744
|
+
<p class="source_link" id="M000038-show-link"><a href="#" onclick="toggle('M000038-source'); toggleText('M000038-link'); return false;" id="M000038-link">Show source...</a></p><div class="source" id="M000038-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 391</span>
|
745
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw</span>; <span class="ruby-keyword kw">end</span></pre></div>
|
746
|
+
</div>
|
747
|
+
|
748
|
+
<a class="small" name="M000043"><br/></a>
|
749
|
+
<div class="method_block"><h3>
|
750
|
+
<a href='#M000043'>
|
751
|
+
|
752
|
+
|
753
|
+
draw_line
|
754
|
+
|
755
|
+
(x1, y1, c1, x2, y2, c2, z=0, mode=:default)
|
756
|
+
|
757
|
+
</a>
|
758
|
+
</h3>
|
759
|
+
<p>
|
760
|
+
Draws a line from one point to another (last pixel exclusive).
|
761
|
+
</p>
|
762
|
+
|
763
|
+
<p class="source_link" id="M000043-show-link"><a href="#" onclick="toggle('M000043-source'); toggleText('M000043-link'); return false;" id="M000043-link">Show source...</a></p><div class="source" id="M000043-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 411</span>
|
764
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_line</span>(<span class="ruby-identifier">x1</span>, <span class="ruby-identifier">y1</span>, <span class="ruby-identifier">c1</span>, <span class="ruby-identifier">x2</span>, <span class="ruby-identifier">y2</span>, <span class="ruby-identifier">c2</span>, <span class="ruby-identifier">z</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:default</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
765
|
+
</div>
|
766
|
+
|
767
|
+
<a class="small" name="M000045"><br/></a>
|
768
|
+
<div class="method_block"><h3>
|
769
|
+
<a href='#M000045'>
|
770
|
+
|
771
|
+
|
772
|
+
draw_quad
|
773
|
+
|
774
|
+
(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z=0, mode=:default)
|
775
|
+
|
776
|
+
</a>
|
777
|
+
</h3>
|
778
|
+
<p>
|
779
|
+
Draws a rectangle (two triangles) with given corners and corresponding
|
780
|
+
colors. The points can be in clockwise order, or in a Z shape.
|
781
|
+
</p>
|
782
|
+
|
783
|
+
<p class="source_link" id="M000045-show-link"><a href="#" onclick="toggle('M000045-source'); toggleText('M000045-link'); return false;" id="M000045-link">Show source...</a></p><div class="source" id="M000045-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 418</span>
|
784
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_quad</span>(<span class="ruby-identifier">x1</span>, <span class="ruby-identifier">y1</span>, <span class="ruby-identifier">c1</span>, <span class="ruby-identifier">x2</span>, <span class="ruby-identifier">y2</span>, <span class="ruby-identifier">c2</span>, <span class="ruby-identifier">x3</span>, <span class="ruby-identifier">y3</span>, <span class="ruby-identifier">c3</span>, <span class="ruby-identifier">x4</span>, <span class="ruby-identifier">y4</span>, <span class="ruby-identifier">c4</span>, <span class="ruby-identifier">z</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:default</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
785
|
+
</div>
|
786
|
+
|
787
|
+
<a class="small" name="M000044"><br/></a>
|
788
|
+
<div class="method_block"><h3>
|
789
|
+
<a href='#M000044'>
|
790
|
+
|
791
|
+
|
792
|
+
draw_triangle
|
793
|
+
|
794
|
+
(x1, y1, c1, x2, y2, c2, x3, y3, c3, z=0, mode=:default)
|
795
|
+
|
796
|
+
</a>
|
797
|
+
</h3>
|
798
|
+
|
799
|
+
<p class="source_link" id="M000044-show-link"><a href="#" onclick="toggle('M000044-source'); toggleText('M000044-link'); return false;" id="M000044-link">Show source...</a></p><div class="source" id="M000044-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 413</span>
|
800
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_triangle</span>(<span class="ruby-identifier">x1</span>, <span class="ruby-identifier">y1</span>, <span class="ruby-identifier">c1</span>, <span class="ruby-identifier">x2</span>, <span class="ruby-identifier">y2</span>, <span class="ruby-identifier">c2</span>, <span class="ruby-identifier">x3</span>, <span class="ruby-identifier">y3</span>, <span class="ruby-identifier">c3</span>, <span class="ruby-identifier">z</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:default</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
801
|
+
</div>
|
802
|
+
|
803
|
+
<a class="small" name="M000049"><br/></a>
|
804
|
+
<div class="method_block"><h3>
|
805
|
+
<a href='#M000049'>
|
806
|
+
|
807
|
+
|
808
|
+
gl
|
809
|
+
|
810
|
+
(&custom_gl_code)
|
811
|
+
|
812
|
+
</a>
|
813
|
+
</h3>
|
814
|
+
<p>
|
815
|
+
See examples/OpenGLIntegration.rb.
|
816
|
+
</p>
|
817
|
+
|
818
|
+
<p class="source_link" id="M000049-show-link"><a href="#" onclick="toggle('M000049-source'); toggleText('M000049-link'); return false;" id="M000049-link">Show source...</a></p><div class="source" id="M000049-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 431</span>
|
819
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gl</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">custom_gl_code</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
820
|
+
</div>
|
821
|
+
|
822
|
+
<a class="small" name="M000039"><br/></a>
|
823
|
+
<div class="method_block"><h3>
|
824
|
+
<a href='#M000039'>
|
825
|
+
|
826
|
+
|
827
|
+
needs_redraw?
|
828
|
+
|
829
|
+
()
|
830
|
+
|
831
|
+
</a>
|
832
|
+
</h3>
|
833
|
+
<p>
|
834
|
+
Can be overriden to give the game a chance to say no to being redrawn. This
|
835
|
+
is not a definitive answer. The operating system can still cause redraws
|
836
|
+
for one reason or another.
|
837
|
+
</p>
|
838
|
+
<p>
|
839
|
+
By default, the window is redrawn all the time (i.e. Window#needs_redraw?
|
840
|
+
always returns true.)
|
841
|
+
</p>
|
842
|
+
|
843
|
+
<p class="source_link" id="M000039-show-link"><a href="#" onclick="toggle('M000039-source'); toggleText('M000039-link'); return false;" id="M000039-link">Show source...</a></p><div class="source" id="M000039-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 399</span>
|
844
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">needs_redraw?</span>; <span class="ruby-keyword kw">end</span></pre></div>
|
845
|
+
</div>
|
846
|
+
|
847
|
+
<a class="small" name="M000040"><br/></a>
|
848
|
+
<div class="method_block"><h3>
|
849
|
+
<a href='#M000040'>
|
850
|
+
|
851
|
+
|
852
|
+
set_mouse_position
|
853
|
+
|
854
|
+
(x, y)
|
855
|
+
|
856
|
+
</a>
|
857
|
+
</h3>
|
858
|
+
<p>
|
859
|
+
DEPRECATED.
|
860
|
+
</p>
|
861
|
+
|
862
|
+
<p class="source_link" id="M000040-show-link"><a href="#" onclick="toggle('M000040-source'); toggleText('M000040-link'); return false;" id="M000040-link">Show source...</a></p><div class="source" id="M000040-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 402</span>
|
863
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_mouse_position</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>); <span class="ruby-keyword kw">end</span></pre></div>
|
864
|
+
</div>
|
865
|
+
|
866
|
+
<a class="small" name="M000035"><br/></a>
|
867
|
+
<div class="method_block"><h3>
|
868
|
+
<a href='#M000035'>
|
869
|
+
|
870
|
+
|
871
|
+
show
|
872
|
+
|
873
|
+
()
|
874
|
+
|
875
|
+
</a>
|
876
|
+
</h3>
|
877
|
+
<p>
|
878
|
+
Enters a modal loop where the <a href="Window.html">Window</a> is visible
|
879
|
+
on screen and receives calls to <a href="Window.html#M000038">draw</a>, <a
|
880
|
+
href="Window.html#M000037">update</a> etc.
|
881
|
+
</p>
|
882
|
+
|
883
|
+
<p class="source_link" id="M000035-show-link"><a href="#" onclick="toggle('M000035-source'); toggleText('M000035-link'); return false;" id="M000035-link">Show source...</a></p><div class="source" id="M000035-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 380</span>
|
884
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>; <span class="ruby-keyword kw">end</span></pre></div>
|
885
|
+
</div>
|
886
|
+
|
887
|
+
<a class="small" name="M000037"><br/></a>
|
888
|
+
<div class="method_block"><h3>
|
889
|
+
<a href='#M000037'>
|
890
|
+
|
891
|
+
|
892
|
+
update
|
893
|
+
|
894
|
+
()
|
895
|
+
|
896
|
+
</a>
|
897
|
+
</h3>
|
898
|
+
<p>
|
899
|
+
Called every update_interval milliseconds while the window is being shown.
|
900
|
+
Your application‘s main game logic goes here.
|
901
|
+
</p>
|
902
|
+
|
903
|
+
<p class="source_link" id="M000037-show-link"><a href="#" onclick="toggle('M000037-source'); toggleText('M000037-link'); return false;" id="M000037-link">Show source...</a></p><div class="source" id="M000037-source"><pre><span class="ruby-comment cmt"># File reference/gosu.rb, line 387</span>
|
904
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>; <span class="ruby-keyword kw">end</span></pre></div>
|
905
|
+
</div>
|
906
|
+
|
907
|
+
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
</div><div class="clear" id="footer">Allison 2 © 2007 <a href="http://cloudbur.st">Cloudburst, LLC</a><br/>slightly adapted for the Gosu project by Julian Raschke</div></div></body></html>
|