reflexion 0.3.2 → 0.3.4
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/.doc/ext/reflex/application.cpp +13 -0
- data/ChangeLog.md +17 -0
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +14 -0
- data/ext/reflex/extconf.rb +3 -3
- data/include/reflex/application.h +16 -0
- data/include/reflex/view.h +10 -10
- data/lib/reflex/application.rb +6 -2
- data/lib/reflex/helper.rb +0 -12
- data/lib/reflex/shape.rb +2 -1
- data/lib/reflex/view.rb +10 -3
- data/lib/reflex/window.rb +2 -1
- data/lib/reflexion.rb +1 -2
- data/reflex.gemspec +3 -4
- data/src/application.cpp +88 -0
- data/src/application.h +28 -0
- data/src/body.cpp +15 -5
- data/src/ios/app_delegate.mm +7 -5
- data/src/ios/application.h +8 -5
- data/src/ios/application.mm +16 -43
- data/src/ios/view_controller.mm +5 -7
- data/src/osx/app_delegate.mm +7 -5
- data/src/osx/application.h +8 -5
- data/src/osx/application.mm +16 -43
- data/src/osx/native_window.mm +5 -7
- data/src/view.cpp +4 -2
- data/src/win32/application.cpp +48 -50
- data/src/win32/window.cpp +8 -50
- data/src/win32/window.h +20 -0
- data/src/window.cpp +100 -34
- data/src/window.h +11 -1
- data/test/test_view.rb +51 -0
- metadata +17 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92e1368f44fafa2ab8966bfec25f93af411b68a72eaf3f127bc6b95b97ba2fed
|
4
|
+
data.tar.gz: 6efaa218301242d6c4fea24062f9fd9d74f405e46a347eac1b231d6fe08a16c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3886ea311fccd85da0e7e3868771d61d32f10fd091612bf306df041dbbe2cf30490e3e6a5fa9cdc049e6cf41f3b8e090ea7af950753dff81db95548ffcb7df99
|
7
|
+
data.tar.gz: 1704f273a82ebd9b8272e7358c6936b81171a969ad1a6f085ad641dc0f833dfeb5b97d4f5cf71e80be8d00d9b7bdbc5cb4bdba9d2c9e1228ebb6b995e7903444
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "reflex/ruby/application.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "reflex/ruby/window.h"
|
4
5
|
#include "defs.h"
|
5
6
|
|
6
7
|
|
@@ -51,6 +52,17 @@ VALUE get_name(VALUE self)
|
|
51
52
|
return value(THIS->name());
|
52
53
|
}
|
53
54
|
|
55
|
+
static
|
56
|
+
VALUE each_window(VALUE self)
|
57
|
+
{
|
58
|
+
CHECK;
|
59
|
+
|
60
|
+
Value ret;
|
61
|
+
for (auto it = THIS->window_begin(), end = THIS->window_end(); it != end; ++it)
|
62
|
+
ret = rb_yield(value(it->get()));
|
63
|
+
return ret;
|
64
|
+
}
|
65
|
+
|
54
66
|
static
|
55
67
|
VALUE on_start(VALUE self, VALUE event)
|
56
68
|
{
|
@@ -110,6 +122,7 @@ Init_reflex_application ()
|
|
110
122
|
rb_define_method(cApplication, "quit", RUBY_METHOD_FUNC(quit), 0);
|
111
123
|
rb_define_method(cApplication, "name=", RUBY_METHOD_FUNC(set_name), 1);
|
112
124
|
rb_define_method(cApplication, "name", RUBY_METHOD_FUNC(get_name), 0);
|
125
|
+
rb_define_method(cApplication, "each_window", RUBY_METHOD_FUNC(each_window), 0);
|
113
126
|
rb_define_method(cApplication, "on_start", RUBY_METHOD_FUNC(on_start), 1);
|
114
127
|
rb_define_method(cApplication, "on_quit", RUBY_METHOD_FUNC(on_quit), 1);
|
115
128
|
rb_define_method(cApplication, "on_motion", RUBY_METHOD_FUNC(on_motion), 1);
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
# reflex ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.3.4] - 2025-03-07
|
5
|
+
|
6
|
+
- Captured key and pointer events can be blocked before being sent to the window and views
|
7
|
+
- Apply pixel<->meter scale to linear velocity and linear damping
|
8
|
+
- Call awake() after moving the view
|
9
|
+
|
10
|
+
- Fix an issue where capturing keys do not work
|
11
|
+
|
12
|
+
|
13
|
+
## [v0.3.3] - 2025-01-23
|
14
|
+
|
15
|
+
- Remove dependence on the beeps library
|
16
|
+
- Add Application#windows
|
17
|
+
|
18
|
+
- Fix frame rate limitation on Windows
|
19
|
+
|
20
|
+
|
4
21
|
## [v0.3.2] - 2025-01-14
|
5
22
|
|
6
23
|
- Update workflow files
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/ext/reflex/application.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "reflex/ruby/application.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "reflex/ruby/window.h"
|
4
5
|
#include "defs.h"
|
5
6
|
|
6
7
|
|
@@ -56,6 +57,18 @@ RUCY_DEF0(get_name)
|
|
56
57
|
}
|
57
58
|
RUCY_END
|
58
59
|
|
60
|
+
static
|
61
|
+
RUCY_DEF0(each_window)
|
62
|
+
{
|
63
|
+
CHECK;
|
64
|
+
|
65
|
+
Value ret;
|
66
|
+
for (auto it = THIS->window_begin(), end = THIS->window_end(); it != end; ++it)
|
67
|
+
ret = rb_yield(value(it->get()));
|
68
|
+
return ret;
|
69
|
+
}
|
70
|
+
RUCY_END
|
71
|
+
|
59
72
|
static
|
60
73
|
RUCY_DEF1(on_start, event)
|
61
74
|
{
|
@@ -121,6 +134,7 @@ Init_reflex_application ()
|
|
121
134
|
cApplication.define_method("quit", quit);
|
122
135
|
cApplication.define_method("name=", set_name);
|
123
136
|
cApplication.define_method("name", get_name);
|
137
|
+
cApplication.define_method("each_window", each_window);
|
124
138
|
cApplication.define_method("on_start", on_start);
|
125
139
|
cApplication.define_method("on_quit", on_quit);
|
126
140
|
cApplication.define_method("on_motion", on_motion);
|
data/ext/reflex/extconf.rb
CHANGED
@@ -13,9 +13,9 @@ require 'reflex/extension'
|
|
13
13
|
Xot::ExtConf.new Xot, Rucy, Rays, Reflex do
|
14
14
|
setup do
|
15
15
|
headers << 'ruby.h'
|
16
|
-
libs.unshift 'gdi32', 'opengl32', 'glew32'
|
17
|
-
frameworks << 'Cocoa'
|
18
|
-
$LDFLAGS << ' -Wl,--out-implib=native.dll.a'
|
16
|
+
libs.unshift 'gdi32', 'winmm', 'opengl32', 'glew32' if win32?
|
17
|
+
frameworks << 'Cocoa' if osx?
|
18
|
+
$LDFLAGS << ' -Wl,--out-implib=native.dll.a' if mingw? || cygwin?
|
19
19
|
|
20
20
|
unless osx?
|
21
21
|
lib_dirs << Rays::Extension.ext_dir
|
@@ -4,9 +4,11 @@
|
|
4
4
|
#define __REFLEX_APPLICATION_H__
|
5
5
|
|
6
6
|
|
7
|
+
#include <vector>
|
7
8
|
#include <xot/ref.h>
|
8
9
|
#include <xot/pimpl.h>
|
9
10
|
#include <reflex/defs.h>
|
11
|
+
#include <reflex/window.h>
|
10
12
|
#include <reflex/event.h>
|
11
13
|
|
12
14
|
|
@@ -23,6 +25,12 @@ namespace Reflex
|
|
23
25
|
|
24
26
|
typedef Xot::Ref<This> Ref;
|
25
27
|
|
28
|
+
typedef std::vector<Window::Ref> WindowList;
|
29
|
+
|
30
|
+
typedef WindowList:: iterator window_iterator;
|
31
|
+
|
32
|
+
typedef WindowList::const_iterator const_window_iterator;
|
33
|
+
|
26
34
|
Application ();
|
27
35
|
|
28
36
|
virtual void start ();
|
@@ -33,6 +41,14 @@ namespace Reflex
|
|
33
41
|
|
34
42
|
virtual const char* name () const;
|
35
43
|
|
44
|
+
virtual window_iterator window_begin ();
|
45
|
+
|
46
|
+
virtual const_window_iterator window_begin () const;
|
47
|
+
|
48
|
+
virtual window_iterator window_end ();
|
49
|
+
|
50
|
+
virtual const_window_iterator window_end () const;
|
51
|
+
|
36
52
|
virtual void on_start (Event* e);
|
37
53
|
|
38
54
|
virtual void on_quit (Event* e);
|
data/include/reflex/view.h
CHANGED
@@ -59,30 +59,30 @@ namespace Reflex
|
|
59
59
|
enum Flag
|
60
60
|
{
|
61
61
|
|
62
|
-
FLAG_CLIP
|
62
|
+
FLAG_CLIP = Xot::bit(0),
|
63
63
|
|
64
|
-
FLAG_CACHE
|
64
|
+
FLAG_CACHE = Xot::bit(1),
|
65
65
|
|
66
|
-
FLAG_RESIZE_TO_FIT
|
66
|
+
FLAG_RESIZE_TO_FIT = Xot::bit(2),
|
67
67
|
|
68
|
-
FLAG_SCROLL_TO_FIT
|
68
|
+
FLAG_SCROLL_TO_FIT = Xot::bit(3),
|
69
69
|
|
70
|
-
FLAG_FIX_ANGLE
|
70
|
+
FLAG_FIX_ANGLE = Xot::bit(4),
|
71
71
|
|
72
|
-
FLAG_LAST
|
72
|
+
FLAG_LAST = FLAG_FIX_ANGLE
|
73
73
|
|
74
74
|
};// Flag
|
75
75
|
|
76
76
|
enum Capture
|
77
77
|
{
|
78
78
|
|
79
|
-
CAPTURE_NONE
|
79
|
+
CAPTURE_NONE = 0,
|
80
80
|
|
81
|
-
CAPTURE_KEY
|
81
|
+
CAPTURE_KEY = Xot::bit(0),
|
82
82
|
|
83
|
-
CAPTURE_POINTER
|
83
|
+
CAPTURE_POINTER = Xot::bit(1),
|
84
84
|
|
85
|
-
CAPTURE_ALL
|
85
|
+
CAPTURE_ALL = CAPTURE_KEY | CAPTURE_POINTER,
|
86
86
|
|
87
87
|
};// Capture
|
88
88
|
|
data/lib/reflex/application.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'xot/setter'
|
2
2
|
require 'xot/universal_accessor'
|
3
|
+
require 'xot/hookable'
|
3
4
|
require 'xot/block_util'
|
4
5
|
require 'xot/inspectable'
|
5
6
|
require 'reflex/ext'
|
6
|
-
require 'reflex/helper'
|
7
7
|
|
8
8
|
|
9
9
|
module Reflex
|
@@ -12,8 +12,8 @@ module Reflex
|
|
12
12
|
class Application
|
13
13
|
|
14
14
|
include Xot::Setter
|
15
|
+
include Xot::Hookable
|
15
16
|
include Xot::Inspectable
|
16
|
-
include Hookable
|
17
17
|
|
18
18
|
universal_accessor :name
|
19
19
|
|
@@ -23,6 +23,10 @@ module Reflex
|
|
23
23
|
@start_block = block if block
|
24
24
|
end
|
25
25
|
|
26
|
+
def windows()
|
27
|
+
to_enum :each_window
|
28
|
+
end
|
29
|
+
|
26
30
|
def self.start(*args, &block)
|
27
31
|
new(*args, &block).start
|
28
32
|
end
|
data/lib/reflex/helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'xot/hookable'
|
2
1
|
require 'xot/universal_accessor'
|
3
2
|
require 'reflex/point'
|
4
3
|
require 'reflex/bounds'
|
@@ -7,17 +6,6 @@ require 'reflex/bounds'
|
|
7
6
|
module Reflex
|
8
7
|
|
9
8
|
|
10
|
-
module Hookable
|
11
|
-
|
12
|
-
include Xot::Hookable
|
13
|
-
|
14
|
-
def hook(name, &block)
|
15
|
-
super "on_#{name}".intern, &block
|
16
|
-
end
|
17
|
-
|
18
|
-
end# Hookable
|
19
|
-
|
20
|
-
|
21
9
|
module HasFrame
|
22
10
|
|
23
11
|
def move_to(*args)
|
data/lib/reflex/shape.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'xot/setter'
|
2
2
|
require 'xot/universal_accessor'
|
3
|
+
require 'xot/hookable'
|
3
4
|
require 'xot/block_util'
|
4
5
|
require 'reflex/ext'
|
5
6
|
require 'reflex/helper'
|
@@ -11,7 +12,7 @@ module Reflex
|
|
11
12
|
class Shape
|
12
13
|
|
13
14
|
include Xot::Setter
|
14
|
-
include Hookable
|
15
|
+
include Xot::Hookable
|
15
16
|
include HasFrame
|
16
17
|
include HasTags
|
17
18
|
|
data/lib/reflex/view.rb
CHANGED
@@ -2,6 +2,7 @@ require 'forwardable'
|
|
2
2
|
require 'xot/setter'
|
3
3
|
require 'xot/bit_flag_accessor'
|
4
4
|
require 'xot/universal_accessor'
|
5
|
+
require 'xot/hookable'
|
5
6
|
require 'xot/block_util'
|
6
7
|
require 'reflex/ext'
|
7
8
|
require 'reflex/selector'
|
@@ -16,7 +17,7 @@ module Reflex
|
|
16
17
|
class View
|
17
18
|
|
18
19
|
include Xot::Setter
|
19
|
-
include Hookable
|
20
|
+
include Xot::Hookable
|
20
21
|
include HasFrame
|
21
22
|
include HasTags
|
22
23
|
|
@@ -98,8 +99,14 @@ module Reflex
|
|
98
99
|
end
|
99
100
|
|
100
101
|
def capturing?(*args)
|
101
|
-
cap = capture
|
102
|
-
args.
|
102
|
+
args, cap = args.flatten, capture
|
103
|
+
if args.empty?
|
104
|
+
not cap.empty?
|
105
|
+
elsif args.include?(:all)
|
106
|
+
cap == [:key, :pointer]
|
107
|
+
else
|
108
|
+
args.all? {|type| cap.include? type}
|
109
|
+
end
|
103
110
|
end
|
104
111
|
|
105
112
|
def on_contact(e)
|
data/lib/reflex/window.rb
CHANGED
@@ -2,6 +2,7 @@ require 'forwardable'
|
|
2
2
|
require 'xot/setter'
|
3
3
|
require 'xot/bit_flag_accessor'
|
4
4
|
require 'xot/universal_accessor'
|
5
|
+
require 'xot/hookable'
|
5
6
|
require 'xot/block_util'
|
6
7
|
require 'xot/inspectable'
|
7
8
|
require 'reflex/ext'
|
@@ -14,8 +15,8 @@ module Reflex
|
|
14
15
|
class Window
|
15
16
|
|
16
17
|
include Xot::Setter
|
18
|
+
include Xot::Hookable
|
17
19
|
include Xot::Inspectable
|
18
|
-
include Hookable
|
19
20
|
include HasFrame
|
20
21
|
|
21
22
|
extend Forwardable
|
data/lib/reflexion.rb
CHANGED
data/reflex.gemspec
CHANGED
@@ -25,10 +25,9 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
27
27
|
|
28
|
-
s.add_dependency 'xot', '~> 0.3.
|
29
|
-
s.add_dependency 'rucy', '~> 0.3.
|
30
|
-
s.add_dependency '
|
31
|
-
s.add_dependency 'rays', '~> 0.3.2', '>= 0.3.2'
|
28
|
+
s.add_dependency 'xot', '~> 0.3.4', '>= 0.3.4'
|
29
|
+
s.add_dependency 'rucy', '~> 0.3.4', '>= 0.3.4'
|
30
|
+
s.add_dependency 'rays', '~> 0.3.4', '>= 0.3.4'
|
32
31
|
|
33
32
|
s.files = `git ls-files`.split $/
|
34
33
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/src/application.cpp
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
#include "application.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "reflex/exception.h"
|
5
|
+
#include "reflex/debug.h"
|
6
|
+
#include "window.h"
|
7
|
+
|
8
|
+
|
9
|
+
namespace Reflex
|
10
|
+
{
|
11
|
+
|
12
|
+
|
13
|
+
namespace global
|
14
|
+
{
|
15
|
+
|
16
|
+
static Application* instance = NULL;
|
17
|
+
|
18
|
+
}// global
|
19
|
+
|
20
|
+
|
21
|
+
Application*
|
22
|
+
app ()
|
23
|
+
{
|
24
|
+
return global::instance;
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
Application::Application ()
|
29
|
+
: self(Application_create_data())
|
30
|
+
{
|
31
|
+
if (global::instance)
|
32
|
+
reflex_error(__FILE__, __LINE__, "multiple application instances.");
|
33
|
+
|
34
|
+
global::instance = this;
|
35
|
+
}
|
36
|
+
|
37
|
+
Application::~Application ()
|
38
|
+
{
|
39
|
+
global::instance = NULL;
|
40
|
+
}
|
41
|
+
|
42
|
+
void
|
43
|
+
Application::set_name (const char* name)
|
44
|
+
{
|
45
|
+
if (!name)
|
46
|
+
argument_error(__FILE__, __LINE__);
|
47
|
+
|
48
|
+
self->name = name;
|
49
|
+
}
|
50
|
+
|
51
|
+
const char*
|
52
|
+
Application::name () const
|
53
|
+
{
|
54
|
+
return self->name.c_str();
|
55
|
+
}
|
56
|
+
|
57
|
+
Application::window_iterator
|
58
|
+
Application::window_begin ()
|
59
|
+
{
|
60
|
+
return Window_all().begin();
|
61
|
+
}
|
62
|
+
|
63
|
+
Application::const_window_iterator
|
64
|
+
Application::window_begin () const
|
65
|
+
{
|
66
|
+
return Window_all().begin();
|
67
|
+
}
|
68
|
+
|
69
|
+
Application::window_iterator
|
70
|
+
Application::window_end ()
|
71
|
+
{
|
72
|
+
return Window_all().end();
|
73
|
+
}
|
74
|
+
|
75
|
+
Application::const_window_iterator
|
76
|
+
Application::window_end () const
|
77
|
+
{
|
78
|
+
return Window_all().end();
|
79
|
+
}
|
80
|
+
|
81
|
+
bool
|
82
|
+
Application::operator ! () const
|
83
|
+
{
|
84
|
+
return !operator bool();
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
}// Reflex
|
data/src/application.h
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_SRC_APPLICATION_H__
|
4
|
+
#define __REFLEX_SRC_APPLICATION_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include "reflex/application.h"
|
8
|
+
|
9
|
+
|
10
|
+
namespace Reflex
|
11
|
+
{
|
12
|
+
|
13
|
+
|
14
|
+
struct Application::Data
|
15
|
+
{
|
16
|
+
|
17
|
+
String name;
|
18
|
+
|
19
|
+
};// Application::Data
|
20
|
+
|
21
|
+
|
22
|
+
Application::Data* Application_create_data ();
|
23
|
+
|
24
|
+
|
25
|
+
}// Reflex
|
26
|
+
|
27
|
+
|
28
|
+
#endif//EOH
|
data/src/body.cpp
CHANGED
@@ -291,9 +291,7 @@ namespace Reflex
|
|
291
291
|
assert(b2to && b2from);
|
292
292
|
|
293
293
|
b2to->SetType( b2from->GetType());
|
294
|
-
b2to->SetLinearVelocity( b2from->GetLinearVelocity());
|
295
294
|
b2to->SetAngularVelocity(b2from->GetAngularVelocity());
|
296
|
-
b2to->SetLinearDamping( b2from->GetLinearDamping());
|
297
295
|
b2to->SetAngularDamping( b2from->GetAngularDamping());
|
298
296
|
b2to->SetGravityScale( b2from->GetGravityScale());
|
299
297
|
b2to->SetBullet( b2from->IsBullet());
|
@@ -301,12 +299,24 @@ namespace Reflex
|
|
301
299
|
float ppm_to = to->self->ppm;
|
302
300
|
float ppm_from = from.self->ppm;
|
303
301
|
if (ppm_to == ppm_from)
|
304
|
-
|
302
|
+
{
|
303
|
+
b2to->SetTransform( b2from->GetPosition(),
|
304
|
+
b2from->GetAngle());
|
305
|
+
b2to->SetLinearVelocity(b2from->GetLinearVelocity());
|
306
|
+
b2to->SetLinearDamping( b2from->GetLinearDamping());
|
307
|
+
}
|
305
308
|
else
|
306
309
|
{
|
307
|
-
|
308
|
-
pos
|
310
|
+
float scale = ppm_from / ppm_to;
|
311
|
+
auto pos = b2from->GetPosition();
|
312
|
+
auto vel = b2from->GetLinearVelocity();
|
313
|
+
auto damp = b2from->GetLinearDamping();
|
314
|
+
pos *= scale;
|
315
|
+
vel *= scale;
|
316
|
+
damp *= scale;
|
309
317
|
b2to->SetTransform(pos, b2from->GetAngle());
|
318
|
+
b2to->SetLinearVelocity(vel);
|
319
|
+
b2to->SetLinearDamping(damp);
|
310
320
|
}
|
311
321
|
}
|
312
322
|
|
data/src/ios/app_delegate.mm
CHANGED
@@ -45,10 +45,11 @@
|
|
45
45
|
if (!app)
|
46
46
|
Reflex::argument_error(__FILE__, __LINE__);
|
47
47
|
|
48
|
-
|
48
|
+
Reflex::ApplicationData& data = Reflex::Application_get_data(app);
|
49
|
+
if (data.delegate)
|
49
50
|
Reflex::invalid_state_error(__FILE__, __LINE__);
|
50
51
|
|
51
|
-
|
52
|
+
data.delegate = [self retain];
|
52
53
|
app->retain();
|
53
54
|
|
54
55
|
application = app;
|
@@ -58,10 +59,11 @@
|
|
58
59
|
{
|
59
60
|
if (!application) return;
|
60
61
|
|
61
|
-
|
62
|
+
Reflex::ApplicationData& data = Reflex::Application_get_data(application);
|
63
|
+
if (data.delegate)
|
62
64
|
{
|
63
|
-
[
|
64
|
-
|
65
|
+
[data.delegate release];
|
66
|
+
data.delegate = nil;
|
65
67
|
}
|
66
68
|
|
67
69
|
application->release();
|
data/src/ios/application.h
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#define __REFLEX_SRC_IOS_APPLICATION_H__
|
5
5
|
|
6
6
|
|
7
|
-
#include "
|
7
|
+
#include "../application.h"
|
8
8
|
|
9
9
|
|
10
10
|
@class ReflexAppDelegate;
|
@@ -14,16 +14,19 @@ namespace Reflex
|
|
14
14
|
{
|
15
15
|
|
16
16
|
|
17
|
-
struct Application::Data
|
17
|
+
struct ApplicationData : public Application::Data
|
18
18
|
{
|
19
19
|
|
20
20
|
ReflexAppDelegate* delegate;
|
21
21
|
|
22
|
-
|
22
|
+
ApplicationData ();
|
23
23
|
|
24
|
-
|
24
|
+
};// ApplicationData
|
25
25
|
|
26
|
-
|
26
|
+
|
27
|
+
ApplicationData& Application_get_data ( Application* app);
|
28
|
+
|
29
|
+
const ApplicationData& Application_get_data (const Application* app);
|
27
30
|
|
28
31
|
|
29
32
|
}// Reflex
|
data/src/ios/application.mm
CHANGED
@@ -22,33 +22,33 @@ namespace Reflex
|
|
22
22
|
{
|
23
23
|
|
24
24
|
|
25
|
-
|
25
|
+
Application::Data*
|
26
|
+
Application_create_data ()
|
26
27
|
{
|
28
|
+
return new ApplicationData();
|
29
|
+
}
|
27
30
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
ApplicationData&
|
32
|
+
Application_get_data (Application* app)
|
33
|
+
{
|
34
|
+
if (!app)
|
35
|
+
argument_error(__FILE__, __LINE__);
|
31
36
|
|
37
|
+
return (ApplicationData&) *app->self;
|
38
|
+
}
|
32
39
|
|
33
|
-
|
34
|
-
|
40
|
+
const ApplicationData&
|
41
|
+
Application_get_data (const Application* app)
|
35
42
|
{
|
36
|
-
return
|
43
|
+
return Application_get_data(const_cast<Application*>(app));
|
37
44
|
}
|
38
45
|
|
39
46
|
|
40
|
-
|
47
|
+
ApplicationData::ApplicationData ()
|
48
|
+
: delegate(nil)
|
41
49
|
{
|
42
|
-
if (global::instance)
|
43
|
-
reflex_error(__FILE__, __LINE__, "multiple application instances.");
|
44
|
-
|
45
|
-
global::instance = this;
|
46
50
|
}
|
47
51
|
|
48
|
-
Application::~Application ()
|
49
|
-
{
|
50
|
-
global::instance = NULL;
|
51
|
-
}
|
52
52
|
|
53
53
|
void
|
54
54
|
Application::start ()
|
@@ -75,21 +75,6 @@ namespace Reflex
|
|
75
75
|
not_implemented_error(__FILE__, __LINE__);
|
76
76
|
}
|
77
77
|
|
78
|
-
void
|
79
|
-
Application::set_name (const char* name)
|
80
|
-
{
|
81
|
-
if (!name)
|
82
|
-
argument_error(__FILE__, __LINE__);
|
83
|
-
|
84
|
-
self->name = name;
|
85
|
-
}
|
86
|
-
|
87
|
-
const char*
|
88
|
-
Application::name () const
|
89
|
-
{
|
90
|
-
return self->name.c_str();
|
91
|
-
}
|
92
|
-
|
93
78
|
void
|
94
79
|
Application::on_start (Event* e)
|
95
80
|
{
|
@@ -120,17 +105,5 @@ namespace Reflex
|
|
120
105
|
return true;
|
121
106
|
}
|
122
107
|
|
123
|
-
bool
|
124
|
-
Application::operator ! () const
|
125
|
-
{
|
126
|
-
return !operator bool();
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
Application::Data::Data ()
|
131
|
-
: delegate(nil)
|
132
|
-
{
|
133
|
-
}
|
134
|
-
|
135
108
|
|
136
109
|
}// Reflex
|