gosu 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a7232fe12b9c8879a9cfa88e30f9ce0cf61916c
4
- data.tar.gz: 02b5c36e500dcd641fc70ee65d6d316dc16f3dba
3
+ metadata.gz: 9dd9d811276727fc5e26cbc71d0e9b2daa725e6c
4
+ data.tar.gz: 102374ca1712c842dfcee84a1ca1126f249bead9
5
5
  SHA512:
6
- metadata.gz: ac51f4a214b0077dd7817ef0e5e741a1618019b3c7e552a0dc80cd3ae1897ea626d3be2e180b4a76b0603dc7fe5f057a57203d50550bde76e61a8f820bd50fe3
7
- data.tar.gz: 09520284f76e8efad4dec94ffa584768f0c3c11882c845db9139dc6a7baa02ba4687efd463d43a86f253d44b92a81de61b8e2068b22b9c3f170bc673d63eed6e
6
+ metadata.gz: 54e65a75e825089dfc9a3facbec4e1cce0890e19ef3819ad1be9c85d211556eca716f6f85b0c75339bd234d2ef9cafbc41d3162d35370e34a06e7299fe7e129a
7
+ data.tar.gz: 1fc52fd3b82082cdbf6ec50575461f6579d0da13940931d02ebaf3e6fa1d82e05ed335e592bddddcd7cfb661ff28860e83c3240f7b04003a6e4523b2299f8743
@@ -3,8 +3,8 @@
3
3
 
4
4
  #define GOSU_MAJOR_VERSION 0
5
5
  #define GOSU_MINOR_VERSION 10
6
- #define GOSU_POINT_VERSION 2
7
- #define GOSU_VERSION "0.10.2"
6
+ #define GOSU_POINT_VERSION 3
7
+ #define GOSU_VERSION "0.10.3"
8
8
 
9
9
  #define GOSU_COPYRIGHT_NOTICE \
10
10
  "This software uses the following third-party libraries:\n" \
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.6
3
+ * Version 3.0.7
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -2183,7 +2183,7 @@ static VALUE mGosu;
2183
2183
  #define SWIG_RUBY_THREAD_END_BLOCK
2184
2184
 
2185
2185
 
2186
- #define SWIGVERSION 0x030006
2186
+ #define SWIGVERSION 0x030007
2187
2187
  #define SWIG_VERSION SWIGVERSION
2188
2188
 
2189
2189
 
@@ -2467,7 +2467,7 @@ SWIG_ruby_failed(void)
2467
2467
  }
2468
2468
 
2469
2469
 
2470
- /*@SWIG:/usr/local/Cellar/swig/3.0.6/share/swig/3.0.6/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2470
+ /*@SWIG:/usr/local/Cellar/swig/3.0.7/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2471
2471
  SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
2472
2472
  {
2473
2473
  VALUE obj = args[0];
@@ -2509,7 +2509,7 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2509
2509
  #include <string>
2510
2510
 
2511
2511
 
2512
- /*@SWIG:/usr/local/Cellar/swig/3.0.6/share/swig/3.0.6/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2512
+ /*@SWIG:/usr/local/Cellar/swig/3.0.7/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2513
2513
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2514
2514
  {
2515
2515
  VALUE obj = args[0];
@@ -2608,7 +2608,7 @@ SWIG_From_bool (bool value)
2608
2608
  }
2609
2609
 
2610
2610
 
2611
- /*@SWIG:/usr/local/Cellar/swig/3.0.6/share/swig/3.0.6/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2611
+ /*@SWIG:/usr/local/Cellar/swig/3.0.7/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2612
2612
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2613
2613
  {
2614
2614
  VALUE obj = args[0];
@@ -11169,8 +11169,8 @@ SWIGEXPORT void Init_gosu(void) {
11169
11169
  SWIG_RubyInitializeTrackings();
11170
11170
  rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(0)));
11171
11171
  rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(10)));
11172
- rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(2)));
11173
- rb_define_const(mGosu, "VERSION", SWIG_FromCharPtr("0.10.2"));
11172
+ rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(3)));
11173
+ rb_define_const(mGosu, "VERSION", SWIG_FromCharPtr("0.10.3"));
11174
11174
  rb_define_const(mGosu, "GOSU_COPYRIGHT_NOTICE", SWIG_FromCharPtr("This software uses the following third-party libraries:\n\nGosu, http://www.libgosu.org, MIT License, http://opensource.org/licenses/MIT\nSDL 2, http://www.libsdl.org, MIT License, http://opensource.org/licenses/MIT\nlibsndfile, http://www.mega-nerd.com/libsndfile, GNU LGPL 3, http://www.gnu.org/copyleft/lesser.html\nOpenAL Soft, http://kcat.strangesoft.net/openal.html, GNU LGPL 2, http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html\n"));
11175
11175
  rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
11176
11176
  rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.6
3
+ * Version 3.0.7
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1,5 +1,6 @@
1
1
  #include <Gosu/TextInput.hpp>
2
2
  #include <Gosu/Input.hpp>
3
+ #include <Gosu/Platform.hpp>
3
4
  #include <Gosu/Utility.hpp>
4
5
  #include <SDL.h>
5
6
  #include <cwctype>
@@ -199,26 +200,47 @@ bool Gosu::TextInput::feedSDLEvent(void* event)
199
200
  return false;
200
201
  }
201
202
 
202
- bool ctrlDown = (e->key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL));
203
+ #ifdef GOSU_IS_MAC
204
+ bool words = (e->key.keysym.mod & (KMOD_LALT | KMOD_RALT));
205
+ bool commandDown = (e->key.keysym.mod & (KMOD_LGUI | KMOD_RGUI));
206
+ #else
207
+ bool words = (e->key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL));
208
+ #endif
203
209
  bool shiftDown = (e->key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT));
204
210
  SDL_Keycode key = e->key.keysym.sym;
205
211
 
206
212
  switch (key) {
207
213
  case SDLK_LEFT:
208
- if (ctrlDown)
214
+ #ifdef GOSU_IS_MAC
215
+ if (commandDown)
216
+ pimpl->moveToBeginningOfLine(! shiftDown);
217
+ else
218
+ #endif
219
+ if (words)
209
220
  pimpl->moveWordLeft(! shiftDown);
210
221
  else
211
222
  pimpl->moveLeft(! shiftDown);
212
223
  return true;
213
224
  case SDLK_RIGHT:
214
- if (ctrlDown)
225
+ #ifdef GOSU_IS_MAC
226
+ if (commandDown)
227
+ pimpl->moveToEndOfLine(! shiftDown);
228
+ else
229
+ #endif
230
+ if (words)
215
231
  pimpl->moveWordRight(! shiftDown);
216
232
  else
217
233
  pimpl->moveRight(! shiftDown);
218
234
  return true;
235
+ #ifdef GOSU_IS_MAC
236
+ case SDLK_UP:
237
+ #endif
219
238
  case SDLK_HOME:
220
239
  pimpl->moveToBeginningOfLine(! shiftDown);
221
240
  return true;
241
+ #ifdef GOSU_IS_MAC
242
+ case SDLK_DOWN:
243
+ #endif
222
244
  case SDLK_END:
223
245
  pimpl->moveToEndOfLine(! shiftDown);
224
246
  return true;
@@ -119,7 +119,7 @@ namespace Gosu
119
119
  DEFAULT_PITCH | FF_DONTCARE };
120
120
 
121
121
  // Don't rely on wcsncpy being in std::...
122
- using namepace std;
122
+ using namespace std;
123
123
  wcsncpy(logfont.lfFaceName, fontName.c_str(), LF_FACESIZE);
124
124
  logfont.lfFaceName[LF_FACESIZE - 1] = 0;
125
125
 
@@ -119,8 +119,6 @@ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double up
119
119
  }
120
120
  }
121
121
 
122
- // TODO - it would be better/enough to only do this in show()
123
-
124
122
  SDL_SetWindowTitle(sharedWindow(), "");
125
123
  SDL_SetWindowSize(sharedWindow(), actualWidth, actualHeight);
126
124
  SDL_SetWindowPosition(sharedWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
@@ -128,8 +126,7 @@ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double up
128
126
  {
129
127
  SDL_SetWindowFullscreen(sharedWindow(), fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
130
128
  }
131
- SDL_ShowWindow(sharedWindow());
132
-
129
+
133
130
  #if SDL_VERSION_ATLEAST(2, 0, 1)
134
131
  SDL_GL_GetDrawableSize(sharedWindow(), &actualWidth, &actualHeight);
135
132
  #endif
@@ -183,12 +180,19 @@ void Gosu::Window::show()
183
180
 
184
181
  bool Gosu::Window::tick()
185
182
  {
183
+ if (SDL_GetWindowFlags(sharedWindow()) & SDL_WINDOW_HIDDEN) {
184
+ SDL_ShowWindow(sharedWindow());
185
+ }
186
+
186
187
  SDL_Event e;
187
188
  while (SDL_PollEvent(&e)) {
188
- if (e.type == SDL_QUIT)
189
+ if (e.type == SDL_QUIT) {
190
+ SDL_HideWindow(sharedWindow());
189
191
  return false;
190
- else
192
+ }
193
+ else {
191
194
  input().feedSDLEvent(&e);
195
+ }
192
196
  }
193
197
 
194
198
  Song::update();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Raschke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-13 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  2D game development library.
@@ -100,7 +100,6 @@ files:
100
100
  - src/DirectoriesApple.mm
101
101
  - src/Graphics/ResolutionApple.mm
102
102
  - src/Input/InputUIKit.mm
103
- - src/Input/TextInputMac.mm
104
103
  - src/Text/TextApple.mm
105
104
  - src/UIKit/GosuAppDelegate.mm
106
105
  - src/UIKit/GosuGLView.mm
@@ -1,222 +0,0 @@
1
- #include <Gosu/TextInput.hpp>
2
- #include <Gosu/Buttons.hpp>
3
- #include "MacUtility.hpp"
4
- #include <algorithm>
5
- #include <vector>
6
- #include <wctype.h>
7
-
8
- #import <Cocoa/Cocoa.h>
9
-
10
- #define CARET_POS (*_caretPos)
11
- #define SEL_START (*_selectionStart)
12
- #define IMPL_WITH_SEL_RESET(selector) \
13
- - (void)selector:(id)sender \
14
- { \
15
- [self selector##AndModifySelection:sender]; \
16
- SEL_START = CARET_POS; \
17
- }
18
-
19
- @interface GosuTextInput : NSResponder
20
- {
21
- Gosu::TextInput* _filter;
22
- std::wstring* _text;
23
- unsigned* _caretPos;
24
- unsigned* _selectionStart;
25
- }
26
- @end
27
- @implementation GosuTextInput
28
- - (void)insertText:(id)insertString
29
- {
30
- // Delete (overwrite) previous selection.
31
- if (CARET_POS != SEL_START)
32
- {
33
- unsigned min = std::min(CARET_POS, SEL_START);
34
- unsigned max = std::max(CARET_POS, SEL_START);
35
- _text->erase(_text->begin() + min, _text->begin() + max);
36
- CARET_POS = SEL_START = min;
37
- }
38
-
39
- NSString* str = (NSString*)insertString;
40
-
41
- if ([str length] == 0)
42
- return;
43
-
44
- std::vector<unichar> unibuf([str length]);
45
- [str getCharacters: &unibuf[0]];
46
-
47
- std::wstring text = _filter->filter(std::wstring(unibuf.begin(), unibuf.end()));
48
-
49
- _text->insert(_text->begin() + CARET_POS, text.begin(), text.end());
50
- (CARET_POS) += text.size();
51
- (SEL_START) = CARET_POS;
52
- }
53
-
54
- // Movement.
55
-
56
- - (void)moveLeftAndModifySelection:(id)sender
57
- {
58
- if (CARET_POS > 0)
59
- (CARET_POS) -= 1;
60
- }
61
- - (void)moveRightAndModifySelection:(id)sender
62
- {
63
- if (CARET_POS < _text->length())
64
- (CARET_POS) += 1;
65
- }
66
- - (void)moveUpAndModifySelection:(id)sender
67
- {
68
- CARET_POS = 0;
69
- }
70
- - (void)moveDownAndModifySelection:(id)sender
71
- {
72
- CARET_POS = _text->length();
73
- }
74
- - (void)moveToBeginningOfLineAndModifySelection:(id)sender
75
- {
76
- [self moveUpAndModifySelection: sender];
77
- }
78
- - (void)moveToEndOfLineAndModifySelection:(id)sender
79
- {
80
- [self moveDownAndModifySelection: sender];
81
- }
82
- - (void)moveToBeginningOfDocumentAndModifySelection:(id)sender
83
- {
84
- [self moveUpAndModifySelection: sender];
85
- }
86
- - (void)moveToEndOfDocumentAndModifySelection:(id)sender
87
- {
88
- [self moveDownAndModifySelection: sender];
89
- }
90
- - (void)moveWordLeftAndModifySelection:(id)sender
91
- {
92
- if (CARET_POS == _text->length())
93
- --CARET_POS;
94
-
95
- while (CARET_POS > 0 && iswspace(_text->at(CARET_POS - 1)))
96
- --CARET_POS;
97
-
98
- while (CARET_POS > 0 && !iswspace(_text->at(CARET_POS - 1)))
99
- --CARET_POS;
100
- }
101
- - (void)moveWordRightAndModifySelection:(id)sender
102
- {
103
- while (CARET_POS < _text->length() && iswspace(_text->at(CARET_POS)))
104
- ++CARET_POS;
105
-
106
- while (CARET_POS < _text->length() && !iswspace(_text->at(CARET_POS)))
107
- ++CARET_POS;
108
- }
109
-
110
- IMPL_WITH_SEL_RESET(moveLeft)
111
- IMPL_WITH_SEL_RESET(moveRight)
112
- IMPL_WITH_SEL_RESET(moveUp)
113
- IMPL_WITH_SEL_RESET(moveDown)
114
- IMPL_WITH_SEL_RESET(moveWordLeft)
115
- IMPL_WITH_SEL_RESET(moveWordRight)
116
- IMPL_WITH_SEL_RESET(moveToBeginningOfLine)
117
- IMPL_WITH_SEL_RESET(moveToEndOfLine)
118
- IMPL_WITH_SEL_RESET(moveToBeginningOfDocument)
119
- IMPL_WITH_SEL_RESET(moveToEndOfDocument)
120
-
121
- // Deletion.
122
-
123
- - (void)deleteBackward:(id)sender
124
- {
125
- if (CARET_POS == SEL_START && CARET_POS > 0)
126
- --CARET_POS;
127
- [self insertText: @""];
128
- }
129
- - (void)deleteForward:(id)sender
130
- {
131
- if (CARET_POS == SEL_START && CARET_POS < _text->length())
132
- ++CARET_POS;
133
- [self insertText: @""];
134
- }
135
-
136
- // TODO: Advanced deletion (deleteWord...)
137
-
138
- // Selection.
139
-
140
- - (void)selectAll:(id)sender
141
- {
142
- SEL_START = 0;
143
- CARET_POS = _text->length();
144
- }
145
-
146
- // TODO: Cmd+A should really be hard-coded into selectAll.
147
-
148
- // Helper to set up this instance.
149
-
150
- - (void)setFilter:(Gosu::TextInput&)filter andText:(std::wstring&)text
151
- andCaretPos:(unsigned&)caretPos andSelectionStart:(unsigned&)selectionStart
152
- {
153
- _filter = &filter;
154
- _text = &text;
155
- _caretPos = &caretPos;
156
- _selectionStart = &selectionStart;
157
- }
158
- @end
159
-
160
- struct Gosu::TextInput::Impl
161
- {
162
- ObjRef<GosuTextInput> responder;
163
- std::wstring text;
164
- unsigned caretPos, selectionStart;
165
- Impl() : caretPos(0), selectionStart(0) {}
166
- };
167
-
168
- Gosu::TextInput::TextInput()
169
- : pimpl(new Impl)
170
- {
171
- pimpl->responder.reset([[GosuTextInput alloc] init]);
172
- [pimpl->responder.get() setFilter: *this andText: pimpl->text
173
- andCaretPos: pimpl->caretPos andSelectionStart: pimpl->selectionStart];
174
- }
175
-
176
- Gosu::TextInput::~TextInput()
177
- {
178
- }
179
-
180
- std::wstring Gosu::TextInput::text() const
181
- {
182
- return pimpl->text;
183
- }
184
-
185
- void Gosu::TextInput::setText(const std::wstring& text)
186
- {
187
- pimpl->text = text;
188
- pimpl->caretPos = pimpl->selectionStart = text.length();
189
- }
190
-
191
- unsigned Gosu::TextInput::caretPos() const
192
- {
193
- return pimpl->caretPos;
194
- }
195
-
196
- void Gosu::TextInput::setCaretPos(unsigned pos)
197
- {
198
- pimpl->caretPos = pos;
199
- }
200
-
201
- unsigned Gosu::TextInput::selectionStart() const
202
- {
203
- return pimpl->selectionStart;
204
- }
205
-
206
- void Gosu::TextInput::setSelectionStart(unsigned pos)
207
- {
208
- pimpl->selectionStart = pos;
209
- }
210
-
211
- bool Gosu::TextInput::feedNSEvent(void* event)
212
- {
213
- NSEvent* nsEvent = (NSEvent*)event;
214
- long keyCode = [nsEvent keyCode];
215
- if (keyCode != kbEscape && keyCode != kbTab && keyCode != kbReturn && keyCode != kbEnter)
216
- {
217
- [pimpl->responder.get() interpretKeyEvents: [NSArray arrayWithObject: nsEvent]];
218
- return true;
219
- }
220
- else
221
- return false;
222
- }