gosu 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +1 -1
- data/ext/gosu/extconf.rb +5 -1
- data/include/Gosu/Font.hpp +7 -9
- data/include/Gosu/Graphics.hpp +6 -4
- data/include/Gosu/GraphicsBase.hpp +6 -6
- data/include/Gosu/Image.hpp +3 -3
- data/include/Gosu/ImageData.hpp +1 -1
- data/include/Gosu/Text.hpp +4 -4
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +23 -9
- data/lib/gosu/compat.rb +4 -0
- data/lib/gosu/swig_patches.rb +11 -10
- data/rdoc/gosu.rb +14 -1
- data/src/EmptyImageData.hpp +1 -1
- data/src/Font.cpp +4 -4
- data/src/Graphics.cpp +4 -4
- data/src/Image.cpp +4 -3
- data/src/Input.cpp +1 -10
- data/src/LargeImageData.cpp +1 -1
- data/src/LargeImageData.hpp +1 -1
- data/src/Macro.cpp +100 -143
- data/src/Macro.hpp +1 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +111 -63
- data/src/RubyGosu.cxx +222 -124
- data/src/RubyGosu.h +2 -2
- data/src/TexChunk.cpp +1 -1
- data/src/TexChunk.hpp +1 -1
- data/src/TrueTypeFontApple.cpp +10 -2
- data/src/TrueTypeFontWin.cpp +3 -3
- data/src/Utility.cpp +52 -23
- data/src/Window.cpp +60 -31
- data/src/WindowUIKit.cpp +21 -9
- metadata +3 -25
- data/include/Gosu/Channel.h +0 -25
- data/include/Gosu/Color.h +0 -38
- data/include/Gosu/Font.h +0 -36
- data/include/Gosu/Gosu.h +0 -82
- data/include/Gosu/Image.h +0 -54
- data/include/Gosu/Sample.h +0 -19
- data/include/Gosu/Song.h +0 -24
- data/include/Gosu/TextInput.h +0 -30
- data/include/Gosu/Window.h +0 -63
- data/src/ChannelWrapper.cpp +0 -50
- data/src/ColorWrapper.cpp +0 -126
- data/src/Constants.cpp +0 -338
- data/src/FontWrapper.cpp +0 -74
- data/src/GosuWrapper.cpp +0 -251
- data/src/ImageWrapper.cpp +0 -168
- data/src/MPEGFile.hpp +0 -90
- data/src/SampleWrapper.cpp +0 -30
- data/src/SongWrapper.cpp +0 -52
- data/src/TextInputWrapper.cpp +0 -101
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
- data/src/WindowWrapper.cpp +0 -317
data/src/ImageWrapper.cpp
DELETED
@@ -1,168 +0,0 @@
|
|
1
|
-
#include <Gosu/Gosu.hpp>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <cstring>
|
4
|
-
|
5
|
-
extern "C" {
|
6
|
-
#include <Gosu/Image.h>
|
7
|
-
|
8
|
-
// Constructors
|
9
|
-
Gosu_Image *Gosu_Image_create(const char *filename, unsigned image_flags)
|
10
|
-
{
|
11
|
-
return reinterpret_cast<Gosu_Image *>(new Gosu::Image(filename, image_flags));
|
12
|
-
};
|
13
|
-
|
14
|
-
Gosu_Image *Gosu_Image_create_from_markup(const char *markup, const char *font, double font_height,
|
15
|
-
int width, double spacing, unsigned align, unsigned font_flags, unsigned image_flags)
|
16
|
-
{
|
17
|
-
Gosu::Bitmap bitmap = Gosu::layout_markup(markup, font, font_height, spacing, width,
|
18
|
-
(Gosu::Alignment)align, font_flags);
|
19
|
-
return reinterpret_cast<Gosu_Image *>(new Gosu::Image(bitmap, image_flags));
|
20
|
-
}
|
21
|
-
|
22
|
-
Gosu_Image *Gosu_Image_create_from_text(const char *text, const char *font, double font_height,
|
23
|
-
int width, double spacing, unsigned align, unsigned font_flags, unsigned image_flags)
|
24
|
-
{
|
25
|
-
Gosu::Bitmap bitmap = Gosu::layout_text(text, font, font_height, spacing, width,
|
26
|
-
(Gosu::Alignment)align, font_flags);
|
27
|
-
return reinterpret_cast<Gosu_Image *>(new Gosu::Image(bitmap, image_flags));
|
28
|
-
}
|
29
|
-
|
30
|
-
Gosu_Image *Gosu_Image_create_from_blob(unsigned char *blob, int byte_count, int columns, int rows, unsigned image_flags)
|
31
|
-
{
|
32
|
-
std::size_t size = columns * rows * 4;
|
33
|
-
Gosu::Bitmap bitmap(columns, rows, Gosu::Color::NONE);
|
34
|
-
|
35
|
-
if (byte_count == size) {
|
36
|
-
// 32 bit per pixel, assume R8G8B8A8
|
37
|
-
std::memcpy(bitmap.data(), blob, size);
|
38
|
-
}
|
39
|
-
else if (byte_count == size * sizeof(float)) {
|
40
|
-
// 128 bit per channel, assume float/float/float/float
|
41
|
-
const float *in = reinterpret_cast<const float *>(blob);
|
42
|
-
Gosu::Color::Channel *out = reinterpret_cast<Gosu::Color::Channel *>(bitmap.data());
|
43
|
-
for (int i = size; i > 0; --i) {
|
44
|
-
*(out++) = static_cast<Gosu::Color::Channel>(*(in++) * 255);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
else {
|
48
|
-
return nullptr; // abort?
|
49
|
-
}
|
50
|
-
|
51
|
-
return reinterpret_cast<Gosu_Image *>(new Gosu::Image(bitmap, image_flags));
|
52
|
-
}
|
53
|
-
|
54
|
-
Gosu_Image *Gosu_Image_create_from_subimage(Gosu_Image *image, int left, int top, int width, int height)
|
55
|
-
{
|
56
|
-
Gosu::Image *gosu_image = reinterpret_cast<Gosu::Image *>(image);
|
57
|
-
std::unique_ptr<Gosu::ImageData> image_data = gosu_image->data().subimage(left, top, width, height);
|
58
|
-
|
59
|
-
return reinterpret_cast<Gosu_Image *>(image_data.get() ? new Gosu::Image(std::move(image_data)) : nullptr);
|
60
|
-
}
|
61
|
-
|
62
|
-
void Gosu_Image_create_from_tiles(const char *source, int tile_width, int tile_height, void function(void *data, Gosu_Image *image), void *data, unsigned image_flags)
|
63
|
-
{
|
64
|
-
std::vector<Gosu::Image> gosu_images = Gosu::load_tiles(source, tile_width, tile_height, image_flags);
|
65
|
-
|
66
|
-
for (Gosu::Image &img : gosu_images) {
|
67
|
-
function(data, reinterpret_cast<Gosu_Image *>(new Gosu::Image(img)));
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
void Gosu_Image_create_tiles_from_image(Gosu_Image *image, int tile_width, int tile_height, void function(void *data, Gosu_Image *image), void *data, unsigned image_flags)
|
72
|
-
{
|
73
|
-
std::vector<Gosu::Image> gosu_images = Gosu::load_tiles(reinterpret_cast<Gosu::Image *>(image)->data().to_bitmap(), tile_width, tile_height, image_flags);
|
74
|
-
|
75
|
-
for (Gosu::Image &img : gosu_images) {
|
76
|
-
function(data, reinterpret_cast<Gosu_Image *>(new Gosu::Image(img)));
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
// Properties
|
81
|
-
unsigned Gosu_Image_width(Gosu_Image *image)
|
82
|
-
{
|
83
|
-
return reinterpret_cast<Gosu::Image *>(image)->width();
|
84
|
-
}
|
85
|
-
|
86
|
-
unsigned Gosu_Image_height(Gosu_Image *image)
|
87
|
-
{
|
88
|
-
return reinterpret_cast<Gosu::Image *>(image)->height();
|
89
|
-
}
|
90
|
-
|
91
|
-
Gosu_GLTexInfo *Gosu_Image_gl_tex_info_create(Gosu_Image *image)
|
92
|
-
{
|
93
|
-
Gosu::Image *gosu_image = reinterpret_cast<Gosu::Image *>(image);
|
94
|
-
Gosu::GLTexInfo *gosu_texture_info = new Gosu::GLTexInfo(*gosu_image->data().gl_tex_info());
|
95
|
-
if (gosu_texture_info) {
|
96
|
-
return reinterpret_cast<Gosu_GLTexInfo *>(gosu_texture_info);
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
return nullptr;
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
void Gosu_Image_gl_tex_info_destroy(Gosu_GLTexInfo *gl_tex_info)
|
104
|
-
{
|
105
|
-
delete (reinterpret_cast<Gosu::GLTexInfo *>(gl_tex_info));
|
106
|
-
}
|
107
|
-
|
108
|
-
// Rendering
|
109
|
-
void Gosu_Image_draw(Gosu_Image *image, double x, double y, double z, double scale_x, double scale_y, unsigned color, unsigned mode)
|
110
|
-
{
|
111
|
-
reinterpret_cast<Gosu::Image *>(image)->draw(x, y, z, scale_x, scale_y, color, (Gosu::AlphaMode)mode);
|
112
|
-
}
|
113
|
-
|
114
|
-
void Gosu_Image_draw_rot(Gosu_Image *image, double x, double y, double z,
|
115
|
-
double angle, double center_x, double center_y,
|
116
|
-
double scale_x, double scale_y, unsigned color, unsigned mode)
|
117
|
-
{
|
118
|
-
reinterpret_cast<Gosu::Image *>(image)->draw_rot(x, y, z,
|
119
|
-
angle, center_x, center_y,
|
120
|
-
scale_x, scale_y,
|
121
|
-
color, (Gosu::AlphaMode)mode);
|
122
|
-
}
|
123
|
-
|
124
|
-
void Gosu_Image_draw_as_quad(Gosu_Image *image,
|
125
|
-
double x1, double y1, unsigned color1,
|
126
|
-
double x2, double y2, unsigned color2,
|
127
|
-
double x3, double y3, unsigned color3,
|
128
|
-
double x4, double y4, unsigned color4,
|
129
|
-
double z, unsigned mode)
|
130
|
-
{
|
131
|
-
Gosu::Image *gosu_image = reinterpret_cast<Gosu::Image *>(image);
|
132
|
-
gosu_image->data().draw(
|
133
|
-
x1, y1, color1,
|
134
|
-
x2, y2, color2,
|
135
|
-
x3, y3, color3,
|
136
|
-
x4, y4, color4,
|
137
|
-
z, (Gosu::AlphaMode)mode);
|
138
|
-
}
|
139
|
-
|
140
|
-
// Image operations
|
141
|
-
void Gosu_Image_insert(Gosu_Image *image, Gosu_Image *source, int x, int y)
|
142
|
-
{
|
143
|
-
Gosu::Bitmap bmp;
|
144
|
-
bmp = reinterpret_cast<Gosu::Image *>(source)->data().to_bitmap();
|
145
|
-
reinterpret_cast<Gosu::Image *>(image)->data().insert(bmp, x, y);
|
146
|
-
}
|
147
|
-
|
148
|
-
unsigned char *Gosu_Image_to_blob(Gosu_Image *image)
|
149
|
-
{
|
150
|
-
Gosu::Image *gosu_image = reinterpret_cast<Gosu::Image *>(image);
|
151
|
-
static thread_local Gosu::Bitmap bitmap;
|
152
|
-
bitmap = gosu_image->data().to_bitmap();
|
153
|
-
|
154
|
-
return reinterpret_cast<unsigned char *>(bitmap.data());
|
155
|
-
}
|
156
|
-
|
157
|
-
void Gosu_Image_save(Gosu_Image *image, const char *filename)
|
158
|
-
{
|
159
|
-
Gosu::save_image_file(reinterpret_cast<Gosu::Image *>(image)->data().to_bitmap(), filename);
|
160
|
-
}
|
161
|
-
|
162
|
-
// Destructor
|
163
|
-
void Gosu_Image_destroy(Gosu_Image *image)
|
164
|
-
{
|
165
|
-
delete (reinterpret_cast<Gosu::Image *>(image));
|
166
|
-
}
|
167
|
-
|
168
|
-
}
|
data/src/MPEGFile.hpp
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include "AudioFile.hpp"
|
4
|
-
#include <Gosu/IO.hpp>
|
5
|
-
#include <algorithm>
|
6
|
-
#include <stdexcept>
|
7
|
-
#include <string>
|
8
|
-
|
9
|
-
#include <mpg123.h>
|
10
|
-
|
11
|
-
namespace Gosu
|
12
|
-
{
|
13
|
-
class MPEGFile : public AudioFile
|
14
|
-
{
|
15
|
-
Gosu::Buffer contents_;
|
16
|
-
off_t position_ = 0;
|
17
|
-
mpg123_handle* handle_;
|
18
|
-
|
19
|
-
enum {
|
20
|
-
SAMPLE_RATE = 44100,
|
21
|
-
INPUT_SIZE = 16384
|
22
|
-
};
|
23
|
-
|
24
|
-
public:
|
25
|
-
MPEGFile(Gosu::Reader reader)
|
26
|
-
{
|
27
|
-
contents_.resize(reader.resource().size() - reader.position());
|
28
|
-
reader.read(contents_.data(), contents_.size());
|
29
|
-
|
30
|
-
static int init_error = mpg123_init();
|
31
|
-
if (init_error != MPG123_OK) {
|
32
|
-
throw std::runtime_error("Cannot initialize mpg123: " +
|
33
|
-
std::string(mpg123_plain_strerror(init_error)));
|
34
|
-
}
|
35
|
-
|
36
|
-
int new_error;
|
37
|
-
handle_ = mpg123_new(nullptr, &new_error);
|
38
|
-
if (handle_ == nullptr) {
|
39
|
-
throw std::runtime_error("Cannot initialize mpg123 decoder: " +
|
40
|
-
std::string(mpg123_plain_strerror(new_error)));
|
41
|
-
}
|
42
|
-
|
43
|
-
mpg123_param(handle_, MPG123_FORCE_RATE, SAMPLE_RATE, 0);
|
44
|
-
mpg123_param(handle_, MPG123_FLAGS, MPG123_FORCE_STEREO, 0);
|
45
|
-
|
46
|
-
mpg123_open_feed(handle_);
|
47
|
-
}
|
48
|
-
|
49
|
-
~MPEGFile() override
|
50
|
-
{
|
51
|
-
mpg123_delete(handle_);
|
52
|
-
}
|
53
|
-
|
54
|
-
ALenum format() const override
|
55
|
-
{
|
56
|
-
return AL_FORMAT_STEREO16;
|
57
|
-
}
|
58
|
-
|
59
|
-
ALuint sample_rate() const override
|
60
|
-
{
|
61
|
-
return SAMPLE_RATE;
|
62
|
-
}
|
63
|
-
|
64
|
-
std::size_t read_data(void* dest, std::size_t length) override
|
65
|
-
{
|
66
|
-
std::size_t written = 0;
|
67
|
-
int error = 0;
|
68
|
-
|
69
|
-
error = mpg123_read(handle_, static_cast<unsigned char*>(dest), length, &written);
|
70
|
-
while (written == 0
|
71
|
-
&& (error == MPG123_NEED_MORE || error == MPG123_NEW_FORMAT)
|
72
|
-
&& position_ != contents_.size()) {
|
73
|
-
auto bytes = std::min<std::size_t>(contents_.size() - position_, INPUT_SIZE);
|
74
|
-
// (Not sure what to do about the return value of mpg123_feed here.)
|
75
|
-
mpg123_feed(handle_, static_cast<unsigned char*>(contents_.data()) + position_,
|
76
|
-
bytes);
|
77
|
-
position_ += bytes;
|
78
|
-
error = mpg123_read(handle_, static_cast<unsigned char*>(dest), length, &written);
|
79
|
-
}
|
80
|
-
|
81
|
-
return written;
|
82
|
-
}
|
83
|
-
|
84
|
-
void rewind() override
|
85
|
-
{
|
86
|
-
mpg123_feedseek(handle_, 0, SEEK_SET, &position_);
|
87
|
-
assert (position_ >= 0 && position_ <= contents_.size());
|
88
|
-
}
|
89
|
-
};
|
90
|
-
}
|
data/src/SampleWrapper.cpp
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#include <Gosu/Audio.hpp>
|
2
|
-
#include <Gosu/Sample.h>
|
3
|
-
|
4
|
-
extern "C" {
|
5
|
-
|
6
|
-
Gosu_Sample *Gosu_Sample_create(const char *filename)
|
7
|
-
{
|
8
|
-
return reinterpret_cast<Gosu_Sample *>( new Gosu::Sample(filename) );
|
9
|
-
}
|
10
|
-
|
11
|
-
void Gosu_Sample_destroy(Gosu_Sample *sample)
|
12
|
-
{
|
13
|
-
delete( reinterpret_cast<Gosu::Sample *>( sample ) );
|
14
|
-
}
|
15
|
-
|
16
|
-
Gosu_Channel *Gosu_Sample_play(Gosu_Sample *sample, double volume, double speed, bool looping)
|
17
|
-
{
|
18
|
-
Gosu::Channel channel = reinterpret_cast<Gosu::Sample *>( sample )->play(volume, speed, looping);
|
19
|
-
|
20
|
-
return reinterpret_cast<Gosu_Channel *>( new Gosu::Channel(channel) );
|
21
|
-
}
|
22
|
-
|
23
|
-
Gosu_Channel *Gosu_Sample_play_pan(Gosu_Sample *sample, double pan, double volume, double speed, bool looping)
|
24
|
-
{
|
25
|
-
Gosu::Channel channel = reinterpret_cast<Gosu::Sample *>( sample )->play_pan(pan, volume, speed, looping);
|
26
|
-
|
27
|
-
return reinterpret_cast<Gosu_Channel *>( new Gosu::Channel(channel) );
|
28
|
-
}
|
29
|
-
|
30
|
-
}
|
data/src/SongWrapper.cpp
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
#include <Gosu/Audio.hpp>
|
2
|
-
#include <Gosu/Song.h>
|
3
|
-
|
4
|
-
extern "C" {
|
5
|
-
Gosu_Song* Gosu_Song_create(const char* filename)
|
6
|
-
{
|
7
|
-
return reinterpret_cast<Gosu_Song*>( new Gosu::Song(filename) );
|
8
|
-
}
|
9
|
-
|
10
|
-
void Gosu_Song_destroy(Gosu_Song* song)
|
11
|
-
{
|
12
|
-
delete( reinterpret_cast<Gosu::Song*>( song ));
|
13
|
-
}
|
14
|
-
|
15
|
-
void Gosu_Song_play(Gosu_Song* song, bool looping)
|
16
|
-
{
|
17
|
-
reinterpret_cast<Gosu::Song*>( song )->play(looping);
|
18
|
-
}
|
19
|
-
|
20
|
-
bool Gosu_Song_playing(Gosu_Song* song)
|
21
|
-
{
|
22
|
-
return reinterpret_cast<Gosu::Song*>( song )->playing();
|
23
|
-
}
|
24
|
-
|
25
|
-
void Gosu_Song_pause(Gosu_Song* song)
|
26
|
-
{
|
27
|
-
reinterpret_cast<Gosu::Song*>( song )->pause();
|
28
|
-
}
|
29
|
-
|
30
|
-
bool Gosu_Song_paused(Gosu_Song* song)
|
31
|
-
{
|
32
|
-
return reinterpret_cast<Gosu::Song*>( song )->paused();
|
33
|
-
}
|
34
|
-
|
35
|
-
void Gosu_Song_stop(Gosu_Song* song)
|
36
|
-
{
|
37
|
-
reinterpret_cast<Gosu::Song*>( song )->stop();
|
38
|
-
}
|
39
|
-
|
40
|
-
double Gosu_Song_volume(Gosu_Song* song){
|
41
|
-
return reinterpret_cast<Gosu::Song*>( song )->volume();
|
42
|
-
}
|
43
|
-
|
44
|
-
void Gosu_Song_set_volume(Gosu_Song* song, double volume){
|
45
|
-
return reinterpret_cast<Gosu::Song*>( song )->set_volume(volume);
|
46
|
-
}
|
47
|
-
|
48
|
-
Gosu_Song* Gosu_Song_current_song()
|
49
|
-
{
|
50
|
-
return reinterpret_cast<Gosu_Song*>(Gosu::Song::current_song());
|
51
|
-
}
|
52
|
-
}
|
data/src/TextInputWrapper.cpp
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
#include <Gosu/Gosu.hpp>
|
2
|
-
|
3
|
-
namespace Gosu
|
4
|
-
{
|
5
|
-
class TextInputForWrapper : public Gosu::TextInput
|
6
|
-
{
|
7
|
-
public:
|
8
|
-
TextInputForWrapper();
|
9
|
-
std::string filter(std::string text) const override;
|
10
|
-
std::function<void (const char *text)> filter_callback;
|
11
|
-
std::string filter_result = "";
|
12
|
-
};
|
13
|
-
} // namespace Gosu
|
14
|
-
|
15
|
-
Gosu::TextInputForWrapper::TextInputForWrapper() : Gosu::TextInput()
|
16
|
-
{
|
17
|
-
}
|
18
|
-
|
19
|
-
std::string Gosu::TextInputForWrapper::filter(std::string text) const
|
20
|
-
{
|
21
|
-
if (filter_callback != nullptr) {
|
22
|
-
filter_callback(text.c_str());
|
23
|
-
return filter_result;
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
return text;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
extern "C" {
|
31
|
-
#include <Gosu/TextInput.h>
|
32
|
-
|
33
|
-
Gosu_TextInput *Gosu_TextInput_create()
|
34
|
-
{
|
35
|
-
return reinterpret_cast<Gosu_TextInput *>(new Gosu::TextInputForWrapper());
|
36
|
-
}
|
37
|
-
|
38
|
-
const char *Gosu_TextInput_text(Gosu_TextInput *text_input)
|
39
|
-
{
|
40
|
-
thread_local std::string string;
|
41
|
-
string = reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->text();
|
42
|
-
|
43
|
-
return string.c_str();
|
44
|
-
}
|
45
|
-
|
46
|
-
void Gosu_TextInput_set_text(Gosu_TextInput *text_input, const char *text)
|
47
|
-
{
|
48
|
-
reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->set_text(text);
|
49
|
-
}
|
50
|
-
|
51
|
-
unsigned Gosu_TextInput_caret_pos(Gosu_TextInput *text_input)
|
52
|
-
{
|
53
|
-
return reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->caret_pos();
|
54
|
-
}
|
55
|
-
|
56
|
-
void Gosu_TextInput_set_caret_pos(Gosu_TextInput *text_input, unsigned pos)
|
57
|
-
{
|
58
|
-
return reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->set_caret_pos(pos);
|
59
|
-
}
|
60
|
-
|
61
|
-
unsigned Gosu_TextInput_selection_start(Gosu_TextInput *text_input)
|
62
|
-
{
|
63
|
-
return reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->selection_start();
|
64
|
-
}
|
65
|
-
|
66
|
-
void Gosu_TextInput_set_selection_start(Gosu_TextInput *text_input, unsigned pos)
|
67
|
-
{
|
68
|
-
return reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->set_selection_start(pos);
|
69
|
-
}
|
70
|
-
|
71
|
-
void Gosu_TextInput_set_filter(Gosu_TextInput *text_input, void function(void *data, const char *text), void *data)
|
72
|
-
{
|
73
|
-
reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->filter_callback = [=](const char *text) { function(data, text); };
|
74
|
-
}
|
75
|
-
|
76
|
-
void Gosu_TextInput_set_filter_result(Gosu_TextInput *text_input, const char *result)
|
77
|
-
{
|
78
|
-
reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->filter_result = result;
|
79
|
-
}
|
80
|
-
|
81
|
-
void Gosu_TextInput_insert_text(Gosu_TextInput *text_input, const char *text)
|
82
|
-
{
|
83
|
-
reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->insert_text(text);
|
84
|
-
}
|
85
|
-
|
86
|
-
void Gosu_TextInput_delete_backward(Gosu_TextInput *text_input)
|
87
|
-
{
|
88
|
-
reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->delete_backward();
|
89
|
-
}
|
90
|
-
|
91
|
-
void Gosu_TextInput_delete_forward(Gosu_TextInput *text_input)
|
92
|
-
{
|
93
|
-
reinterpret_cast<Gosu::TextInputForWrapper *>(text_input)->delete_forward();
|
94
|
-
}
|
95
|
-
|
96
|
-
void Gosu_TextInput_destroy(Gosu_TextInput *text_input)
|
97
|
-
{
|
98
|
-
delete (reinterpret_cast<Gosu::TextInputForWrapper *>(text_input));
|
99
|
-
}
|
100
|
-
|
101
|
-
}
|
data/src/UtilityApple.cpp
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#include <Gosu/Platform.hpp>
|
2
|
-
#if defined(GOSU_IS_MAC)
|
3
|
-
|
4
|
-
#import <Gosu/Utility.hpp>
|
5
|
-
#import <Foundation/Foundation.h>
|
6
|
-
using namespace std;
|
7
|
-
|
8
|
-
string Gosu::language()
|
9
|
-
{
|
10
|
-
@autoreleasepool {
|
11
|
-
NSString* language = [NSLocale preferredLanguages][0];
|
12
|
-
return language.UTF8String ?: "en";
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
#endif
|