gosu 0.7.18 → 0.7.19
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.txt +1 -1
- data/Gosu/GraphicsBase.hpp +4 -2
- data/Gosu/IO.hpp +2 -9
- data/Gosu/Math.hpp +8 -6
- data/Gosu/Version.hpp +2 -2
- data/GosuImpl/Graphics/Common.hpp +4 -3
- data/GosuImpl/Graphics/DrawOp.hpp +4 -0
- data/GosuImpl/Graphics/Graphics.cpp +1 -1
- data/GosuImpl/Graphics/Image.cpp +1 -1
- data/GosuImpl/Graphics/LargeImageData.cpp +1 -1
- data/GosuImpl/Graphics/TexChunk.cpp +1 -1
- data/GosuImpl/Graphics/TextTouch.mm +79 -8
- data/GosuImpl/Graphics/Texture.cpp +15 -1
- data/GosuImpl/IO.cpp +10 -0
- data/GosuImpl/InputTouch.mm +10 -1
- data/GosuImpl/RubyGosu.swg +7 -13
- data/GosuImpl/RubyGosu_wrap.cxx +52 -22
- data/GosuImpl/Sockets/CommSocket.cpp +4 -3
- data/GosuImpl/Sockets/ListenerSocket.cpp +0 -1
- data/GosuImpl/Sockets/MessageSocket.cpp +8 -16
- data/GosuImpl/Sockets/Sockets.hpp +0 -1
- data/GosuImpl/WindowTouch.mm +2 -1
- data/Rakefile +3 -2
- data/lib/gosu.rb +3 -0
- data/lib/gosu/patches.rb +13 -2
- data/lib/gosu/swig_patches.rb +21 -0
- data/linux/extconf.rb +1 -1
- data/reference/cpp/_graphics_base_8hpp.html +3 -2
- data/reference/cpp/_graphics_base_8hpp_source.html +31 -30
- data/reference/cpp/_i_o_8hpp_source.html +49 -56
- data/reference/cpp/_math_8hpp.html +6 -6
- data/reference/cpp/_math_8hpp_source.html +63 -63
- data/reference/cpp/_version_8hpp.html +4 -4
- data/reference/cpp/_version_8hpp_source.html +2 -2
- data/reference/cpp/class_gosu_1_1_buffer.html +2 -6
- data/reference/cpp/class_gosu_1_1_file.html +1 -1
- data/reference/cpp/namespace_gosu.html +60 -57
- data/reference/cpp/namespacemembers.html +2 -0
- data/reference/cpp/namespacemembers_0x62.html +2 -2
- data/reference/cpp/namespacemembers_0x64.html +2 -0
- data/reference/cpp/namespacemembers_0x67.html +0 -2
- data/reference/cpp/namespacemembers_0x72.html +2 -2
- data/reference/cpp/namespacemembers_eval.html +4 -2
- data/reference/cpp/namespacemembers_func.html +4 -4
- 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 +29 -11
- data/GosuImpl/ObjGosu/ObjGosu.mm +0 -36
- data/GosuImpl/ObjGosu/ObjGosuColor.mm +0 -84
- data/GosuImpl/ObjGosu/ObjGosuFont.mm +0 -42
- data/GosuImpl/ObjGosu/ObjGosuImage.h +0 -7
- data/GosuImpl/ObjGosu/ObjGosuImage.mm +0 -65
- data/GosuImpl/ObjGosu/ObjGosuSample.mm +0 -32
- data/GosuImpl/ObjGosu/ObjGosuSong.mm +0 -43
- data/GosuImpl/ObjGosu/ObjGosuWindow.h +0 -32
- data/GosuImpl/ObjGosu/ObjGosuWindow.mm +0 -155
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Raschke
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-
|
13
|
+
date: 2010-04-24 00:00:00 +08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- reference/cpp/tabs.css
|
272
272
|
- lib/gosu.rb
|
273
273
|
- lib/gosu/patches.rb
|
274
|
+
- lib/gosu/swig_patches.rb
|
274
275
|
- examples/ChipmunkIntegration.rb
|
275
276
|
- examples/CptnRuby.rb
|
276
277
|
- examples/MoreChipmunkAndRMagick.rb
|
@@ -278,6 +279,32 @@ files:
|
|
278
279
|
- examples/RMagickIntegration.rb
|
279
280
|
- examples/TextInput.rb
|
280
281
|
- examples/Tutorial.rb
|
282
|
+
- reference/rdoc/classes/Gosu/Color.html
|
283
|
+
- reference/rdoc/classes/Gosu/Font.html
|
284
|
+
- reference/rdoc/classes/Gosu/GLTexInfo.html
|
285
|
+
- reference/rdoc/classes/Gosu/Image.html
|
286
|
+
- reference/rdoc/classes/Gosu/Sample.html
|
287
|
+
- reference/rdoc/classes/Gosu/SampleInstance.html
|
288
|
+
- reference/rdoc/classes/Gosu/Song.html
|
289
|
+
- reference/rdoc/classes/Gosu/TextInput.html
|
290
|
+
- reference/rdoc/classes/Gosu/Window.html
|
291
|
+
- reference/rdoc/classes/Gosu.html
|
292
|
+
- reference/rdoc/classes/Numeric.html
|
293
|
+
- reference/rdoc/created.rid
|
294
|
+
- reference/rdoc/files/COPYING_txt.html
|
295
|
+
- reference/rdoc/files/README_txt.html
|
296
|
+
- reference/rdoc/files/reference/Deployment on OS X_rdoc.html
|
297
|
+
- reference/rdoc/files/reference/Deployment on Windows_rdoc.html
|
298
|
+
- reference/rdoc/files/reference/Drawing with Colors_rdoc.html
|
299
|
+
- reference/rdoc/files/reference/gosu_rb.html
|
300
|
+
- reference/rdoc/files/reference/Order of Corners_rdoc.html
|
301
|
+
- reference/rdoc/files/reference/Tileability_rdoc.html
|
302
|
+
- reference/rdoc/files/reference/Z Ordering_rdoc.html
|
303
|
+
- reference/rdoc/fr_class_index.html
|
304
|
+
- reference/rdoc/fr_file_index.html
|
305
|
+
- reference/rdoc/fr_method_index.html
|
306
|
+
- reference/rdoc/index.html
|
307
|
+
- reference/rdoc/rdoc-style.css
|
281
308
|
- Rakefile
|
282
309
|
- Gosu/Async.hpp
|
283
310
|
- Gosu/Audio.hpp
|
@@ -360,15 +387,6 @@ files:
|
|
360
387
|
- GosuImpl/IO.cpp
|
361
388
|
- GosuImpl/MacUtility.hpp
|
362
389
|
- GosuImpl/Math.cpp
|
363
|
-
- GosuImpl/ObjGosu/ObjGosu.mm
|
364
|
-
- GosuImpl/ObjGosu/ObjGosuColor.mm
|
365
|
-
- GosuImpl/ObjGosu/ObjGosuFont.mm
|
366
|
-
- GosuImpl/ObjGosu/ObjGosuImage.h
|
367
|
-
- GosuImpl/ObjGosu/ObjGosuImage.mm
|
368
|
-
- GosuImpl/ObjGosu/ObjGosuSample.mm
|
369
|
-
- GosuImpl/ObjGosu/ObjGosuSong.mm
|
370
|
-
- GosuImpl/ObjGosu/ObjGosuWindow.h
|
371
|
-
- GosuImpl/ObjGosu/ObjGosuWindow.mm
|
372
390
|
- GosuImpl/RubyGosu.swg
|
373
391
|
- GosuImpl/RubyGosu_DllMain.cxx
|
374
392
|
- GosuImpl/RubyGosu_SWIG_GC_PATCH.patch
|
data/GosuImpl/ObjGosu/ObjGosu.mm
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#import <Cocoa/Cocoa.h>
|
2
|
-
#import <Gosu/Math.hpp>
|
3
|
-
#import <Gosu/Text.hpp>
|
4
|
-
#import <Gosu/Timing.hpp>
|
5
|
-
#import <Gosu/Utility.hpp>
|
6
|
-
|
7
|
-
@interface ObjGosu : NSObject {
|
8
|
-
}
|
9
|
-
@end
|
10
|
-
|
11
|
-
@implementation ObjGosu
|
12
|
-
+ (float)offsetXWithAngle:(float)angle distance:(float)dist
|
13
|
-
{
|
14
|
-
return Gosu::offsetX(angle, dist);
|
15
|
-
}
|
16
|
-
|
17
|
-
+ (float)offsetYWithAngle:(float)angle distance:(float)dist
|
18
|
-
{
|
19
|
-
return Gosu::offsetY(angle, dist);
|
20
|
-
}
|
21
|
-
|
22
|
-
+ (float)distanceFromX:(float)x1 y:(float)y1 toX:(float)x2 y:(float)y2
|
23
|
-
{
|
24
|
-
return Gosu::distance(x1, y1, x2, y2);
|
25
|
-
}
|
26
|
-
|
27
|
-
+ (unsigned)milliseconds
|
28
|
-
{
|
29
|
-
return Gosu::milliseconds();
|
30
|
-
}
|
31
|
-
|
32
|
-
+ (NSString*)defaultFontName
|
33
|
-
{
|
34
|
-
return [NSString stringWithUTF8String: Gosu::wstringToUTF8(Gosu::defaultFontName()).c_str()];
|
35
|
-
}
|
36
|
-
@end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
#import <Cocoa/Cocoa.h>
|
2
|
-
#import <Gosu/Color.hpp>
|
3
|
-
|
4
|
-
@interface ObjGosuColor : NSObject {
|
5
|
-
boost::uint32_t rep;
|
6
|
-
}
|
7
|
-
@end
|
8
|
-
|
9
|
-
@implementation ObjGosuColor
|
10
|
-
- (id)initWithARGB:(unsigned)argb
|
11
|
-
{
|
12
|
-
if (not (self = [super init]))
|
13
|
-
return NULL;
|
14
|
-
|
15
|
-
rep = argb;
|
16
|
-
|
17
|
-
return self;
|
18
|
-
}
|
19
|
-
|
20
|
-
- (id)initWithAlpha:(boost::uint8_t)alpha red:(boost::uint8_t)red
|
21
|
-
green:(boost::uint8_t)green blue:(boost::uint8_t)blue
|
22
|
-
{
|
23
|
-
if (not (self = [super init]))
|
24
|
-
return NULL;
|
25
|
-
|
26
|
-
rep = Gosu::Color(alpha, red, green, blue).argb();
|
27
|
-
|
28
|
-
return self;
|
29
|
-
}
|
30
|
-
|
31
|
-
- (boost::uint8_t)alpha
|
32
|
-
{
|
33
|
-
return Gosu::Color(rep).alpha();
|
34
|
-
}
|
35
|
-
|
36
|
-
- (void)setAlpha:(boost::uint8_t)alpha
|
37
|
-
{
|
38
|
-
Gosu::Color temp(rep);
|
39
|
-
temp.setAlpha(alpha);
|
40
|
-
rep = temp.argb();
|
41
|
-
}
|
42
|
-
|
43
|
-
- (boost::uint8_t)red
|
44
|
-
{
|
45
|
-
return Gosu::Color(rep).red();
|
46
|
-
}
|
47
|
-
|
48
|
-
- (void)setRed:(boost::uint8_t)red
|
49
|
-
{
|
50
|
-
Gosu::Color temp(rep);
|
51
|
-
temp.setRed(red);
|
52
|
-
rep = temp.argb();
|
53
|
-
}
|
54
|
-
|
55
|
-
- (boost::uint8_t)green
|
56
|
-
{
|
57
|
-
return Gosu::Color(rep).green();
|
58
|
-
}
|
59
|
-
|
60
|
-
- (void)setGreen:(boost::uint8_t)green
|
61
|
-
{
|
62
|
-
Gosu::Color temp(rep);
|
63
|
-
temp.setGreen(green);
|
64
|
-
rep = temp.argb();
|
65
|
-
}
|
66
|
-
|
67
|
-
- (boost::uint8_t)blue
|
68
|
-
{
|
69
|
-
return Gosu::Color(rep).blue();
|
70
|
-
}
|
71
|
-
|
72
|
-
- (void)setBlue:(boost::uint8_t)blue
|
73
|
-
{
|
74
|
-
Gosu::Color temp(rep);
|
75
|
-
temp.setBlue(blue);
|
76
|
-
rep = temp.argb();
|
77
|
-
}
|
78
|
-
|
79
|
-
- (boost::uint32_t)to_i
|
80
|
-
{
|
81
|
-
return rep;
|
82
|
-
}
|
83
|
-
|
84
|
-
@end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#import <Cocoa/Cocoa.h>
|
2
|
-
#import <Gosu/Font.hpp>
|
3
|
-
#import <Gosu/Utility.hpp>
|
4
|
-
#import <Gosu/Window.hpp>
|
5
|
-
|
6
|
-
@interface ObjGosuFont : NSObject {
|
7
|
-
Gosu::Font* _font;
|
8
|
-
}
|
9
|
-
@end
|
10
|
-
|
11
|
-
@implementation ObjGosuFont
|
12
|
-
- (int)height
|
13
|
-
{
|
14
|
-
return _font->height();
|
15
|
-
}
|
16
|
-
|
17
|
-
- (NSString*)name
|
18
|
-
{
|
19
|
-
return [NSString stringWithUTF8String:Gosu::wstringToUTF8(_font->name()).c_str()];
|
20
|
-
}
|
21
|
-
|
22
|
-
- (id)initWithWindow: (id)window fontName: (NSString*)fontName height: (int)height
|
23
|
-
{
|
24
|
-
if (not (self = [super init]))
|
25
|
-
return NULL;
|
26
|
-
|
27
|
-
_font = new Gosu::Font(((Gosu::Window*)[[window _objcObject] _cppObject])->graphics(),
|
28
|
-
Gosu::widen([fontName UTF8String]), height);
|
29
|
-
|
30
|
-
return self;
|
31
|
-
}
|
32
|
-
|
33
|
-
/*- (float)widthOfText: (NSString*)text
|
34
|
-
{
|
35
|
-
}*/
|
36
|
-
|
37
|
-
- (void)drawText: (NSString*)text atX:(float)x y:(float)y z:(float)z
|
38
|
-
factorX:(float)factorX factorY:(float)factorY color:(unsigned int)color
|
39
|
-
{
|
40
|
-
_font->draw(Gosu::widen([text UTF8String]), x, y, z, factorX, factorY, color);
|
41
|
-
}
|
42
|
-
@end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
#import "ObjGosuImage.h"
|
2
|
-
#import "ObjGosuWindow.h"
|
3
|
-
#import <Gosu/Image.hpp>
|
4
|
-
#import <Gosu/Utility.hpp>
|
5
|
-
#import <Gosu/Window.hpp>
|
6
|
-
#import <vector>
|
7
|
-
|
8
|
-
@implementation ObjGosuImage
|
9
|
-
- (int)width
|
10
|
-
{
|
11
|
-
return _image->width();
|
12
|
-
}
|
13
|
-
|
14
|
-
- (int)height
|
15
|
-
{
|
16
|
-
return _image->height();
|
17
|
-
}
|
18
|
-
|
19
|
-
- (id)initWithWindow:(id)window filename:(NSString*)filename tileable:(BOOL)tileable
|
20
|
-
{
|
21
|
-
if (not (self = [super init]))
|
22
|
-
return NULL;
|
23
|
-
|
24
|
-
_image = new Gosu::Image(((Gosu::Window*)[[window _objcObject] _cppObject])->graphics(),
|
25
|
-
Gosu::widen([filename UTF8String]), tileable);
|
26
|
-
|
27
|
-
return self;
|
28
|
-
}
|
29
|
-
|
30
|
-
- (id)initWithCPPObject:(Gosu::Image*)image
|
31
|
-
{
|
32
|
-
if (not (self = [super init]))
|
33
|
-
return NULL;
|
34
|
-
|
35
|
-
_image = image;
|
36
|
-
|
37
|
-
return self;
|
38
|
-
}
|
39
|
-
|
40
|
-
+ (NSMutableArray*)loadTilesWithWindow:(id)window filename:(NSString*)filename
|
41
|
-
tileWidth:(int)tileWidth tileHeight:(int)tileHeight tileable:(BOOL)tileable
|
42
|
-
{
|
43
|
-
std::vector<Gosu::Image*> images;
|
44
|
-
imagesFromTiledBitmap(((Gosu::Window*)[[window _objcObject] _cppObject])->graphics(),
|
45
|
-
Gosu::utf8ToWstring([filename UTF8String]), tileWidth, tileHeight, tileable, images);
|
46
|
-
|
47
|
-
NSMutableArray* array = [NSMutableArray arrayWithCapacity:images.size()];
|
48
|
-
for (int i = 0; i < images.size(); ++i)
|
49
|
-
[array insertObject:[[ObjGosuImage alloc] initWithCPPObject:images[i]] atIndex:i];
|
50
|
-
return array;
|
51
|
-
}
|
52
|
-
|
53
|
-
- (void)drawWithX: (float)x y:(float)y z:(float)z
|
54
|
-
factorX:(float)factorX factorY:(float)factorY color:(unsigned long)color
|
55
|
-
{
|
56
|
-
_image->draw(x, y, z, factorX, factorY, color);
|
57
|
-
}
|
58
|
-
|
59
|
-
- (void)drawRotWithX: (float)x y:(float)y z:(float)z angle:(float)angle
|
60
|
-
centerX:(float)centerX centerY:(float)centerY
|
61
|
-
factorX:(float)factorX factorY:(float)factorY color:(unsigned long)color
|
62
|
-
{
|
63
|
-
_image->drawRot(x, y, z, angle, centerX, centerY, factorX, factorY, color);
|
64
|
-
}
|
65
|
-
@end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#import <Cocoa/Cocoa.h>
|
2
|
-
#import <Gosu/Audio.hpp>
|
3
|
-
#import <Gosu/Utility.hpp>
|
4
|
-
#import <Gosu/Window.hpp>
|
5
|
-
|
6
|
-
@interface ObjGosuSample : NSObject {
|
7
|
-
Gosu::Sample* _sample;
|
8
|
-
}
|
9
|
-
@end
|
10
|
-
|
11
|
-
@implementation ObjGosuSample
|
12
|
-
- (id)initWithWindow:(id)window filename:(NSString*)filename
|
13
|
-
{
|
14
|
-
if (not (self = [super init]))
|
15
|
-
return NULL;
|
16
|
-
|
17
|
-
_sample = new Gosu::Sample(((Gosu::Window*)[[window _objcObject] _cppObject])->audio(),
|
18
|
-
Gosu::widen([filename UTF8String]));
|
19
|
-
|
20
|
-
return self;
|
21
|
-
}
|
22
|
-
|
23
|
-
- (void)playWithVolume: (float)volume speed:(float)speed looping:(BOOL)looping
|
24
|
-
{
|
25
|
-
_sample->play(volume, speed, looping);
|
26
|
-
}
|
27
|
-
|
28
|
-
- (void)playWithPan: (float)pan volume: (float)volume speed:(float)speed looping:(BOOL)looping
|
29
|
-
{
|
30
|
-
_sample->playPan(pan, volume, speed, looping);
|
31
|
-
}
|
32
|
-
@end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
#import <Cocoa/Cocoa.h>
|
2
|
-
#import <Gosu/Audio.hpp>
|
3
|
-
#import <Gosu/Utility.hpp>
|
4
|
-
#import <Gosu/Window.hpp>
|
5
|
-
|
6
|
-
@interface ObjGosuSong : NSObject {
|
7
|
-
Gosu::Song* _song;
|
8
|
-
}
|
9
|
-
@end
|
10
|
-
|
11
|
-
@implementation ObjGosuSong
|
12
|
-
- (id)initWithWindow:(id)window filename:(NSString*)filename
|
13
|
-
{
|
14
|
-
if (not (self = [super init]))
|
15
|
-
return NULL;
|
16
|
-
|
17
|
-
_song = new Gosu::Song(((Gosu::Window*)[[window _objcObject] _cppObject])->audio(),
|
18
|
-
Gosu::widen([filename UTF8String]));
|
19
|
-
|
20
|
-
return self;
|
21
|
-
}
|
22
|
-
|
23
|
-
- (void)playWithLoop: (BOOL)looping
|
24
|
-
{
|
25
|
-
_song->play(looping);
|
26
|
-
}
|
27
|
-
|
28
|
-
- (void)stop
|
29
|
-
{
|
30
|
-
_song->stop();
|
31
|
-
}
|
32
|
-
|
33
|
-
- (float)volume
|
34
|
-
{
|
35
|
-
_song->volume();
|
36
|
-
}
|
37
|
-
|
38
|
-
- (void)setVolume:(float)volume
|
39
|
-
{
|
40
|
-
_song->changeVolume(volume);
|
41
|
-
}
|
42
|
-
|
43
|
-
@end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#import <Cocoa/Cocoa.h>
|
2
|
-
#import <Gosu/Fwd.hpp>
|
3
|
-
|
4
|
-
class _ObjGosuInternalWindow;
|
5
|
-
|
6
|
-
@interface ObjGosuWindow : NSObject {
|
7
|
-
_ObjGosuInternalWindow* _window;
|
8
|
-
}
|
9
|
-
- (Gosu::Window*)_cppObject;
|
10
|
-
|
11
|
-
- (NSString*) caption;
|
12
|
-
- (void) setCaption: (NSString*) caption;
|
13
|
-
- (unsigned) height;
|
14
|
-
- (float) mouseX;
|
15
|
-
- (void) setMouseX: (float)mouseX;
|
16
|
-
- (float) mouseY;
|
17
|
-
- (void) setMouseY: (float)mouseY;
|
18
|
-
- (id) textInput;
|
19
|
-
- (void) setTextInput: (id)textInput;
|
20
|
-
- (float) updateInterval;
|
21
|
-
- (unsigned) width;
|
22
|
-
|
23
|
-
- (id) initWithDelegate:(id)delegate width:(int)width height:(int)height
|
24
|
-
inFullscreen:(BOOL)fullscreen updateInterval:(float)updateInterval;
|
25
|
-
- (void) show;
|
26
|
-
|
27
|
-
- (void) drawQuadAtX1: (float)x1 y1: (float)y1 color1:(unsigned)c1
|
28
|
-
x2: (float)x2 y2: (float)y2 color2:(unsigned)c2
|
29
|
-
x3: (float)x3 y3: (float)y3 color3:(unsigned)c3
|
30
|
-
x4: (float)x4 y4: (float)y4 color4:(unsigned)c4
|
31
|
-
z: (float)z mode: (int)mode;
|
32
|
-
@end
|
@@ -1,155 +0,0 @@
|
|
1
|
-
#import "ObjGosuWindow.h"
|
2
|
-
#import <Gosu/Graphics.hpp>
|
3
|
-
#import <Gosu/Input.hpp>
|
4
|
-
#import <Gosu/Utility.hpp>
|
5
|
-
#import <Gosu/Window.hpp>
|
6
|
-
#import <MacRuby/MacRuby.h>
|
7
|
-
|
8
|
-
class _ObjGosuInternalWindow : public Gosu::Window
|
9
|
-
{
|
10
|
-
id delegate;
|
11
|
-
|
12
|
-
public:
|
13
|
-
_ObjGosuInternalWindow(id delegate, unsigned width, unsigned height,
|
14
|
-
bool fullscreen, double updateInterval)
|
15
|
-
: Gosu::Window(width, height, fullscreen, updateInterval), delegate(delegate)
|
16
|
-
{
|
17
|
-
}
|
18
|
-
|
19
|
-
void update()
|
20
|
-
{
|
21
|
-
[delegate update];
|
22
|
-
}
|
23
|
-
|
24
|
-
void draw()
|
25
|
-
{
|
26
|
-
[delegate draw];
|
27
|
-
}
|
28
|
-
|
29
|
-
void buttonUp(Gosu::Button btn)
|
30
|
-
{
|
31
|
-
[delegate buttonUp: [NSNumber numberWithUnsignedInt: btn.getId()]];
|
32
|
-
}
|
33
|
-
|
34
|
-
void buttonDown(Gosu::Button btn)
|
35
|
-
{
|
36
|
-
[delegate buttonDown: [NSNumber numberWithUnsignedInt: btn.getId()]];
|
37
|
-
}
|
38
|
-
|
39
|
-
BOOL needsRedraw()
|
40
|
-
{
|
41
|
-
return [delegate needsRedraw] != nil;
|
42
|
-
}
|
43
|
-
};
|
44
|
-
|
45
|
-
@implementation ObjGosuWindow
|
46
|
-
- (Gosu::Window*)_cppObject
|
47
|
-
{
|
48
|
-
return _window;
|
49
|
-
}
|
50
|
-
|
51
|
-
- (NSString*)caption
|
52
|
-
{
|
53
|
-
return nil; // TODO_window->caption();
|
54
|
-
}
|
55
|
-
|
56
|
-
- (void)setCaption: (NSString*) caption
|
57
|
-
{
|
58
|
-
_window->setCaption(Gosu::utf8ToWstring([caption UTF8String]));
|
59
|
-
}
|
60
|
-
|
61
|
-
- (unsigned)height
|
62
|
-
{
|
63
|
-
return _window->graphics().height();
|
64
|
-
}
|
65
|
-
|
66
|
-
- (float)mouseX
|
67
|
-
{
|
68
|
-
return _window->input().mouseX();
|
69
|
-
}
|
70
|
-
|
71
|
-
- (void)setMouseX: (float)mouseX
|
72
|
-
{
|
73
|
-
_window->input().setMousePosition(mouseX, _window->input().mouseY());
|
74
|
-
}
|
75
|
-
|
76
|
-
- (float)mouseY
|
77
|
-
{
|
78
|
-
return _window->input().mouseY();
|
79
|
-
}
|
80
|
-
|
81
|
-
- (void)setMouseY: (float)mouseY
|
82
|
-
{
|
83
|
-
_window->input().setMousePosition(_window->input().mouseX(), mouseY);
|
84
|
-
}
|
85
|
-
|
86
|
-
- (id)textInput
|
87
|
-
{
|
88
|
-
// TODO
|
89
|
-
return nil;
|
90
|
-
}
|
91
|
-
|
92
|
-
- (void)setTextInput: (id)textInput
|
93
|
-
{
|
94
|
-
// TODO
|
95
|
-
}
|
96
|
-
|
97
|
-
- (float)updateInterval
|
98
|
-
{
|
99
|
-
return _window->updateInterval();
|
100
|
-
}
|
101
|
-
|
102
|
-
- (unsigned)width
|
103
|
-
{
|
104
|
-
return _window->graphics().width();
|
105
|
-
}
|
106
|
-
|
107
|
-
- (id)initWithDelegate: (id)delegate width:(int)width height:(int)height inFullscreen:(BOOL)fullscreen updateInterval:(float)updateInterval
|
108
|
-
{
|
109
|
-
if (not (self = [super init]))
|
110
|
-
return NULL;
|
111
|
-
_window = new _ObjGosuInternalWindow(delegate, width, height, fullscreen, updateInterval);
|
112
|
-
return self;
|
113
|
-
}
|
114
|
-
|
115
|
-
- (void)show
|
116
|
-
{
|
117
|
-
_window->show();
|
118
|
-
}
|
119
|
-
|
120
|
-
- (void)close
|
121
|
-
{
|
122
|
-
_window->close();
|
123
|
-
}
|
124
|
-
|
125
|
-
- (void)update
|
126
|
-
{
|
127
|
-
}
|
128
|
-
|
129
|
-
- (void)draw
|
130
|
-
{
|
131
|
-
}
|
132
|
-
|
133
|
-
- (NSNumber*)isButtonDown: (unsigned)button
|
134
|
-
{
|
135
|
-
return [NSNumber numberWithBool: _window->input().down(Gosu::Button(button))];
|
136
|
-
}
|
137
|
-
@end
|
138
|
-
|
139
|
-
extern "C" void Init_gosu()
|
140
|
-
{
|
141
|
-
// [[MacRuby sharedRuntime] evaluateString:
|
142
|
-
// @"module Gosu\n"
|
143
|
-
// @" class Window < ::ObjGosuWindow\n"
|
144
|
-
// @" def initialize(width, height, fullscreen, update_interval)\n"
|
145
|
-
// @" initWithWidth width, height: height, inFullscreen: fullscreen, updateInterval: update_interval\n"
|
146
|
-
// @" end\n"
|
147
|
-
// @" def mouse_x; mouseX; end\n"
|
148
|
-
// @" def mouse_y; mouseY; end\n"
|
149
|
-
// @" def draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode)\n"
|
150
|
-
// @" drawQuadAtX1(x1, y1: y1, color1: c1, x2: x2, y2: y2, color2: c2, x3: x3, y3: y3, color3: c3, x4: x4, y4: y4, color4: c4, z: z, mode: mode)\n"
|
151
|
-
// @" end\n"
|
152
|
-
// @" end\n"
|
153
|
-
// @"end\n"
|
154
|
-
// ];
|
155
|
-
}
|