gosu 0.10.5 → 0.10.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gosu/Graphics.hpp +5 -2
- data/Gosu/GraphicsBase.hpp +0 -14
- data/Gosu/Version.hpp +2 -2
- data/ext/gosu/gosu_wrap.cxx +2 -2
- data/src/Graphics/Graphics.cpp +32 -20
- data/src/Window.cpp +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7e0dac99c81c5a229672c489a3b4a7b4cadb588
|
4
|
+
data.tar.gz: 13fc464f740ed462b7669f27a19f912b19566692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d75d8e44a3dac0d7cea92e1b09d5cfe9ec100de7483992e74c6292d6223e0de2d94d28aa8a56a7bce31c1b3dab7026b48504576de9fbc5325ebb367d9ff73d
|
7
|
+
data.tar.gz: a5e0d9396708b8706b5f0a90f2e2ba6a3294edd7361894665253cc4918295097cf1a43400e0a5ba60941e759a78f867c8940959556a2c24786253e18c8db1ee4
|
data/Gosu/Graphics.hpp
CHANGED
@@ -45,7 +45,7 @@ namespace Gosu
|
|
45
45
|
Graphics(unsigned physicalWidth, unsigned physicalHeight, bool fullscreen);
|
46
46
|
~Graphics();
|
47
47
|
|
48
|
-
void setResolution(unsigned
|
48
|
+
void setResolution(unsigned logicalWidth, unsigned logicalHeight,
|
49
49
|
double horizontalBlackBarWidth = 0, double verticalBlackBarHeight = 0);
|
50
50
|
|
51
51
|
unsigned width() const;
|
@@ -111,7 +111,10 @@ namespace Gosu
|
|
111
111
|
double x3, double y3, Color c3,
|
112
112
|
double x4, double y4, Color c4,
|
113
113
|
ZPos z, AlphaMode mode = amDefault);
|
114
|
-
|
114
|
+
|
115
|
+
//! For internal use only.
|
116
|
+
void setPhysicalResolution(unsigned physicalWidth, unsigned physicalHeight);
|
117
|
+
|
115
118
|
//! For internal use only.
|
116
119
|
static void scheduleDrawOp(const DrawOp& op);
|
117
120
|
|
data/Gosu/GraphicsBase.hpp
CHANGED
@@ -87,21 +87,7 @@ namespace Gosu
|
|
87
87
|
ifRetro = 1 << 5
|
88
88
|
};
|
89
89
|
|
90
|
-
#ifdef GOSU_IS_MAC
|
91
|
-
// TODO: Without this gigantic hack, Gosu crashes in the "scale" function,
|
92
|
-
// but _only_ when used from Ruby 1.9. It is unclear what might cause this -
|
93
|
-
// maybe a compiler bug that tries to use SSE functions with the wrong
|
94
|
-
// alignment. Adding __attribute__((aligned(16))) does not help, though.
|
95
|
-
struct Transform
|
96
|
-
{
|
97
|
-
double value[16];
|
98
|
-
bool operator==(const Transform &other) { for (int i = 0; i < 16; ++i) if ((*this)[i] != other[i]) return false; return true; }
|
99
|
-
const double &operator[](std::size_t idx) const { return value[idx]; }
|
100
|
-
double &operator[](std::size_t idx) { return value[idx]; }
|
101
|
-
};
|
102
|
-
#else
|
103
90
|
typedef std::tr1::array<double, 16> Transform;
|
104
|
-
#endif
|
105
91
|
Transform translate(double x, double y);
|
106
92
|
Transform rotate(double angle, double aroundX = 0, double aroundY = 0);
|
107
93
|
Transform scale(double factor);
|
data/Gosu/Version.hpp
CHANGED
@@ -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
|
7
|
-
#define GOSU_VERSION "0.10.
|
6
|
+
#define GOSU_POINT_VERSION 6
|
7
|
+
#define GOSU_VERSION "0.10.6"
|
8
8
|
|
9
9
|
#define GOSU_COPYRIGHT_NOTICE \
|
10
10
|
"This software uses the following third-party libraries:\n" \
|
data/ext/gosu/gosu_wrap.cxx
CHANGED
@@ -10977,8 +10977,8 @@ SWIGEXPORT void Init_gosu(void) {
|
|
10977
10977
|
SWIG_RubyInitializeTrackings();
|
10978
10978
|
rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(0)));
|
10979
10979
|
rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(10)));
|
10980
|
-
rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(
|
10981
|
-
rb_define_const(mGosu, "VERSION", SWIG_FromCharPtr("0.10.
|
10980
|
+
rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(6)));
|
10981
|
+
rb_define_const(mGosu, "VERSION", SWIG_FromCharPtr("0.10.6"));
|
10982
10982
|
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"));
|
10983
10983
|
rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
|
10984
10984
|
rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
|
data/src/Graphics/Graphics.cpp
CHANGED
@@ -50,33 +50,34 @@ struct Gosu::Graphics::Impl
|
|
50
50
|
Transform baseTransform;
|
51
51
|
|
52
52
|
DrawOpQueueStack warmedUpQueues;
|
53
|
+
|
54
|
+
void updateBaseTransform()
|
55
|
+
{
|
56
|
+
double scaleX = 1.0 * physWidth / virtWidth;
|
57
|
+
double scaleY = 1.0 * physHeight / virtHeight;
|
58
|
+
double scaleFactor = std::min(scaleX, scaleY);
|
59
|
+
|
60
|
+
Transform scaleTransform = scale(scaleFactor);
|
61
|
+
Transform translateTransform = translate(blackWidth, blackHeight);
|
62
|
+
baseTransform = concat(translateTransform, scaleTransform);
|
63
|
+
}
|
53
64
|
};
|
54
65
|
|
55
66
|
Gosu::Graphics::Graphics(unsigned physWidth, unsigned physHeight, bool fullscreen)
|
56
67
|
: pimpl(new Impl)
|
57
68
|
{
|
58
|
-
pimpl->physWidth = physWidth;
|
59
|
-
pimpl->physHeight = physHeight;
|
60
69
|
pimpl->virtWidth = physWidth;
|
61
70
|
pimpl->virtHeight = physHeight;
|
62
71
|
pimpl->fullscreen = fullscreen;
|
63
72
|
pimpl->blackWidth = 0;
|
64
73
|
pimpl->blackHeight = 0;
|
65
|
-
|
74
|
+
|
66
75
|
// TODO: Should be merged into RenderState and removed from Graphics.
|
67
|
-
glMatrixMode(GL_PROJECTION);
|
68
|
-
glLoadIdentity();
|
69
|
-
glViewport(0, 0, physWidth, physHeight);
|
70
|
-
#ifdef GOSU_IS_OPENGLES
|
71
|
-
glOrthof(0, physWidth, physHeight, 0, -1, 1);
|
72
|
-
#else
|
73
|
-
glOrtho(0, physWidth, physHeight, 0, -1, 1);
|
74
|
-
#endif
|
75
|
-
|
76
76
|
glMatrixMode(GL_MODELVIEW);
|
77
77
|
glLoadIdentity();
|
78
|
-
|
79
78
|
glEnable(GL_BLEND);
|
79
|
+
|
80
|
+
setPhysicalResolution(physWidth, physHeight);
|
80
81
|
}
|
81
82
|
|
82
83
|
Gosu::Graphics::~Graphics()
|
@@ -111,13 +112,7 @@ void Gosu::Graphics::setResolution(unsigned virtualWidth, unsigned virtualHeight
|
|
111
112
|
pimpl->blackWidth = horizontalBlackBarWidth;
|
112
113
|
pimpl->blackHeight = verticalBlackBarHeight;
|
113
114
|
|
114
|
-
|
115
|
-
double scaleY = 1.0 * pimpl->physHeight / virtualHeight;
|
116
|
-
double scaleFactor = std::min(scaleX, scaleY);
|
117
|
-
|
118
|
-
Transform scaleTransform = scale(scaleFactor);
|
119
|
-
Transform translateTransform = translate(pimpl->blackWidth, pimpl->blackHeight);
|
120
|
-
pimpl-> baseTransform = concat(translateTransform, scaleTransform);
|
115
|
+
pimpl->updateBaseTransform();
|
121
116
|
}
|
122
117
|
|
123
118
|
bool Gosu::Graphics::begin(Gosu::Color clearWithColor)
|
@@ -382,6 +377,23 @@ void Gosu::Graphics::scheduleDrawOp(const Gosu::DrawOp &op)
|
|
382
377
|
currentQueue().scheduleDrawOp(op);
|
383
378
|
}
|
384
379
|
|
380
|
+
void Gosu::Graphics::setPhysicalResolution(unsigned physWidth, unsigned physHeight)
|
381
|
+
{
|
382
|
+
pimpl->physWidth = physWidth;
|
383
|
+
pimpl->physHeight = physHeight;
|
384
|
+
// TODO: Should be merged into RenderState and removed from Graphics.
|
385
|
+
glMatrixMode(GL_PROJECTION);
|
386
|
+
glLoadIdentity();
|
387
|
+
glViewport(0, 0, physWidth, physHeight);
|
388
|
+
#ifdef GOSU_IS_OPENGLES
|
389
|
+
glOrthof(0, physWidth, physHeight, 0, -1, 1);
|
390
|
+
#else
|
391
|
+
glOrtho(0, physWidth, physHeight, 0, -1, 1);
|
392
|
+
#endif
|
393
|
+
|
394
|
+
pimpl->updateBaseTransform();
|
395
|
+
}
|
396
|
+
|
385
397
|
GOSU_UNIQUE_PTR<Gosu::ImageData> Gosu::Graphics::createImage(
|
386
398
|
const Bitmap& src, unsigned srcX, unsigned srcY,
|
387
399
|
unsigned srcWidth, unsigned srcHeight, unsigned flags)
|
data/src/Window.cpp
CHANGED
@@ -182,6 +182,13 @@ bool Gosu::Window::tick()
|
|
182
182
|
{
|
183
183
|
if (SDL_GetWindowFlags(sharedWindow()) & SDL_WINDOW_HIDDEN) {
|
184
184
|
SDL_ShowWindow(sharedWindow());
|
185
|
+
|
186
|
+
// SDL_GL_GetDrawableSize returns different values before and after showing the window.
|
187
|
+
// -> When first showing the window, update the physical size of Graphics (=glViewport).
|
188
|
+
// Fixes https://github.com/gosu/gosu/issues/318
|
189
|
+
int width, height;
|
190
|
+
SDL_GL_GetDrawableSize(sharedWindow(), &width, &height);
|
191
|
+
graphics().setPhysicalResolution(width, height);
|
185
192
|
}
|
186
193
|
|
187
194
|
SDL_Event e;
|
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.
|
4
|
+
version: 0.10.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Raschke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
2D game development library.
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.5.
|
161
|
+
rubygems_version: 2.5.1
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: 2D game development library.
|