gosu 0.13.3 → 0.14.0.pre2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gosu/Audio.hpp +15 -11
- data/Gosu/Font.hpp +24 -20
- data/Gosu/Fwd.hpp +1 -1
- data/Gosu/Graphics.hpp +8 -9
- data/Gosu/ImageData.hpp +1 -1
- data/Gosu/Input.hpp +1 -1
- data/Gosu/Math.hpp +0 -18
- data/Gosu/Text.hpp +22 -30
- data/Gosu/TextInput.hpp +13 -0
- data/Gosu/Utility.hpp +2 -0
- data/Gosu/Window.hpp +3 -3
- data/README.md +3 -4
- data/ext/gosu/extconf.rb +7 -9
- data/lib/gosu/swig_patches.rb +1 -4
- data/rdoc/gosu.rb +34 -9
- data/src/Audio.cpp +6 -6
- data/src/AudioImpl.cpp +2 -2
- data/src/Bitmap.cpp +1 -2
- data/src/BitmapIO.cpp +21 -2
- data/src/BlockAllocator.cpp +1 -1
- data/src/Channel.cpp +7 -1
- data/src/ClipRectStack.hpp +4 -1
- data/src/Color.cpp +2 -1
- data/src/DirectoriesWin.cpp +1 -1
- data/src/DrawOp.hpp +8 -4
- data/src/DrawOpQueue.hpp +13 -24
- data/src/FileUnix.cpp +3 -1
- data/src/Font.cpp +92 -96
- data/src/GosuGLView.cpp +59 -31
- data/src/GosuGLView.hpp +14 -0
- data/src/GosuViewController.cpp +21 -21
- data/src/{GosuViewController.h → GosuViewController.hpp} +2 -4
- data/src/Graphics.cpp +71 -38
- data/src/GraphicsImpl.hpp +12 -29
- data/src/Image.cpp +5 -7
- data/src/Input.cpp +7 -5
- data/src/InputUIKit.cpp +19 -37
- data/src/Macro.cpp +10 -2
- data/src/MarkupParser.cpp +241 -0
- data/src/MarkupParser.hpp +61 -0
- data/src/Math.cpp +1 -1
- data/src/OffScreenTarget.cpp +99 -0
- data/src/OffScreenTarget.hpp +23 -0
- data/src/OggFile.hpp +10 -0
- data/src/RenderState.hpp +0 -2
- data/src/Resolution.cpp +2 -2
- data/src/RubyGosu.cxx +457 -244
- data/src/TexChunk.cpp +8 -6
- data/src/Text.cpp +58 -345
- data/src/TextBuilder.cpp +138 -0
- data/src/TextBuilder.hpp +55 -0
- data/src/TextInput.cpp +27 -10
- data/src/Texture.cpp +22 -17
- data/src/Texture.hpp +19 -20
- data/src/TimingApple.cpp +5 -7
- data/src/TimingUnix.cpp +1 -4
- data/src/TimingWin.cpp +4 -1
- data/src/TrueTypeFont.cpp +282 -0
- data/src/TrueTypeFont.hpp +66 -0
- data/src/TrueTypeFontApple.cpp +65 -0
- data/src/TrueTypeFontUnix.cpp +91 -0
- data/src/TrueTypeFontWin.cpp +82 -0
- data/src/Utility.cpp +40 -0
- data/src/Window.cpp +7 -6
- data/src/WindowUIKit.cpp +9 -4
- data/src/stb_truetype.h +4589 -0
- data/src/utf8proc.c +755 -0
- data/src/utf8proc.h +699 -0
- data/src/utf8proc_data.h +14386 -0
- metadata +23 -16
- data/src/FormattedString.cpp +0 -237
- data/src/FormattedString.hpp +0 -47
- data/src/GosuAppDelegate.cpp +0 -30
- data/src/GosuAppDelegate.h +0 -8
- data/src/GosuGLView.h +0 -8
- data/src/TextApple.cpp +0 -212
- data/src/TextTTFWin.cpp +0 -197
- data/src/TextUnix.cpp +0 -280
- data/src/TextWin.cpp +0 -191
@@ -0,0 +1,61 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "GraphicsImpl.hpp"
|
4
|
+
#include <functional>
|
5
|
+
#include <vector>
|
6
|
+
|
7
|
+
namespace Gosu
|
8
|
+
{
|
9
|
+
struct FormattedString
|
10
|
+
{
|
11
|
+
std::u32string text;
|
12
|
+
Color color = Color::WHITE;
|
13
|
+
unsigned flags = 0;
|
14
|
+
|
15
|
+
bool can_be_merged_with(const FormattedString& other) const
|
16
|
+
{
|
17
|
+
return color == other.color && flags == other.flags;
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
class MarkupParser
|
22
|
+
{
|
23
|
+
// The current parser position.
|
24
|
+
const char* markup;
|
25
|
+
// A substring that will be built up during parsing, then passed to the consumer.
|
26
|
+
std::string substring;
|
27
|
+
|
28
|
+
// Current b/i/u counters. An opening tag increases by 1, a closing tag decreases by 1.
|
29
|
+
// Text is bold/italic/underline when the respective counter is > 0.
|
30
|
+
int b, i, u;
|
31
|
+
|
32
|
+
// Current color stack.
|
33
|
+
std::vector<Color> c{ Color::WHITE };
|
34
|
+
|
35
|
+
enum { IGNORE_WORDS, ADDING_WORD, ADDING_WHITESPACE } word_state;
|
36
|
+
std::vector<FormattedString> substrings;
|
37
|
+
std::function<void (std::vector<FormattedString>)> consumer;
|
38
|
+
|
39
|
+
unsigned flags() const;
|
40
|
+
|
41
|
+
template<size_t N>
|
42
|
+
bool match_and_skip(const char (&chars)[N])
|
43
|
+
{
|
44
|
+
return match_and_skip(chars, N - 1 /* do not match terminating zero */);
|
45
|
+
}
|
46
|
+
|
47
|
+
bool match_and_skip(const char* chars, std::size_t length);
|
48
|
+
|
49
|
+
bool parse_markup();
|
50
|
+
bool parse_escape_entity();
|
51
|
+
|
52
|
+
void add_current_substring();
|
53
|
+
void add_composed_substring(std::u32string&& substring);
|
54
|
+
void flush_to_consumer();
|
55
|
+
|
56
|
+
public:
|
57
|
+
MarkupParser(const char* markup, unsigned base_flags, bool split_words,
|
58
|
+
std::function<void (std::vector<FormattedString>)> consumer);
|
59
|
+
void parse();
|
60
|
+
};
|
61
|
+
}
|
data/src/Math.cpp
CHANGED
@@ -46,7 +46,7 @@ int Gosu::wrap(int value, int min, int max)
|
|
46
46
|
|
47
47
|
float Gosu::wrap(float value, float min, float max)
|
48
48
|
{
|
49
|
-
|
49
|
+
float result = fmodf(value - min, max - min);
|
50
50
|
return result < 0 ? result + max : result + min;
|
51
51
|
}
|
52
52
|
|
@@ -0,0 +1,99 @@
|
|
1
|
+
#include "OffScreenTarget.hpp"
|
2
|
+
#include "Texture.hpp"
|
3
|
+
#include <Gosu/Image.hpp>
|
4
|
+
#include <Gosu/Platform.hpp>
|
5
|
+
#ifndef GOSU_IS_IPHONE
|
6
|
+
#include <SDL.h>
|
7
|
+
#endif
|
8
|
+
using namespace std;
|
9
|
+
|
10
|
+
#ifdef GOSU_IS_OPENGLES
|
11
|
+
#define GOSU_LOAD_GL_EXT(fn, type) \
|
12
|
+
static auto fn = fn ## OES;
|
13
|
+
|
14
|
+
#define GOSU_GL_CONST(name) \
|
15
|
+
name ## _OES
|
16
|
+
|
17
|
+
#define GOSU_GL_DEPTH_COMPONENT \
|
18
|
+
GL_DEPTH_COMPONENT16_OES
|
19
|
+
#else
|
20
|
+
#define GOSU_LOAD_GL_EXT(fn, type) \
|
21
|
+
static auto fn = (type) SDL_GL_GetProcAddress(#fn); \
|
22
|
+
if (!fn) throw runtime_error("Unable to load " #fn);
|
23
|
+
|
24
|
+
#define GOSU_GL_CONST(name) \
|
25
|
+
name
|
26
|
+
|
27
|
+
#define GOSU_GL_DEPTH_COMPONENT \
|
28
|
+
GL_DEPTH_COMPONENT
|
29
|
+
#endif
|
30
|
+
|
31
|
+
Gosu::OffScreenTarget::OffScreenTarget(int width, int height)
|
32
|
+
{
|
33
|
+
#ifndef GOSU_IS_IPHONE
|
34
|
+
if (!SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
|
35
|
+
throw runtime_error("Missing GL_EXT_framebuffer_object extension");
|
36
|
+
}
|
37
|
+
#endif
|
38
|
+
|
39
|
+
// Create a new texture that will be our rendering target.
|
40
|
+
texture = make_shared<Texture>(width, height, false);
|
41
|
+
// Mark the full texture as blocked for our TexChunk.
|
42
|
+
texture->block(0, 0, width, height);
|
43
|
+
|
44
|
+
// Besides the texture, also create a renderbuffer for depth information.
|
45
|
+
// Gosu doesn't use this, but custom OpenGL code could might.
|
46
|
+
GOSU_LOAD_GL_EXT(glGenRenderbuffers, PFNGLGENRENDERBUFFERSPROC);
|
47
|
+
glGenRenderbuffers(1, &renderbuffer);
|
48
|
+
|
49
|
+
GOSU_LOAD_GL_EXT(glBindRenderbuffer, PFNGLBINDRENDERBUFFERPROC);
|
50
|
+
glBindRenderbuffer(GOSU_GL_CONST(GL_RENDERBUFFER), renderbuffer);
|
51
|
+
|
52
|
+
GOSU_LOAD_GL_EXT(glRenderbufferStorage, PFNGLRENDERBUFFERSTORAGEPROC);
|
53
|
+
glRenderbufferStorage(GOSU_GL_CONST(GL_RENDERBUFFER), GOSU_GL_DEPTH_COMPONENT, width, height);
|
54
|
+
glBindRenderbuffer(GOSU_GL_CONST(GL_RENDERBUFFER), 0);
|
55
|
+
|
56
|
+
// Now tie everything together.
|
57
|
+
GOSU_LOAD_GL_EXT(glGenFramebuffers, PFNGLGENFRAMEBUFFERSPROC);
|
58
|
+
glGenFramebuffers(1, &framebuffer);
|
59
|
+
|
60
|
+
GOSU_LOAD_GL_EXT(glBindFramebuffer, PFNGLBINDFRAMEBUFFERPROC);
|
61
|
+
glBindFramebuffer(GOSU_GL_CONST(GL_FRAMEBUFFER), framebuffer);
|
62
|
+
|
63
|
+
GOSU_LOAD_GL_EXT(glFramebufferTexture2D, PFNGLFRAMEBUFFERTEXTURE2DPROC);
|
64
|
+
glFramebufferTexture2D(GOSU_GL_CONST(GL_FRAMEBUFFER), GOSU_GL_CONST(GL_COLOR_ATTACHMENT0),
|
65
|
+
GL_TEXTURE_2D, texture->tex_name(), 0);
|
66
|
+
|
67
|
+
GOSU_LOAD_GL_EXT(glFramebufferRenderbuffer, PFNGLFRAMEBUFFERRENDERBUFFERPROC);
|
68
|
+
glFramebufferRenderbuffer(GOSU_GL_CONST(GL_FRAMEBUFFER), GOSU_GL_CONST(GL_DEPTH_ATTACHMENT),
|
69
|
+
GOSU_GL_CONST(GL_RENDERBUFFER), renderbuffer);
|
70
|
+
}
|
71
|
+
|
72
|
+
Gosu::OffScreenTarget::~OffScreenTarget()
|
73
|
+
{
|
74
|
+
try {
|
75
|
+
GOSU_LOAD_GL_EXT(glDeleteRenderbuffers, PFNGLDELETERENDERBUFFERSPROC);
|
76
|
+
glDeleteRenderbuffers(1, &renderbuffer);
|
77
|
+
|
78
|
+
GOSU_LOAD_GL_EXT(glDeleteFramebuffers, PFNGLDELETEFRAMEBUFFERSPROC);
|
79
|
+
glDeleteFramebuffers(1, &framebuffer);
|
80
|
+
} catch (...) {
|
81
|
+
// If we can't load these functions, just accept the resource leak.
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
Gosu::Image Gosu::OffScreenTarget::render(const std::function<void ()>& f)
|
86
|
+
{
|
87
|
+
GOSU_LOAD_GL_EXT(glBindFramebuffer, PFNGLBINDFRAMEBUFFERPROC);
|
88
|
+
glBindFramebuffer(GOSU_GL_CONST(GL_FRAMEBUFFER), framebuffer);
|
89
|
+
|
90
|
+
GOSU_LOAD_GL_EXT(glCheckFramebufferStatus, PFNGLCHECKFRAMEBUFFERSTATUSPROC);
|
91
|
+
GLenum status = glCheckFramebufferStatus(GOSU_GL_CONST(GL_FRAMEBUFFER));
|
92
|
+
if (status != GOSU_GL_CONST(GL_FRAMEBUFFER_COMPLETE)) throw runtime_error("Incomplete framebuffer");
|
93
|
+
|
94
|
+
f();
|
95
|
+
glBindFramebuffer(GOSU_GL_CONST(GL_FRAMEBUFFER), 0);
|
96
|
+
|
97
|
+
unique_ptr<ImageData> tex_chunk(new TexChunk(texture, 0, 0, texture->width(), texture->height(), 0));
|
98
|
+
return Image(move(tex_chunk));
|
99
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "GraphicsImpl.hpp"
|
4
|
+
|
5
|
+
namespace Gosu
|
6
|
+
{
|
7
|
+
class OffScreenTarget
|
8
|
+
{
|
9
|
+
std::shared_ptr<Texture> texture;
|
10
|
+
GLuint renderbuffer;
|
11
|
+
GLuint framebuffer;
|
12
|
+
|
13
|
+
OffScreenTarget(const OffScreenTarget& other) = delete;
|
14
|
+
OffScreenTarget& operator=(const OffScreenTarget& other) = delete;
|
15
|
+
OffScreenTarget(OffScreenTarget&& other) = delete;
|
16
|
+
OffScreenTarget& operator=(OffScreenTarget&& other) = delete;
|
17
|
+
|
18
|
+
public:
|
19
|
+
OffScreenTarget(int width, int height);
|
20
|
+
~OffScreenTarget();
|
21
|
+
Gosu::Image render(const std::function<void ()>& f);
|
22
|
+
};
|
23
|
+
}
|
data/src/OggFile.hpp
CHANGED
@@ -5,9 +5,19 @@
|
|
5
5
|
#include <stdexcept>
|
6
6
|
#include <string>
|
7
7
|
|
8
|
+
// Disable comma warnings in stb headers.
|
9
|
+
#ifdef __GNUC__
|
10
|
+
#pragma GCC diagnostic push
|
11
|
+
#pragma GCC diagnostic ignored "-Wcomma"
|
12
|
+
#endif
|
13
|
+
|
8
14
|
#define STB_VORBIS_HEADER_ONLY
|
9
15
|
#include "stb_vorbis.c"
|
10
16
|
|
17
|
+
#ifdef __GNUC__
|
18
|
+
#pragma GCC diagnostic pop
|
19
|
+
#endif
|
20
|
+
|
11
21
|
namespace Gosu
|
12
22
|
{
|
13
23
|
class OggFile : public AudioFile
|
data/src/RenderState.hpp
CHANGED
data/src/Resolution.cpp
CHANGED
@@ -75,12 +75,12 @@ unsigned Gosu::screen_height()
|
|
75
75
|
#if !defined(GOSU_IS_MAC)
|
76
76
|
unsigned Gosu::available_width()
|
77
77
|
{
|
78
|
-
return Gosu::screen_width() * 0.9;
|
78
|
+
return static_cast<unsigned>(Gosu::screen_width() * 0.9);
|
79
79
|
}
|
80
80
|
|
81
81
|
unsigned Gosu::available_height()
|
82
82
|
{
|
83
|
-
return Gosu::screen_height() * 0.8;
|
83
|
+
return static_cast<unsigned>(Gosu::screen_height() * 0.8);
|
84
84
|
}
|
85
85
|
#endif
|
86
86
|
#endif
|
data/src/RubyGosu.cxx
CHANGED
@@ -2269,23 +2269,13 @@ namespace Gosu
|
|
2269
2269
|
}
|
2270
2270
|
|
2271
2271
|
void al_shutdown();
|
2272
|
-
|
2273
|
-
void register_entity(const std::string& name, Gosu::Image* image)
|
2274
|
-
{
|
2275
|
-
register_entity(name, image->data().to_bitmap());
|
2276
|
-
}
|
2277
2272
|
}
|
2278
2273
|
|
2279
2274
|
#include <cstring>
|
2280
2275
|
#include <ctime>
|
2281
2276
|
#include <sstream>
|
2282
2277
|
|
2283
|
-
// Preprocessor check for 1.9 or higher (thanks banister)
|
2284
|
-
#if defined(ROBJECT_EMBED_LEN_MAX)
|
2285
2278
|
#define ENFORCE_UTF8(val) rb_funcall(val, rb_intern("force_encoding"), 1, rb_str_new2("UTF-8"))
|
2286
|
-
#else
|
2287
|
-
#define ENFORCE_UTF8(val)
|
2288
|
-
#endif
|
2289
2279
|
|
2290
2280
|
namespace Gosu
|
2291
2281
|
{
|
@@ -2308,8 +2298,8 @@ namespace Gosu
|
|
2308
2298
|
VALUE conversion = rb_str_new2("to_blob { self.format = 'RGBA'; self.depth = 8 }");
|
2309
2299
|
VALUE blob = rb_obj_instance_eval(1, &conversion, val);
|
2310
2300
|
rb_check_safe_obj(blob);
|
2311
|
-
|
2312
|
-
|
2301
|
+
int width = NUM2ULONG(rb_funcall(val, rb_intern("columns"), 0));
|
2302
|
+
int height = NUM2ULONG(rb_funcall(val, rb_intern("rows"), 0));
|
2313
2303
|
|
2314
2304
|
std::size_t size = width * height * 4;
|
2315
2305
|
bitmap.resize(width, height, Gosu::Color::NONE);
|
@@ -2418,6 +2408,10 @@ namespace Gosu
|
|
2418
2408
|
return new Gosu::Image(Gosu::Graphics::record(width, height, [] { rb_yield(Qnil); }));
|
2419
2409
|
}
|
2420
2410
|
|
2411
|
+
Gosu::Image* render(int width, int height) {
|
2412
|
+
return new Gosu::Image(Gosu::Graphics::render(width, height, [] { rb_yield(Qnil); }));
|
2413
|
+
}
|
2414
|
+
|
2421
2415
|
// This method cannot be called "transform" because then it would be an ambiguous overload of
|
2422
2416
|
// Gosu::Transform Gosu::transform(...).
|
2423
2417
|
// So it has to be renamed via %rename below... :( - same for the other transformations.
|
@@ -2787,10 +2781,10 @@ SWIG_AsVal_int (VALUE obj, int *val)
|
|
2787
2781
|
return res;
|
2788
2782
|
}
|
2789
2783
|
|
2790
|
-
SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_0(Gosu::Window &window,std::string const &font_name,
|
2784
|
+
SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_0(Gosu::Window &window,std::string const &font_name,int height){
|
2791
2785
|
return new Gosu::Font(height, font_name);
|
2792
2786
|
}
|
2793
|
-
SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_1(
|
2787
|
+
SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_1(int height,VALUE options=0){
|
2794
2788
|
std::string font_name = Gosu::default_font_name();
|
2795
2789
|
|
2796
2790
|
if (options) {
|
@@ -2821,78 +2815,6 @@ SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_1(unsigned int height,VALUE options=0
|
|
2821
2815
|
|
2822
2816
|
return new Gosu::Font(height, font_name);
|
2823
2817
|
}
|
2824
|
-
SWIGINTERN void Gosu_Font_set_image(Gosu::Font *self,wchar_t wc,VALUE source){
|
2825
|
-
Gosu::Bitmap bitmap;
|
2826
|
-
Gosu::load_bitmap(bitmap, source);
|
2827
|
-
self->set_image(wc, Gosu::Image(bitmap, Gosu::IF_SMOOTH));
|
2828
|
-
}
|
2829
|
-
|
2830
|
-
#include <float.h>
|
2831
|
-
|
2832
|
-
|
2833
|
-
#include <math.h>
|
2834
|
-
|
2835
|
-
|
2836
|
-
/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
|
2837
|
-
#ifndef SWIG_isfinite
|
2838
|
-
/* isfinite() is a macro for C99 */
|
2839
|
-
# if defined(isfinite)
|
2840
|
-
# define SWIG_isfinite(X) (isfinite(X))
|
2841
|
-
# elif defined __cplusplus && __cplusplus >= 201103L
|
2842
|
-
/* Use a template so that this works whether isfinite() is std::isfinite() or
|
2843
|
-
* in the global namespace. The reality seems to vary between compiler
|
2844
|
-
* versions.
|
2845
|
-
*
|
2846
|
-
* Make sure namespace std exists to avoid compiler warnings.
|
2847
|
-
*
|
2848
|
-
* extern "C++" is required as this fragment can end up inside an extern "C" { } block
|
2849
|
-
*/
|
2850
|
-
namespace std { }
|
2851
|
-
extern "C++" template<typename T>
|
2852
|
-
inline int SWIG_isfinite_func(T x) {
|
2853
|
-
using namespace std;
|
2854
|
-
return isfinite(x);
|
2855
|
-
}
|
2856
|
-
# define SWIG_isfinite(X) (SWIG_isfinite_func(X))
|
2857
|
-
# elif defined(_MSC_VER)
|
2858
|
-
# define SWIG_isfinite(X) (_finite(X))
|
2859
|
-
# elif defined(__sun) && defined(__SVR4)
|
2860
|
-
# include <ieeefp.h>
|
2861
|
-
# define SWIG_isfinite(X) (finite(X))
|
2862
|
-
# endif
|
2863
|
-
#endif
|
2864
|
-
|
2865
|
-
|
2866
|
-
/* Accept infinite as a valid float value unless we are unable to check if a value is finite */
|
2867
|
-
#ifdef SWIG_isfinite
|
2868
|
-
# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X))
|
2869
|
-
#else
|
2870
|
-
# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX))
|
2871
|
-
#endif
|
2872
|
-
|
2873
|
-
|
2874
|
-
SWIGINTERN int
|
2875
|
-
SWIG_AsVal_float (VALUE obj, float *val)
|
2876
|
-
{
|
2877
|
-
double v;
|
2878
|
-
int res = SWIG_AsVal_double (obj, &v);
|
2879
|
-
if (SWIG_IsOK(res)) {
|
2880
|
-
if (SWIG_Float_Overflow_Check(v)) {
|
2881
|
-
return SWIG_OverflowError;
|
2882
|
-
} else {
|
2883
|
-
if (val) *val = static_cast< float >(v);
|
2884
|
-
}
|
2885
|
-
}
|
2886
|
-
return res;
|
2887
|
-
}
|
2888
|
-
|
2889
|
-
|
2890
|
-
SWIGINTERNINLINE VALUE
|
2891
|
-
SWIG_From_float (float value)
|
2892
|
-
{
|
2893
|
-
return SWIG_From_double (value);
|
2894
|
-
}
|
2895
|
-
|
2896
2818
|
SWIGINTERN Gosu::Image *new_Gosu_Image(VALUE source,VALUE options=0){
|
2897
2819
|
Gosu::Bitmap bmp;
|
2898
2820
|
Gosu::load_bitmap(bmp, source);
|
@@ -2955,10 +2877,10 @@ SWIGINTERN Gosu::Image *Gosu_Image_subimage(Gosu::Image *self,int x,int y,int w,
|
|
2955
2877
|
std::unique_ptr<Gosu::ImageData> image_data = self->data().subimage(x, y, w, h);
|
2956
2878
|
return image_data.get() ? new Gosu::Image(std::move(image_data)) : nullptr;
|
2957
2879
|
}
|
2958
|
-
SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,
|
2880
|
+
SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,int font_height,VALUE options=0){
|
2959
2881
|
std::string font = Gosu::default_font_name();
|
2960
|
-
|
2961
|
-
|
2882
|
+
int width = 0;
|
2883
|
+
int spacing = 0;
|
2962
2884
|
Gosu::Alignment align = Gosu::AL_LEFT;
|
2963
2885
|
unsigned flags = 0;
|
2964
2886
|
|
@@ -3016,7 +2938,7 @@ SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,unsigned in
|
|
3016
2938
|
}
|
3017
2939
|
|
3018
2940
|
Gosu::Bitmap bitmap;
|
3019
|
-
if (width ==
|
2941
|
+
if (width == 0) {
|
3020
2942
|
bitmap = Gosu::create_text(text, font, font_height);
|
3021
2943
|
}
|
3022
2944
|
else {
|
@@ -3104,6 +3026,38 @@ SWIGINTERN void Gosu_Image_insert(Gosu::Image *self,VALUE source,int x,int y){
|
|
3104
3026
|
Gosu::load_bitmap(bmp, source);
|
3105
3027
|
self->data().insert(bmp, x, y);
|
3106
3028
|
}
|
3029
|
+
SWIGINTERN std::string Gosu_Image_inspect(Gosu::Image const *self,int max_width=80){
|
3030
|
+
try {
|
3031
|
+
Gosu::Bitmap bmp = self->data().to_bitmap();
|
3032
|
+
// This is the scaled image width inside the ASCII art border, so make sure
|
3033
|
+
// there will be room for a leading and trailing '#' character.
|
3034
|
+
int w = Gosu::clamp<int>(max_width - 2, 0, bmp.width());
|
3035
|
+
// For images with width == 0, the output will have one line per pixel.
|
3036
|
+
// Otherwise, scale proportionally.
|
3037
|
+
int h = (w ? bmp.height() * w / bmp.width() : bmp.height());
|
3038
|
+
|
3039
|
+
// This is the length of one row in the string output, including the border
|
3040
|
+
// and a trailing newline.
|
3041
|
+
int stride = w + 3;
|
3042
|
+
std::string str(stride * (h + 2), '#');
|
3043
|
+
str[stride - 1] = '\n'; // first newline
|
3044
|
+
str.back() = '\n'; // last newline
|
3045
|
+
|
3046
|
+
for (int y = 0; y < h; ++y) {
|
3047
|
+
for (int x = 0; x < w; ++x) {
|
3048
|
+
int scaled_x = x * bmp.width() / w;
|
3049
|
+
int scaled_y = y * bmp.height() / h;
|
3050
|
+
int alpha3bit = bmp.get_pixel(scaled_x, scaled_y).alpha() / 32;
|
3051
|
+
str[(y + 1) * stride + (x + 1)] = " .:ioVM@"[alpha3bit];
|
3052
|
+
}
|
3053
|
+
str[(y + 1) * stride + (w + 2)] = '\n'; // newline after row of pixels
|
3054
|
+
}
|
3055
|
+
return str;
|
3056
|
+
}
|
3057
|
+
catch (...) {
|
3058
|
+
return "<Gosu::Image without bitmap representation>";
|
3059
|
+
}
|
3060
|
+
}
|
3107
3061
|
SWIGINTERN VALUE Gosu_TextInput_caret_pos(Gosu::TextInput *self){
|
3108
3062
|
std::string prefix = self->text().substr(0, self->caret_pos());
|
3109
3063
|
VALUE rb_prefix = rb_str_new2(prefix.c_str());
|
@@ -5150,7 +5104,7 @@ _wrap_Font_name(int argc, VALUE *argv, VALUE self) {
|
|
5150
5104
|
Gosu::Font *arg1 = (Gosu::Font *) 0 ;
|
5151
5105
|
void *argp1 = 0 ;
|
5152
5106
|
int res1 = 0 ;
|
5153
|
-
std::string result;
|
5107
|
+
std::string *result = 0 ;
|
5154
5108
|
VALUE vresult = Qnil;
|
5155
5109
|
|
5156
5110
|
if ((argc < 0) || (argc > 0)) {
|
@@ -5163,13 +5117,13 @@ _wrap_Font_name(int argc, VALUE *argv, VALUE self) {
|
|
5163
5117
|
arg1 = reinterpret_cast< Gosu::Font * >(argp1);
|
5164
5118
|
{
|
5165
5119
|
try {
|
5166
|
-
result = ((Gosu::Font const *)arg1)->name();
|
5120
|
+
result = (std::string *) &((Gosu::Font const *)arg1)->name();
|
5167
5121
|
}
|
5168
5122
|
catch (const std::exception& e) {
|
5169
5123
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
5170
5124
|
}
|
5171
5125
|
}
|
5172
|
-
vresult = SWIG_From_std_string(static_cast< std::string >(result));
|
5126
|
+
vresult = SWIG_From_std_string(static_cast< std::string >(*result));
|
5173
5127
|
return vresult;
|
5174
5128
|
fail:
|
5175
5129
|
return Qnil;
|
@@ -5181,7 +5135,7 @@ _wrap_Font_height(int argc, VALUE *argv, VALUE self) {
|
|
5181
5135
|
Gosu::Font *arg1 = (Gosu::Font *) 0 ;
|
5182
5136
|
void *argp1 = 0 ;
|
5183
5137
|
int res1 = 0 ;
|
5184
|
-
|
5138
|
+
int result;
|
5185
5139
|
VALUE vresult = Qnil;
|
5186
5140
|
|
5187
5141
|
if ((argc < 0) || (argc > 0)) {
|
@@ -5194,13 +5148,13 @@ _wrap_Font_height(int argc, VALUE *argv, VALUE self) {
|
|
5194
5148
|
arg1 = reinterpret_cast< Gosu::Font * >(argp1);
|
5195
5149
|
{
|
5196
5150
|
try {
|
5197
|
-
result = (
|
5151
|
+
result = (int)((Gosu::Font const *)arg1)->height();
|
5198
5152
|
}
|
5199
5153
|
catch (const std::exception& e) {
|
5200
5154
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
5201
5155
|
}
|
5202
5156
|
}
|
5203
|
-
vresult =
|
5157
|
+
vresult = SWIG_From_int(static_cast< int >(result));
|
5204
5158
|
return vresult;
|
5205
5159
|
fail:
|
5206
5160
|
return Qnil;
|
@@ -5702,15 +5656,184 @@ fail:
|
|
5702
5656
|
}
|
5703
5657
|
|
5704
5658
|
|
5659
|
+
SWIGINTERN VALUE
|
5660
|
+
_wrap_Font_set_image__SWIG_0(int argc, VALUE *argv, VALUE self) {
|
5661
|
+
Gosu::Font *arg1 = (Gosu::Font *) 0 ;
|
5662
|
+
std::string arg2 ;
|
5663
|
+
unsigned int arg3 ;
|
5664
|
+
Gosu::Image *arg4 = 0 ;
|
5665
|
+
void *argp1 = 0 ;
|
5666
|
+
int res1 = 0 ;
|
5667
|
+
unsigned int val3 ;
|
5668
|
+
int ecode3 = 0 ;
|
5669
|
+
void *argp4 ;
|
5670
|
+
int res4 = 0 ;
|
5671
|
+
|
5672
|
+
if ((argc < 3) || (argc > 3)) {
|
5673
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
|
5674
|
+
}
|
5675
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
|
5676
|
+
if (!SWIG_IsOK(res1)) {
|
5677
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font *","set_image", 1, self ));
|
5678
|
+
}
|
5679
|
+
arg1 = reinterpret_cast< Gosu::Font * >(argp1);
|
5680
|
+
{
|
5681
|
+
std::string *ptr = (std::string *)0;
|
5682
|
+
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
|
5683
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
5684
|
+
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","set_image", 2, argv[0] ));
|
5685
|
+
}
|
5686
|
+
arg2 = *ptr;
|
5687
|
+
if (SWIG_IsNewObj(res)) delete ptr;
|
5688
|
+
}
|
5689
|
+
ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
|
5690
|
+
if (!SWIG_IsOK(ecode3)) {
|
5691
|
+
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","set_image", 3, argv[1] ));
|
5692
|
+
}
|
5693
|
+
arg3 = static_cast< unsigned int >(val3);
|
5694
|
+
res4 = SWIG_ConvertPtr(argv[2], &argp4, SWIGTYPE_p_Gosu__Image, 0 );
|
5695
|
+
if (!SWIG_IsOK(res4)) {
|
5696
|
+
SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "Gosu::Image const &","set_image", 4, argv[2] ));
|
5697
|
+
}
|
5698
|
+
if (!argp4) {
|
5699
|
+
SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Gosu::Image const &","set_image", 4, argv[2]));
|
5700
|
+
}
|
5701
|
+
arg4 = reinterpret_cast< Gosu::Image * >(argp4);
|
5702
|
+
{
|
5703
|
+
try {
|
5704
|
+
(arg1)->set_image(arg2,arg3,(Gosu::Image const &)*arg4);
|
5705
|
+
}
|
5706
|
+
catch (const std::exception& e) {
|
5707
|
+
SWIG_exception(SWIG_RuntimeError, e.what());
|
5708
|
+
}
|
5709
|
+
}
|
5710
|
+
return Qnil;
|
5711
|
+
fail:
|
5712
|
+
return Qnil;
|
5713
|
+
}
|
5714
|
+
|
5715
|
+
|
5716
|
+
SWIGINTERN VALUE
|
5717
|
+
_wrap_Font_set_image__SWIG_1(int argc, VALUE *argv, VALUE self) {
|
5718
|
+
Gosu::Font *arg1 = (Gosu::Font *) 0 ;
|
5719
|
+
std::string arg2 ;
|
5720
|
+
Gosu::Image *arg3 = 0 ;
|
5721
|
+
void *argp1 = 0 ;
|
5722
|
+
int res1 = 0 ;
|
5723
|
+
void *argp3 ;
|
5724
|
+
int res3 = 0 ;
|
5725
|
+
|
5726
|
+
if ((argc < 2) || (argc > 2)) {
|
5727
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
5728
|
+
}
|
5729
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
|
5730
|
+
if (!SWIG_IsOK(res1)) {
|
5731
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font *","set_image", 1, self ));
|
5732
|
+
}
|
5733
|
+
arg1 = reinterpret_cast< Gosu::Font * >(argp1);
|
5734
|
+
{
|
5735
|
+
std::string *ptr = (std::string *)0;
|
5736
|
+
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
|
5737
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
5738
|
+
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","set_image", 2, argv[0] ));
|
5739
|
+
}
|
5740
|
+
arg2 = *ptr;
|
5741
|
+
if (SWIG_IsNewObj(res)) delete ptr;
|
5742
|
+
}
|
5743
|
+
res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Gosu__Image, 0 );
|
5744
|
+
if (!SWIG_IsOK(res3)) {
|
5745
|
+
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Gosu::Image const &","set_image", 3, argv[1] ));
|
5746
|
+
}
|
5747
|
+
if (!argp3) {
|
5748
|
+
SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Gosu::Image const &","set_image", 3, argv[1]));
|
5749
|
+
}
|
5750
|
+
arg3 = reinterpret_cast< Gosu::Image * >(argp3);
|
5751
|
+
{
|
5752
|
+
try {
|
5753
|
+
(arg1)->set_image(arg2,(Gosu::Image const &)*arg3);
|
5754
|
+
}
|
5755
|
+
catch (const std::exception& e) {
|
5756
|
+
SWIG_exception(SWIG_RuntimeError, e.what());
|
5757
|
+
}
|
5758
|
+
}
|
5759
|
+
return Qnil;
|
5760
|
+
fail:
|
5761
|
+
return Qnil;
|
5762
|
+
}
|
5763
|
+
|
5764
|
+
|
5765
|
+
SWIGINTERN VALUE _wrap_Font_set_image(int nargs, VALUE *args, VALUE self) {
|
5766
|
+
int argc;
|
5767
|
+
VALUE argv[5];
|
5768
|
+
int ii;
|
5769
|
+
|
5770
|
+
argc = nargs + 1;
|
5771
|
+
argv[0] = self;
|
5772
|
+
if (argc > 5) SWIG_fail;
|
5773
|
+
for (ii = 1; (ii < argc); ++ii) {
|
5774
|
+
argv[ii] = args[ii-1];
|
5775
|
+
}
|
5776
|
+
if (argc == 3) {
|
5777
|
+
int _v;
|
5778
|
+
void *vptr = 0;
|
5779
|
+
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Font, 0);
|
5780
|
+
_v = SWIG_CheckState(res);
|
5781
|
+
if (_v) {
|
5782
|
+
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
|
5783
|
+
_v = SWIG_CheckState(res);
|
5784
|
+
if (_v) {
|
5785
|
+
void *vptr = 0;
|
5786
|
+
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Gosu__Image, 0);
|
5787
|
+
_v = SWIG_CheckState(res);
|
5788
|
+
if (_v) {
|
5789
|
+
return _wrap_Font_set_image__SWIG_1(nargs, args, self);
|
5790
|
+
}
|
5791
|
+
}
|
5792
|
+
}
|
5793
|
+
}
|
5794
|
+
if (argc == 4) {
|
5795
|
+
int _v;
|
5796
|
+
void *vptr = 0;
|
5797
|
+
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Font, 0);
|
5798
|
+
_v = SWIG_CheckState(res);
|
5799
|
+
if (_v) {
|
5800
|
+
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
|
5801
|
+
_v = SWIG_CheckState(res);
|
5802
|
+
if (_v) {
|
5803
|
+
{
|
5804
|
+
int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
|
5805
|
+
_v = SWIG_CheckState(res);
|
5806
|
+
}
|
5807
|
+
if (_v) {
|
5808
|
+
void *vptr = 0;
|
5809
|
+
int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_Gosu__Image, 0);
|
5810
|
+
_v = SWIG_CheckState(res);
|
5811
|
+
if (_v) {
|
5812
|
+
return _wrap_Font_set_image__SWIG_0(nargs, args, self);
|
5813
|
+
}
|
5814
|
+
}
|
5815
|
+
}
|
5816
|
+
}
|
5817
|
+
}
|
5818
|
+
|
5819
|
+
fail:
|
5820
|
+
Ruby_Format_OverloadedError( argc, 5, "Font.set_image",
|
5821
|
+
" void Font.set_image(std::string codepoint, unsigned int font_flags, Gosu::Image const &image)\n"
|
5822
|
+
" void Font.set_image(std::string codepoint, Gosu::Image const &image)\n");
|
5823
|
+
|
5824
|
+
return Qnil;
|
5825
|
+
}
|
5826
|
+
|
5827
|
+
|
5705
5828
|
SWIGINTERN VALUE
|
5706
5829
|
_wrap_new_Font__SWIG_0(int argc, VALUE *argv, VALUE self) {
|
5707
5830
|
Gosu::Window *arg1 = 0 ;
|
5708
5831
|
std::string *arg2 = 0 ;
|
5709
|
-
|
5832
|
+
int arg3 ;
|
5710
5833
|
void *argp1 = 0 ;
|
5711
5834
|
int res1 = 0 ;
|
5712
5835
|
int res2 = SWIG_OLDOBJ ;
|
5713
|
-
|
5836
|
+
int val3 ;
|
5714
5837
|
int ecode3 = 0 ;
|
5715
5838
|
const char *classname SWIGUNUSED = "Gosu::Font";
|
5716
5839
|
Gosu::Font *result = 0 ;
|
@@ -5737,11 +5860,11 @@ _wrap_new_Font__SWIG_0(int argc, VALUE *argv, VALUE self) {
|
|
5737
5860
|
}
|
5738
5861
|
arg2 = ptr;
|
5739
5862
|
}
|
5740
|
-
ecode3 =
|
5863
|
+
ecode3 = SWIG_AsVal_int(argv[2], &val3);
|
5741
5864
|
if (!SWIG_IsOK(ecode3)) {
|
5742
|
-
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "
|
5865
|
+
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Font", 3, argv[2] ));
|
5743
5866
|
}
|
5744
|
-
arg3 = static_cast<
|
5867
|
+
arg3 = static_cast< int >(val3);
|
5745
5868
|
{
|
5746
5869
|
try {
|
5747
5870
|
result = (Gosu::Font *)new_Gosu_Font__SWIG_0(*arg1,(std::string const &)*arg2,arg3);
|
@@ -5777,9 +5900,9 @@ _wrap_Font_allocate(int argc, VALUE *argv, VALUE self)
|
|
5777
5900
|
|
5778
5901
|
SWIGINTERN VALUE
|
5779
5902
|
_wrap_new_Font__SWIG_1(int argc, VALUE *argv, VALUE self) {
|
5780
|
-
|
5903
|
+
int arg1 ;
|
5781
5904
|
VALUE arg2 = (VALUE) 0 ;
|
5782
|
-
|
5905
|
+
int val1 ;
|
5783
5906
|
int ecode1 = 0 ;
|
5784
5907
|
const char *classname SWIGUNUSED = "Gosu::Font";
|
5785
5908
|
Gosu::Font *result = 0 ;
|
@@ -5787,11 +5910,11 @@ _wrap_new_Font__SWIG_1(int argc, VALUE *argv, VALUE self) {
|
|
5787
5910
|
if ((argc < 1) || (argc > 2)) {
|
5788
5911
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
5789
5912
|
}
|
5790
|
-
ecode1 =
|
5913
|
+
ecode1 = SWIG_AsVal_int(argv[0], &val1);
|
5791
5914
|
if (!SWIG_IsOK(ecode1)) {
|
5792
|
-
SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "
|
5915
|
+
SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","Font", 1, argv[0] ));
|
5793
5916
|
}
|
5794
|
-
arg1 = static_cast<
|
5917
|
+
arg1 = static_cast< int >(val1);
|
5795
5918
|
if (argc > 1) {
|
5796
5919
|
arg2 = argv[1];
|
5797
5920
|
}
|
@@ -5824,7 +5947,7 @@ SWIGINTERN VALUE _wrap_new_Font(int nargs, VALUE *args, VALUE self) {
|
|
5824
5947
|
if ((argc >= 1) && (argc <= 2)) {
|
5825
5948
|
int _v;
|
5826
5949
|
{
|
5827
|
-
int res =
|
5950
|
+
int res = SWIG_AsVal_int(argv[0], NULL);
|
5828
5951
|
_v = SWIG_CheckState(res);
|
5829
5952
|
}
|
5830
5953
|
if (_v) {
|
@@ -5847,7 +5970,7 @@ SWIGINTERN VALUE _wrap_new_Font(int nargs, VALUE *args, VALUE self) {
|
|
5847
5970
|
_v = SWIG_CheckState(res);
|
5848
5971
|
if (_v) {
|
5849
5972
|
{
|
5850
|
-
int res =
|
5973
|
+
int res = SWIG_AsVal_int(argv[2], NULL);
|
5851
5974
|
_v = SWIG_CheckState(res);
|
5852
5975
|
}
|
5853
5976
|
if (_v) {
|
@@ -5859,55 +5982,13 @@ SWIGINTERN VALUE _wrap_new_Font(int nargs, VALUE *args, VALUE self) {
|
|
5859
5982
|
|
5860
5983
|
fail:
|
5861
5984
|
Ruby_Format_OverloadedError( argc, 3, "Font.new",
|
5862
|
-
" Font.new(Gosu::Window &window, std::string const &font_name,
|
5863
|
-
" Font.new(
|
5985
|
+
" Font.new(Gosu::Window &window, std::string const &font_name, int height)\n"
|
5986
|
+
" Font.new(int height, VALUE options)\n");
|
5864
5987
|
|
5865
5988
|
return Qnil;
|
5866
5989
|
}
|
5867
5990
|
|
5868
5991
|
|
5869
|
-
SWIGINTERN VALUE
|
5870
|
-
_wrap_Font_set_image(int argc, VALUE *argv, VALUE self) {
|
5871
|
-
Gosu::Font *arg1 = (Gosu::Font *) 0 ;
|
5872
|
-
wchar_t arg2 ;
|
5873
|
-
VALUE arg3 = (VALUE) 0 ;
|
5874
|
-
void *argp1 = 0 ;
|
5875
|
-
int res1 = 0 ;
|
5876
|
-
|
5877
|
-
if ((argc < 2) || (argc > 2)) {
|
5878
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
5879
|
-
}
|
5880
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
|
5881
|
-
if (!SWIG_IsOK(res1)) {
|
5882
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font *","set_image", 1, self ));
|
5883
|
-
}
|
5884
|
-
arg1 = reinterpret_cast< Gosu::Font * >(argp1);
|
5885
|
-
{
|
5886
|
-
VALUE ruby_string = rb_obj_as_string(argv[0]);
|
5887
|
-
char* utf8_string = StringValueCStr(ruby_string);
|
5888
|
-
std::wstring ucs_string = Gosu::utf8_to_wstring(utf8_string);
|
5889
|
-
if (ucs_string.length() != 1) {
|
5890
|
-
rb_raise(rb_eArgError,
|
5891
|
-
"A single-character string was expected, but `%s' given",
|
5892
|
-
utf8_string);
|
5893
|
-
}
|
5894
|
-
arg2 = ucs_string[0];
|
5895
|
-
}
|
5896
|
-
arg3 = argv[1];
|
5897
|
-
{
|
5898
|
-
try {
|
5899
|
-
Gosu_Font_set_image(arg1,arg2,arg3);
|
5900
|
-
}
|
5901
|
-
catch (const std::exception& e) {
|
5902
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
5903
|
-
}
|
5904
|
-
}
|
5905
|
-
return Qnil;
|
5906
|
-
fail:
|
5907
|
-
return Qnil;
|
5908
|
-
}
|
5909
|
-
|
5910
|
-
|
5911
5992
|
SWIGINTERN void
|
5912
5993
|
free_Gosu_Font(void *self) {
|
5913
5994
|
Gosu::Font *arg1 = (Gosu::Font *)self;
|
@@ -5973,10 +6054,10 @@ fail:
|
|
5973
6054
|
SWIGINTERN VALUE
|
5974
6055
|
_wrap_GLTexInfo_left_set(int argc, VALUE *argv, VALUE self) {
|
5975
6056
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
5976
|
-
|
6057
|
+
double arg2 ;
|
5977
6058
|
void *argp1 = 0 ;
|
5978
6059
|
int res1 = 0 ;
|
5979
|
-
|
6060
|
+
double val2 ;
|
5980
6061
|
int ecode2 = 0 ;
|
5981
6062
|
|
5982
6063
|
if ((argc < 1) || (argc > 1)) {
|
@@ -5987,11 +6068,11 @@ _wrap_GLTexInfo_left_set(int argc, VALUE *argv, VALUE self) {
|
|
5987
6068
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","left", 1, self ));
|
5988
6069
|
}
|
5989
6070
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
5990
|
-
ecode2 =
|
6071
|
+
ecode2 = SWIG_AsVal_double(argv[0], &val2);
|
5991
6072
|
if (!SWIG_IsOK(ecode2)) {
|
5992
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "
|
6073
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","left", 2, argv[0] ));
|
5993
6074
|
}
|
5994
|
-
arg2 = static_cast<
|
6075
|
+
arg2 = static_cast< double >(val2);
|
5995
6076
|
if (arg1) (arg1)->left = arg2;
|
5996
6077
|
return Qnil;
|
5997
6078
|
fail:
|
@@ -6004,7 +6085,7 @@ _wrap_GLTexInfo_left_get(int argc, VALUE *argv, VALUE self) {
|
|
6004
6085
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6005
6086
|
void *argp1 = 0 ;
|
6006
6087
|
int res1 = 0 ;
|
6007
|
-
|
6088
|
+
double result;
|
6008
6089
|
VALUE vresult = Qnil;
|
6009
6090
|
|
6010
6091
|
if ((argc < 0) || (argc > 0)) {
|
@@ -6015,8 +6096,8 @@ _wrap_GLTexInfo_left_get(int argc, VALUE *argv, VALUE self) {
|
|
6015
6096
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","left", 1, self ));
|
6016
6097
|
}
|
6017
6098
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6018
|
-
result = (
|
6019
|
-
vresult =
|
6099
|
+
result = (double) ((arg1)->left);
|
6100
|
+
vresult = SWIG_From_double(static_cast< double >(result));
|
6020
6101
|
return vresult;
|
6021
6102
|
fail:
|
6022
6103
|
return Qnil;
|
@@ -6026,10 +6107,10 @@ fail:
|
|
6026
6107
|
SWIGINTERN VALUE
|
6027
6108
|
_wrap_GLTexInfo_right_set(int argc, VALUE *argv, VALUE self) {
|
6028
6109
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6029
|
-
|
6110
|
+
double arg2 ;
|
6030
6111
|
void *argp1 = 0 ;
|
6031
6112
|
int res1 = 0 ;
|
6032
|
-
|
6113
|
+
double val2 ;
|
6033
6114
|
int ecode2 = 0 ;
|
6034
6115
|
|
6035
6116
|
if ((argc < 1) || (argc > 1)) {
|
@@ -6040,11 +6121,11 @@ _wrap_GLTexInfo_right_set(int argc, VALUE *argv, VALUE self) {
|
|
6040
6121
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","right", 1, self ));
|
6041
6122
|
}
|
6042
6123
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6043
|
-
ecode2 =
|
6124
|
+
ecode2 = SWIG_AsVal_double(argv[0], &val2);
|
6044
6125
|
if (!SWIG_IsOK(ecode2)) {
|
6045
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "
|
6126
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","right", 2, argv[0] ));
|
6046
6127
|
}
|
6047
|
-
arg2 = static_cast<
|
6128
|
+
arg2 = static_cast< double >(val2);
|
6048
6129
|
if (arg1) (arg1)->right = arg2;
|
6049
6130
|
return Qnil;
|
6050
6131
|
fail:
|
@@ -6057,7 +6138,7 @@ _wrap_GLTexInfo_right_get(int argc, VALUE *argv, VALUE self) {
|
|
6057
6138
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6058
6139
|
void *argp1 = 0 ;
|
6059
6140
|
int res1 = 0 ;
|
6060
|
-
|
6141
|
+
double result;
|
6061
6142
|
VALUE vresult = Qnil;
|
6062
6143
|
|
6063
6144
|
if ((argc < 0) || (argc > 0)) {
|
@@ -6068,8 +6149,8 @@ _wrap_GLTexInfo_right_get(int argc, VALUE *argv, VALUE self) {
|
|
6068
6149
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","right", 1, self ));
|
6069
6150
|
}
|
6070
6151
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6071
|
-
result = (
|
6072
|
-
vresult =
|
6152
|
+
result = (double) ((arg1)->right);
|
6153
|
+
vresult = SWIG_From_double(static_cast< double >(result));
|
6073
6154
|
return vresult;
|
6074
6155
|
fail:
|
6075
6156
|
return Qnil;
|
@@ -6079,10 +6160,10 @@ fail:
|
|
6079
6160
|
SWIGINTERN VALUE
|
6080
6161
|
_wrap_GLTexInfo_top_set(int argc, VALUE *argv, VALUE self) {
|
6081
6162
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6082
|
-
|
6163
|
+
double arg2 ;
|
6083
6164
|
void *argp1 = 0 ;
|
6084
6165
|
int res1 = 0 ;
|
6085
|
-
|
6166
|
+
double val2 ;
|
6086
6167
|
int ecode2 = 0 ;
|
6087
6168
|
|
6088
6169
|
if ((argc < 1) || (argc > 1)) {
|
@@ -6093,11 +6174,11 @@ _wrap_GLTexInfo_top_set(int argc, VALUE *argv, VALUE self) {
|
|
6093
6174
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","top", 1, self ));
|
6094
6175
|
}
|
6095
6176
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6096
|
-
ecode2 =
|
6177
|
+
ecode2 = SWIG_AsVal_double(argv[0], &val2);
|
6097
6178
|
if (!SWIG_IsOK(ecode2)) {
|
6098
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "
|
6179
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","top", 2, argv[0] ));
|
6099
6180
|
}
|
6100
|
-
arg2 = static_cast<
|
6181
|
+
arg2 = static_cast< double >(val2);
|
6101
6182
|
if (arg1) (arg1)->top = arg2;
|
6102
6183
|
return Qnil;
|
6103
6184
|
fail:
|
@@ -6110,7 +6191,7 @@ _wrap_GLTexInfo_top_get(int argc, VALUE *argv, VALUE self) {
|
|
6110
6191
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6111
6192
|
void *argp1 = 0 ;
|
6112
6193
|
int res1 = 0 ;
|
6113
|
-
|
6194
|
+
double result;
|
6114
6195
|
VALUE vresult = Qnil;
|
6115
6196
|
|
6116
6197
|
if ((argc < 0) || (argc > 0)) {
|
@@ -6121,8 +6202,8 @@ _wrap_GLTexInfo_top_get(int argc, VALUE *argv, VALUE self) {
|
|
6121
6202
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","top", 1, self ));
|
6122
6203
|
}
|
6123
6204
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6124
|
-
result = (
|
6125
|
-
vresult =
|
6205
|
+
result = (double) ((arg1)->top);
|
6206
|
+
vresult = SWIG_From_double(static_cast< double >(result));
|
6126
6207
|
return vresult;
|
6127
6208
|
fail:
|
6128
6209
|
return Qnil;
|
@@ -6132,10 +6213,10 @@ fail:
|
|
6132
6213
|
SWIGINTERN VALUE
|
6133
6214
|
_wrap_GLTexInfo_bottom_set(int argc, VALUE *argv, VALUE self) {
|
6134
6215
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6135
|
-
|
6216
|
+
double arg2 ;
|
6136
6217
|
void *argp1 = 0 ;
|
6137
6218
|
int res1 = 0 ;
|
6138
|
-
|
6219
|
+
double val2 ;
|
6139
6220
|
int ecode2 = 0 ;
|
6140
6221
|
|
6141
6222
|
if ((argc < 1) || (argc > 1)) {
|
@@ -6146,11 +6227,11 @@ _wrap_GLTexInfo_bottom_set(int argc, VALUE *argv, VALUE self) {
|
|
6146
6227
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","bottom", 1, self ));
|
6147
6228
|
}
|
6148
6229
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6149
|
-
ecode2 =
|
6230
|
+
ecode2 = SWIG_AsVal_double(argv[0], &val2);
|
6150
6231
|
if (!SWIG_IsOK(ecode2)) {
|
6151
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "
|
6232
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","bottom", 2, argv[0] ));
|
6152
6233
|
}
|
6153
|
-
arg2 = static_cast<
|
6234
|
+
arg2 = static_cast< double >(val2);
|
6154
6235
|
if (arg1) (arg1)->bottom = arg2;
|
6155
6236
|
return Qnil;
|
6156
6237
|
fail:
|
@@ -6163,7 +6244,7 @@ _wrap_GLTexInfo_bottom_get(int argc, VALUE *argv, VALUE self) {
|
|
6163
6244
|
Gosu::GLTexInfo *arg1 = (Gosu::GLTexInfo *) 0 ;
|
6164
6245
|
void *argp1 = 0 ;
|
6165
6246
|
int res1 = 0 ;
|
6166
|
-
|
6247
|
+
double result;
|
6167
6248
|
VALUE vresult = Qnil;
|
6168
6249
|
|
6169
6250
|
if ((argc < 0) || (argc > 0)) {
|
@@ -6174,8 +6255,8 @@ _wrap_GLTexInfo_bottom_get(int argc, VALUE *argv, VALUE self) {
|
|
6174
6255
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::GLTexInfo *","bottom", 1, self ));
|
6175
6256
|
}
|
6176
6257
|
arg1 = reinterpret_cast< Gosu::GLTexInfo * >(argp1);
|
6177
|
-
result = (
|
6178
|
-
vresult =
|
6258
|
+
result = (double) ((arg1)->bottom);
|
6259
|
+
vresult = SWIG_From_double(static_cast< double >(result));
|
6179
6260
|
return vresult;
|
6180
6261
|
fail:
|
6181
6262
|
return Qnil;
|
@@ -7048,10 +7129,10 @@ fail:
|
|
7048
7129
|
SWIGINTERN VALUE
|
7049
7130
|
_wrap_Image_from_text(int argc, VALUE *argv, VALUE self) {
|
7050
7131
|
std::string *arg1 = 0 ;
|
7051
|
-
|
7132
|
+
int arg2 ;
|
7052
7133
|
VALUE arg3 = (VALUE) 0 ;
|
7053
7134
|
int res1 = SWIG_OLDOBJ ;
|
7054
|
-
|
7135
|
+
int val2 ;
|
7055
7136
|
int ecode2 = 0 ;
|
7056
7137
|
Gosu::Image *result = 0 ;
|
7057
7138
|
VALUE vresult = Qnil;
|
@@ -7070,11 +7151,11 @@ _wrap_Image_from_text(int argc, VALUE *argv, VALUE self) {
|
|
7070
7151
|
}
|
7071
7152
|
arg1 = ptr;
|
7072
7153
|
}
|
7073
|
-
ecode2 =
|
7154
|
+
ecode2 = SWIG_AsVal_int(argv[1], &val2);
|
7074
7155
|
if (!SWIG_IsOK(ecode2)) {
|
7075
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "
|
7156
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Gosu_Image_from_text", 2, argv[1] ));
|
7076
7157
|
}
|
7077
|
-
arg2 = static_cast<
|
7158
|
+
arg2 = static_cast< int >(val2);
|
7078
7159
|
if (argc > 2) {
|
7079
7160
|
arg3 = argv[2];
|
7080
7161
|
}
|
@@ -7480,93 +7561,88 @@ fail:
|
|
7480
7561
|
}
|
7481
7562
|
|
7482
7563
|
|
7483
|
-
SWIGINTERN void
|
7484
|
-
free_Gosu_Image(void *self) {
|
7485
|
-
Gosu::Image *arg1 = (Gosu::Image *)self;
|
7486
|
-
SWIG_RubyRemoveTracking(arg1);
|
7487
|
-
delete arg1;
|
7488
|
-
}
|
7489
7564
|
|
7565
|
+
/*
|
7566
|
+
Document-method: Gosu::Image.inspect
|
7567
|
+
|
7568
|
+
call-seq:
|
7569
|
+
inspect(max_width=80) -> std::string
|
7570
|
+
|
7571
|
+
Inspect class and its contents.
|
7572
|
+
*/
|
7490
7573
|
SWIGINTERN VALUE
|
7491
|
-
|
7492
|
-
|
7574
|
+
_wrap_Image_inspect(int argc, VALUE *argv, VALUE self) {
|
7575
|
+
Gosu::Image *arg1 = (Gosu::Image *) 0 ;
|
7576
|
+
int arg2 = (int) 80 ;
|
7577
|
+
void *argp1 = 0 ;
|
7578
|
+
int res1 = 0 ;
|
7579
|
+
int val2 ;
|
7580
|
+
int ecode2 = 0 ;
|
7581
|
+
std::string result;
|
7493
7582
|
VALUE vresult = Qnil;
|
7494
7583
|
|
7495
|
-
if ((argc < 0) || (argc >
|
7584
|
+
if ((argc < 0) || (argc > 1)) {
|
7496
7585
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
7497
7586
|
}
|
7587
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Image, 0 | 0 );
|
7588
|
+
if (!SWIG_IsOK(res1)) {
|
7589
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Image const *","inspect", 1, self ));
|
7590
|
+
}
|
7591
|
+
arg1 = reinterpret_cast< Gosu::Image * >(argp1);
|
7592
|
+
if (argc > 0) {
|
7593
|
+
ecode2 = SWIG_AsVal_int(argv[0], &val2);
|
7594
|
+
if (!SWIG_IsOK(ecode2)) {
|
7595
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","inspect", 2, argv[0] ));
|
7596
|
+
}
|
7597
|
+
arg2 = static_cast< int >(val2);
|
7598
|
+
}
|
7498
7599
|
{
|
7499
7600
|
try {
|
7500
|
-
result = (
|
7601
|
+
result = Gosu_Image_inspect((Gosu::Image const *)arg1,arg2);
|
7501
7602
|
}
|
7502
7603
|
catch (const std::exception& e) {
|
7503
7604
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
7504
7605
|
}
|
7505
7606
|
}
|
7506
|
-
vresult =
|
7607
|
+
vresult = SWIG_From_std_string(static_cast< std::string >(result));
|
7507
7608
|
return vresult;
|
7508
7609
|
fail:
|
7509
7610
|
return Qnil;
|
7510
7611
|
}
|
7511
7612
|
|
7512
7613
|
|
7513
|
-
|
7514
|
-
|
7515
|
-
|
7516
|
-
|
7517
|
-
|
7518
|
-
#else
|
7519
|
-
_wrap_Channel_allocate(int argc, VALUE *argv, VALUE self)
|
7520
|
-
#endif
|
7521
|
-
{
|
7522
|
-
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Gosu__Channel);
|
7523
|
-
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
|
7524
|
-
rb_obj_call_init(vresult, argc, argv);
|
7525
|
-
#endif
|
7526
|
-
return vresult;
|
7614
|
+
SWIGINTERN void
|
7615
|
+
free_Gosu_Image(void *self) {
|
7616
|
+
Gosu::Image *arg1 = (Gosu::Image *)self;
|
7617
|
+
SWIG_RubyRemoveTracking(arg1);
|
7618
|
+
delete arg1;
|
7527
7619
|
}
|
7528
7620
|
|
7529
|
-
|
7530
7621
|
SWIGINTERN VALUE
|
7531
|
-
|
7532
|
-
int
|
7533
|
-
|
7534
|
-
int val1 ;
|
7535
|
-
int ecode1 = 0 ;
|
7536
|
-
int val2 ;
|
7537
|
-
int ecode2 = 0 ;
|
7538
|
-
const char *classname SWIGUNUSED = "Gosu::Channel";
|
7539
|
-
Gosu::Channel *result = 0 ;
|
7622
|
+
_wrap_fps(int argc, VALUE *argv, VALUE self) {
|
7623
|
+
int result;
|
7624
|
+
VALUE vresult = Qnil;
|
7540
7625
|
|
7541
|
-
if ((argc <
|
7542
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
7626
|
+
if ((argc < 0) || (argc > 0)) {
|
7627
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
7543
7628
|
}
|
7544
|
-
ecode1 = SWIG_AsVal_int(argv[0], &val1);
|
7545
|
-
if (!SWIG_IsOK(ecode1)) {
|
7546
|
-
SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","Channel", 1, argv[0] ));
|
7547
|
-
}
|
7548
|
-
arg1 = static_cast< int >(val1);
|
7549
|
-
ecode2 = SWIG_AsVal_int(argv[1], &val2);
|
7550
|
-
if (!SWIG_IsOK(ecode2)) {
|
7551
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Channel", 2, argv[1] ));
|
7552
|
-
}
|
7553
|
-
arg2 = static_cast< int >(val2);
|
7554
7629
|
{
|
7555
7630
|
try {
|
7556
|
-
result = (
|
7557
|
-
DATA_PTR(self) = result;
|
7558
|
-
SWIG_RubyAddTracking(result, self);
|
7631
|
+
result = (int)Gosu::fps();
|
7559
7632
|
}
|
7560
7633
|
catch (const std::exception& e) {
|
7561
7634
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
7562
7635
|
}
|
7563
7636
|
}
|
7564
|
-
|
7637
|
+
vresult = SWIG_From_int(static_cast< int >(result));
|
7638
|
+
return vresult;
|
7565
7639
|
fail:
|
7566
7640
|
return Qnil;
|
7567
7641
|
}
|
7568
7642
|
|
7569
7643
|
|
7644
|
+
static swig_class SwigClassChannel;
|
7645
|
+
|
7570
7646
|
SWIGINTERN VALUE
|
7571
7647
|
_wrap_Channel_current_channel(int argc, VALUE *argv, VALUE self) {
|
7572
7648
|
Gosu::Channel *arg1 = (Gosu::Channel *) 0 ;
|
@@ -7929,7 +8005,7 @@ _wrap_Sample_play(int argc, VALUE *argv, VALUE self) {
|
|
7929
8005
|
int ecode3 = 0 ;
|
7930
8006
|
bool val4 ;
|
7931
8007
|
int ecode4 = 0 ;
|
7932
|
-
|
8008
|
+
Gosu::Channel result;
|
7933
8009
|
VALUE vresult = Qnil;
|
7934
8010
|
|
7935
8011
|
if ((argc < 0) || (argc > 3)) {
|
@@ -7993,7 +8069,7 @@ _wrap_Sample_play_pan(int argc, VALUE *argv, VALUE self) {
|
|
7993
8069
|
int ecode4 = 0 ;
|
7994
8070
|
bool val5 ;
|
7995
8071
|
int ecode5 = 0 ;
|
7996
|
-
|
8072
|
+
Gosu::Channel result;
|
7997
8073
|
VALUE vresult = Qnil;
|
7998
8074
|
|
7999
8075
|
if ((argc < 1) || (argc > 4)) {
|
@@ -8564,6 +8640,100 @@ fail:
|
|
8564
8640
|
}
|
8565
8641
|
|
8566
8642
|
|
8643
|
+
SWIGINTERN VALUE
|
8644
|
+
_wrap_TextInput_insert_text(int argc, VALUE *argv, VALUE self) {
|
8645
|
+
Gosu::TextInput *arg1 = (Gosu::TextInput *) 0 ;
|
8646
|
+
std::string arg2 ;
|
8647
|
+
void *argp1 = 0 ;
|
8648
|
+
int res1 = 0 ;
|
8649
|
+
|
8650
|
+
if ((argc < 1) || (argc > 1)) {
|
8651
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
8652
|
+
}
|
8653
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__TextInput, 0 | 0 );
|
8654
|
+
if (!SWIG_IsOK(res1)) {
|
8655
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::TextInput *","insert_text", 1, self ));
|
8656
|
+
}
|
8657
|
+
arg1 = reinterpret_cast< Gosu::TextInput * >(argp1);
|
8658
|
+
{
|
8659
|
+
std::string *ptr = (std::string *)0;
|
8660
|
+
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
|
8661
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
8662
|
+
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","insert_text", 2, argv[0] ));
|
8663
|
+
}
|
8664
|
+
arg2 = *ptr;
|
8665
|
+
if (SWIG_IsNewObj(res)) delete ptr;
|
8666
|
+
}
|
8667
|
+
{
|
8668
|
+
try {
|
8669
|
+
(arg1)->insert_text(arg2);
|
8670
|
+
}
|
8671
|
+
catch (const std::exception& e) {
|
8672
|
+
SWIG_exception(SWIG_RuntimeError, e.what());
|
8673
|
+
}
|
8674
|
+
}
|
8675
|
+
return Qnil;
|
8676
|
+
fail:
|
8677
|
+
return Qnil;
|
8678
|
+
}
|
8679
|
+
|
8680
|
+
|
8681
|
+
SWIGINTERN VALUE
|
8682
|
+
_wrap_TextInput_delete_forward(int argc, VALUE *argv, VALUE self) {
|
8683
|
+
Gosu::TextInput *arg1 = (Gosu::TextInput *) 0 ;
|
8684
|
+
void *argp1 = 0 ;
|
8685
|
+
int res1 = 0 ;
|
8686
|
+
|
8687
|
+
if ((argc < 0) || (argc > 0)) {
|
8688
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
8689
|
+
}
|
8690
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__TextInput, 0 | 0 );
|
8691
|
+
if (!SWIG_IsOK(res1)) {
|
8692
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::TextInput *","delete_forward", 1, self ));
|
8693
|
+
}
|
8694
|
+
arg1 = reinterpret_cast< Gosu::TextInput * >(argp1);
|
8695
|
+
{
|
8696
|
+
try {
|
8697
|
+
(arg1)->delete_forward();
|
8698
|
+
}
|
8699
|
+
catch (const std::exception& e) {
|
8700
|
+
SWIG_exception(SWIG_RuntimeError, e.what());
|
8701
|
+
}
|
8702
|
+
}
|
8703
|
+
return Qnil;
|
8704
|
+
fail:
|
8705
|
+
return Qnil;
|
8706
|
+
}
|
8707
|
+
|
8708
|
+
|
8709
|
+
SWIGINTERN VALUE
|
8710
|
+
_wrap_TextInput_delete_backward(int argc, VALUE *argv, VALUE self) {
|
8711
|
+
Gosu::TextInput *arg1 = (Gosu::TextInput *) 0 ;
|
8712
|
+
void *argp1 = 0 ;
|
8713
|
+
int res1 = 0 ;
|
8714
|
+
|
8715
|
+
if ((argc < 0) || (argc > 0)) {
|
8716
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
8717
|
+
}
|
8718
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__TextInput, 0 | 0 );
|
8719
|
+
if (!SWIG_IsOK(res1)) {
|
8720
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::TextInput *","delete_backward", 1, self ));
|
8721
|
+
}
|
8722
|
+
arg1 = reinterpret_cast< Gosu::TextInput * >(argp1);
|
8723
|
+
{
|
8724
|
+
try {
|
8725
|
+
(arg1)->delete_backward();
|
8726
|
+
}
|
8727
|
+
catch (const std::exception& e) {
|
8728
|
+
SWIG_exception(SWIG_RuntimeError, e.what());
|
8729
|
+
}
|
8730
|
+
}
|
8731
|
+
return Qnil;
|
8732
|
+
fail:
|
8733
|
+
return Qnil;
|
8734
|
+
}
|
8735
|
+
|
8736
|
+
|
8567
8737
|
SWIGINTERN VALUE
|
8568
8738
|
_wrap_TextInput_caret_pos(int argc, VALUE *argv, VALUE self) {
|
8569
8739
|
Gosu::TextInput *arg1 = (Gosu::TextInput *) 0 ;
|
@@ -10910,6 +11080,45 @@ fail:
|
|
10910
11080
|
}
|
10911
11081
|
|
10912
11082
|
|
11083
|
+
SWIGINTERN VALUE
|
11084
|
+
_wrap_render(int argc, VALUE *argv, VALUE self) {
|
11085
|
+
int arg1 ;
|
11086
|
+
int arg2 ;
|
11087
|
+
int val1 ;
|
11088
|
+
int ecode1 = 0 ;
|
11089
|
+
int val2 ;
|
11090
|
+
int ecode2 = 0 ;
|
11091
|
+
Gosu::Image *result = 0 ;
|
11092
|
+
VALUE vresult = Qnil;
|
11093
|
+
|
11094
|
+
if ((argc < 2) || (argc > 2)) {
|
11095
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
11096
|
+
}
|
11097
|
+
ecode1 = SWIG_AsVal_int(argv[0], &val1);
|
11098
|
+
if (!SWIG_IsOK(ecode1)) {
|
11099
|
+
SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","Gosu::render", 1, argv[0] ));
|
11100
|
+
}
|
11101
|
+
arg1 = static_cast< int >(val1);
|
11102
|
+
ecode2 = SWIG_AsVal_int(argv[1], &val2);
|
11103
|
+
if (!SWIG_IsOK(ecode2)) {
|
11104
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Gosu::render", 2, argv[1] ));
|
11105
|
+
}
|
11106
|
+
arg2 = static_cast< int >(val2);
|
11107
|
+
{
|
11108
|
+
try {
|
11109
|
+
result = (Gosu::Image *)Gosu::render(arg1,arg2);
|
11110
|
+
}
|
11111
|
+
catch (const std::exception& e) {
|
11112
|
+
SWIG_exception(SWIG_RuntimeError, e.what());
|
11113
|
+
}
|
11114
|
+
}
|
11115
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Gosu__Image, 0 | 0 );
|
11116
|
+
return vresult;
|
11117
|
+
fail:
|
11118
|
+
return Qnil;
|
11119
|
+
}
|
11120
|
+
|
11121
|
+
|
10913
11122
|
SWIGINTERN VALUE
|
10914
11123
|
_wrap_transform(int argc, VALUE *argv, VALUE self) {
|
10915
11124
|
double arg1 ;
|
@@ -11760,6 +11969,7 @@ SWIGEXPORT void Init_gosu(void) {
|
|
11760
11969
|
rb_define_method(SwigClassImage.klass, "rows", VALUEFUNC(_wrap_Image_rows), -1);
|
11761
11970
|
rb_define_method(SwigClassImage.klass, "save", VALUEFUNC(_wrap_Image_save), -1);
|
11762
11971
|
rb_define_method(SwigClassImage.klass, "insert", VALUEFUNC(_wrap_Image_insert), -1);
|
11972
|
+
rb_define_method(SwigClassImage.klass, "inspect", VALUEFUNC(_wrap_Image_inspect), -1);
|
11763
11973
|
SwigClassImage.mark = 0;
|
11764
11974
|
SwigClassImage.destroy = (void (*)(void *)) free_Gosu_Image;
|
11765
11975
|
SwigClassImage.trackObjects = 1;
|
@@ -11767,8 +11977,7 @@ SWIGEXPORT void Init_gosu(void) {
|
|
11767
11977
|
|
11768
11978
|
SwigClassChannel.klass = rb_define_class_under(mGosu, "Channel", rb_cObject);
|
11769
11979
|
SWIG_TypeClientData(SWIGTYPE_p_Gosu__Channel, (void *) &SwigClassChannel);
|
11770
|
-
|
11771
|
-
rb_define_method(SwigClassChannel.klass, "initialize", VALUEFUNC(_wrap_new_Channel), -1);
|
11980
|
+
rb_undef_alloc_func(SwigClassChannel.klass);
|
11772
11981
|
rb_define_method(SwigClassChannel.klass, "current_channel", VALUEFUNC(_wrap_Channel_current_channel), -1);
|
11773
11982
|
rb_define_method(SwigClassChannel.klass, "playing?", VALUEFUNC(_wrap_Channel_playingq___), -1);
|
11774
11983
|
rb_define_method(SwigClassChannel.klass, "paused?", VALUEFUNC(_wrap_Channel_pausedq___), -1);
|
@@ -12033,6 +12242,9 @@ SWIGEXPORT void Init_gosu(void) {
|
|
12033
12242
|
rb_define_method(SwigClassTextInput.klass, "text", VALUEFUNC(_wrap_TextInput_text), -1);
|
12034
12243
|
rb_define_method(SwigClassTextInput.klass, "text=", VALUEFUNC(_wrap_TextInput_texte___), -1);
|
12035
12244
|
rb_define_method(SwigClassTextInput.klass, "filter", VALUEFUNC(_wrap_TextInput_filter), -1);
|
12245
|
+
rb_define_method(SwigClassTextInput.klass, "insert_text", VALUEFUNC(_wrap_TextInput_insert_text), -1);
|
12246
|
+
rb_define_method(SwigClassTextInput.klass, "delete_forward", VALUEFUNC(_wrap_TextInput_delete_forward), -1);
|
12247
|
+
rb_define_method(SwigClassTextInput.klass, "delete_backward", VALUEFUNC(_wrap_TextInput_delete_backward), -1);
|
12036
12248
|
rb_define_method(SwigClassTextInput.klass, "caret_pos", VALUEFUNC(_wrap_TextInput_caret_pos), -1);
|
12037
12249
|
rb_define_method(SwigClassTextInput.klass, "caret_pos=", VALUEFUNC(_wrap_TextInput_caret_pose___), -1);
|
12038
12250
|
rb_define_method(SwigClassTextInput.klass, "selection_start", VALUEFUNC(_wrap_TextInput_selection_start), -1);
|
@@ -12094,6 +12306,7 @@ SWIGEXPORT void Init_gosu(void) {
|
|
12094
12306
|
rb_define_module_function(mGosu, "unsafe_gl", VALUEFUNC(_wrap_unsafe_gl), -1);
|
12095
12307
|
rb_define_module_function(mGosu, "clip_to", VALUEFUNC(_wrap_clip_to), -1);
|
12096
12308
|
rb_define_module_function(mGosu, "record", VALUEFUNC(_wrap_record), -1);
|
12309
|
+
rb_define_module_function(mGosu, "render", VALUEFUNC(_wrap_render), -1);
|
12097
12310
|
rb_define_module_function(mGosu, "transform", VALUEFUNC(_wrap_transform), -1);
|
12098
12311
|
rb_define_module_function(mGosu, "rotate", VALUEFUNC(_wrap_rotate), -1);
|
12099
12312
|
rb_define_module_function(mGosu, "scale", VALUEFUNC(_wrap_scale), -1);
|