reflexion 0.1.32 → 0.1.33
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/shape.cpp +5 -31
- data/.doc/ext/reflex/view.cpp +8 -34
- data/.github/workflows/release-gem.yml +4 -1
- data/ChangeLog.md +7 -0
- data/Rakefile +5 -5
- data/VERSION +1 -1
- data/ext/reflex/extconf.rb +0 -1
- data/ext/reflex/shape.cpp +6 -35
- data/ext/reflex/view.cpp +15 -44
- data/include/reflex/ruby/application.h +3 -3
- data/include/reflex/ruby/event.h +27 -27
- data/include/reflex/ruby/filter.h +3 -3
- data/include/reflex/ruby/image_view.h +3 -3
- data/include/reflex/ruby/pointer.h +3 -3
- data/include/reflex/ruby/selector.h +3 -3
- data/include/reflex/ruby/shape.h +20 -11
- data/include/reflex/ruby/style.h +5 -5
- data/include/reflex/ruby/timer.h +3 -3
- data/include/reflex/ruby/view.h +12 -3
- data/include/reflex/ruby/window.h +3 -3
- data/include/reflex/shape.h +5 -11
- data/include/reflex/view.h +5 -11
- data/lib/reflex/fixture.rb +1 -2
- data/lib/reflex/shape.rb +2 -2
- data/lib/reflex/view.rb +1 -28
- data/reflex.gemspec +4 -4
- data/samples/reflexion/breakout.rb +1 -1
- data/src/body.cpp +2 -2
- data/src/fixture.cpp +8 -62
- data/src/fixture.h +0 -8
- data/src/shape.cpp +45 -60
- data/src/view.cpp +6 -34
- data/src/world.cpp +41 -10
- data/src/world.h +9 -7
- data/test/helper.rb +2 -1
- data/test/{test_reflex.rb → test_reflex_init.rb} +3 -3
- data/test/test_shape.rb +0 -22
- data/test/test_view.rb +0 -12
- metadata +13 -13
data/include/reflex/shape.h
CHANGED
@@ -61,23 +61,17 @@ namespace Reflex
|
|
61
61
|
|
62
62
|
virtual bool is_sensor () const;
|
63
63
|
|
64
|
-
virtual void set_category_bits (uint bits);
|
65
|
-
|
66
|
-
virtual uint category_bits () const;
|
67
|
-
|
68
|
-
virtual void set_collision_mask (uint mask);
|
69
|
-
|
70
|
-
virtual uint collision_mask () const;
|
71
|
-
|
72
64
|
virtual void on_draw (DrawEvent* e);
|
73
65
|
|
74
66
|
virtual void on_resize (FrameEvent* e);
|
75
67
|
|
76
|
-
virtual
|
68
|
+
virtual bool will_contact (Shape* s);
|
69
|
+
|
70
|
+
virtual void on_contact (ContactEvent* e);
|
77
71
|
|
78
|
-
virtual void
|
72
|
+
virtual void on_contact_begin (ContactEvent* e);
|
79
73
|
|
80
|
-
virtual void
|
74
|
+
virtual void on_contact_end (ContactEvent* e);
|
81
75
|
|
82
76
|
struct Data;
|
83
77
|
|
data/include/reflex/view.h
CHANGED
@@ -284,14 +284,6 @@ namespace Reflex
|
|
284
284
|
|
285
285
|
virtual bool is_sensor () const;
|
286
286
|
|
287
|
-
virtual void set_category_bits (uint bits);
|
288
|
-
|
289
|
-
virtual uint category_bits () const;
|
290
|
-
|
291
|
-
virtual void set_collision_mask (uint mask);
|
292
|
-
|
293
|
-
virtual uint collision_mask () const;
|
294
|
-
|
295
287
|
virtual void set_linear_velocity (coord x, coord y);
|
296
288
|
|
297
289
|
virtual void set_linear_velocity (const Point& velocity);
|
@@ -380,11 +372,13 @@ namespace Reflex
|
|
380
372
|
|
381
373
|
virtual void on_timer (TimerEvent* e);
|
382
374
|
|
383
|
-
virtual
|
375
|
+
virtual bool will_contact (View* v);
|
376
|
+
|
377
|
+
virtual void on_contact (ContactEvent* e);
|
384
378
|
|
385
|
-
virtual void
|
379
|
+
virtual void on_contact_begin (ContactEvent* e);
|
386
380
|
|
387
|
-
virtual void
|
381
|
+
virtual void on_contact_end (ContactEvent* e);
|
388
382
|
|
389
383
|
virtual operator bool () const;
|
390
384
|
|
data/lib/reflex/fixture.rb
CHANGED
data/lib/reflex/shape.rb
CHANGED
@@ -18,11 +18,11 @@ module Reflex
|
|
18
18
|
include HasFrame
|
19
19
|
include HasTags
|
20
20
|
|
21
|
+
alias view owner
|
21
22
|
alias sensor? sensor
|
22
23
|
|
23
24
|
universal_accessor :name, :selector,
|
24
|
-
:density, :friction, :restitution, :sensor
|
25
|
-
:category_bits, :collision_mask
|
25
|
+
:density, :friction, :restitution, :sensor
|
26
26
|
|
27
27
|
def initialize(options = nil, &block)
|
28
28
|
super()
|
data/lib/reflex/view.rb
CHANGED
@@ -100,26 +100,6 @@ module Reflex
|
|
100
100
|
to_enum :each_shape
|
101
101
|
end
|
102
102
|
|
103
|
-
def categories()
|
104
|
-
@categories ||= Xot::BitFlag.new(auto: true, all: 1)
|
105
|
-
end
|
106
|
-
|
107
|
-
def category=(*symbols)
|
108
|
-
set_category_bits parent_categories.symbols2bits(*symbols)
|
109
|
-
end
|
110
|
-
|
111
|
-
def category()
|
112
|
-
parent_categories.bits2symbols get_category_bits
|
113
|
-
end
|
114
|
-
|
115
|
-
def collision=(*categories)
|
116
|
-
set_collision_mask parent_categories.symbols2bits(*categories)
|
117
|
-
end
|
118
|
-
|
119
|
-
def collision()
|
120
|
-
parent_categories.bits2symbols get_collision_mask
|
121
|
-
end
|
122
|
-
|
123
103
|
def capturing?(*args)
|
124
104
|
cap = capture
|
125
105
|
args.all? {|type| cap.include? type}
|
@@ -135,7 +115,7 @@ module Reflex
|
|
135
115
|
end
|
136
116
|
|
137
117
|
universal_accessor :shape, :name, :selector, :frame, :angle, :zoom, :capture,
|
138
|
-
:density, :friction, :restitution,
|
118
|
+
:density, :friction, :restitution,
|
139
119
|
:linear_velocity, :angular_velocity, :gravity_scale,
|
140
120
|
:gravity, :time_scale,
|
141
121
|
clip: {reader: :clip?},
|
@@ -161,13 +141,6 @@ module Reflex
|
|
161
141
|
include ModelView
|
162
142
|
end
|
163
143
|
|
164
|
-
protected
|
165
|
-
|
166
|
-
def parent_categories()
|
167
|
-
raise InvalidStateError unless parent
|
168
|
-
parent.categories
|
169
|
-
end
|
170
|
-
|
171
144
|
private
|
172
145
|
|
173
146
|
def on_contact!(*args)
|
data/reflex.gemspec
CHANGED
@@ -28,10 +28,10 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '>= 2.7.0'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
32
|
-
s.add_runtime_dependency 'rucy', '~> 0.1.
|
33
|
-
s.add_runtime_dependency 'beeps', '~> 0.1.
|
34
|
-
s.add_runtime_dependency 'rays', '~> 0.1.
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.33'
|
32
|
+
s.add_runtime_dependency 'rucy', '~> 0.1.33'
|
33
|
+
s.add_runtime_dependency 'beeps', '~> 0.1.33'
|
34
|
+
s.add_runtime_dependency 'rays', '~> 0.1.33'
|
35
35
|
|
36
36
|
s.add_development_dependency 'rake'
|
37
37
|
s.add_development_dependency 'test-unit'
|
@@ -8,7 +8,7 @@
|
|
8
8
|
require 'reflexion/include'
|
9
9
|
|
10
10
|
|
11
|
-
$hit, $bang = [880, 440].map {|n| Sound.new
|
11
|
+
$hit, $bang = [880, 440].map {|n| Sound.new Oscillator.new(freq: n), 0.1}
|
12
12
|
|
13
13
|
def add_shape (klass: RectShape, frame: [0, 0, 100, 100], color: :white, type: :static)
|
14
14
|
window.add View.new {
|
data/src/body.cpp
CHANGED
data/src/fixture.cpp
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
#include <assert.h>
|
5
|
-
#include <
|
6
|
-
#include <
|
5
|
+
#include <box2d/b2_fixture.h>
|
6
|
+
#include <box2d/b2_circle_shape.h>
|
7
7
|
#include "reflex/exception.h"
|
8
8
|
#include "reflex/debug.h"
|
9
9
|
#include "view.h"
|
@@ -27,12 +27,12 @@ namespace Reflex
|
|
27
27
|
if (!b2fixture)
|
28
28
|
system_error(__FILE__, __LINE__);
|
29
29
|
|
30
|
-
b2fixture->
|
30
|
+
b2fixture->GetUserData().pointer = (uintptr_t) userdata;
|
31
31
|
}
|
32
32
|
|
33
33
|
Fixture::~Fixture ()
|
34
34
|
{
|
35
|
-
b2fixture->
|
35
|
+
b2fixture->GetUserData().pointer = (uintptr_t) NULL;
|
36
36
|
b2fixture->GetBody()->DestroyFixture(b2fixture);
|
37
37
|
}
|
38
38
|
|
@@ -102,58 +102,6 @@ namespace Reflex
|
|
102
102
|
return b2fixture->IsSensor();
|
103
103
|
}
|
104
104
|
|
105
|
-
void
|
106
|
-
Fixture::set_category_bits (uint bits)
|
107
|
-
{
|
108
|
-
if (bits > USHRT_MAX)
|
109
|
-
{
|
110
|
-
argument_error(
|
111
|
-
__FILE__, __LINE__, "category_bits must be less then USHRT_MAX.");
|
112
|
-
}
|
113
|
-
|
114
|
-
if (bits == category_bits())
|
115
|
-
return;
|
116
|
-
|
117
|
-
for (Fixture* p = this; p; p = p->pnext.get())
|
118
|
-
{
|
119
|
-
b2Filter f = p->b2fixture->GetFilterData();
|
120
|
-
f.categoryBits = bits;
|
121
|
-
p->b2fixture->SetFilterData(f);
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
uint
|
126
|
-
Fixture::category_bits () const
|
127
|
-
{
|
128
|
-
return b2fixture->GetFilterData().categoryBits;
|
129
|
-
}
|
130
|
-
|
131
|
-
void
|
132
|
-
Fixture::set_collision_mask (uint mask)
|
133
|
-
{
|
134
|
-
if (mask > USHRT_MAX)
|
135
|
-
{
|
136
|
-
argument_error(
|
137
|
-
__FILE__, __LINE__, "collision_mask must be less then USHRT_MAX.");
|
138
|
-
}
|
139
|
-
|
140
|
-
if (mask == collision_mask())
|
141
|
-
return;
|
142
|
-
|
143
|
-
for (Fixture* p = this; p; p = p->pnext.get())
|
144
|
-
{
|
145
|
-
b2Filter f = b2fixture->GetFilterData();
|
146
|
-
f.maskBits = mask;
|
147
|
-
b2fixture->SetFilterData(f);
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
uint
|
152
|
-
Fixture::collision_mask () const
|
153
|
-
{
|
154
|
-
return b2fixture->GetFilterData().maskBits;
|
155
|
-
}
|
156
|
-
|
157
105
|
b2Fixture*
|
158
106
|
Fixture::b2ptr ()
|
159
107
|
{
|
@@ -194,12 +142,10 @@ namespace Reflex
|
|
194
142
|
if (!to)
|
195
143
|
return;
|
196
144
|
|
197
|
-
to->set_density(
|
198
|
-
to->set_friction(
|
199
|
-
to->set_restitution(
|
200
|
-
to->set_sensor(
|
201
|
-
to->set_category_bits( from.category_bits());
|
202
|
-
to->set_collision_mask(from.collision_mask());
|
145
|
+
to->set_density( from.density());
|
146
|
+
to->set_friction( from.friction());
|
147
|
+
to->set_restitution(from.restitution());
|
148
|
+
to->set_sensor( from.is_sensor());
|
203
149
|
}
|
204
150
|
|
205
151
|
static Body*
|
data/src/fixture.h
CHANGED
@@ -45,14 +45,6 @@ namespace Reflex
|
|
45
45
|
|
46
46
|
bool is_sensor () const;
|
47
47
|
|
48
|
-
void set_category_bits (uint bits);
|
49
|
-
|
50
|
-
uint category_bits () const;
|
51
|
-
|
52
|
-
void set_collision_mask (uint mask);
|
53
|
-
|
54
|
-
uint collision_mask () const;
|
55
|
-
|
56
48
|
b2Fixture* b2ptr ();
|
57
49
|
|
58
50
|
const b2Fixture* b2ptr () const;
|
data/src/shape.cpp
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
#include "shape.h"
|
2
2
|
|
3
3
|
|
4
|
-
#include <
|
5
|
-
#include <
|
6
|
-
#include <
|
7
|
-
#include <
|
8
|
-
#include <
|
9
|
-
#include <
|
4
|
+
#include <box2d/b2_body.h>
|
5
|
+
#include <box2d/b2_fixture.h>
|
6
|
+
#include <box2d/b2_circle_shape.h>
|
7
|
+
#include <box2d/b2_edge_shape.h>
|
8
|
+
#include <box2d/b2_chain_shape.h>
|
9
|
+
#include <box2d/b2_polygon_shape.h>
|
10
10
|
#include <rays/polygon.h>
|
11
11
|
#include "reflex/exception.h"
|
12
12
|
#include "reflex/debug.h"
|
@@ -209,9 +209,15 @@ namespace Reflex
|
|
209
209
|
|
210
210
|
b2ChainShape b2shape;
|
211
211
|
if (polyline.loop())
|
212
|
-
b2shape.CreateLoop(
|
212
|
+
b2shape.CreateLoop(&(*buffer)[0], (int32) buffer->size());
|
213
213
|
else
|
214
|
-
|
214
|
+
{
|
215
|
+
b2shape.CreateChain(
|
216
|
+
&(*buffer)[0],
|
217
|
+
(int32) buffer->size(),
|
218
|
+
(*buffer)[0],
|
219
|
+
(*buffer)[buffer->size() - 1]);
|
220
|
+
}
|
215
221
|
|
216
222
|
builder->add(&b2shape);
|
217
223
|
}
|
@@ -239,7 +245,7 @@ namespace Reflex
|
|
239
245
|
|
240
246
|
UPDATE_POLYGON = Xot::bit(0),
|
241
247
|
|
242
|
-
DEFAULT_FLAGS =
|
248
|
+
DEFAULT_FLAGS = UPDATE_POLYGON
|
243
249
|
|
244
250
|
};// Flags
|
245
251
|
|
@@ -269,7 +275,7 @@ namespace Reflex
|
|
269
275
|
else
|
270
276
|
pframe.reset(new Bounds(frame));
|
271
277
|
|
272
|
-
|
278
|
+
update_polygon_later();
|
273
279
|
}
|
274
280
|
|
275
281
|
virtual Bounds get_frame () const
|
@@ -287,7 +293,7 @@ namespace Reflex
|
|
287
293
|
return (bool) pframe;
|
288
294
|
}
|
289
295
|
|
290
|
-
void
|
296
|
+
void update_polygon_later ()
|
291
297
|
{
|
292
298
|
if (!owner) return;
|
293
299
|
|
@@ -299,6 +305,9 @@ namespace Reflex
|
|
299
305
|
{
|
300
306
|
assert(shape);
|
301
307
|
|
308
|
+
bool update = Xot::check_and_remove_flag(&flags, UPDATE_POLYGON);
|
309
|
+
if (!update && !force) return;
|
310
|
+
|
302
311
|
if (!owner || !View_is_active(*owner))
|
303
312
|
polygon = Polygon();
|
304
313
|
else
|
@@ -364,6 +373,10 @@ namespace Reflex
|
|
364
373
|
if (!owner)
|
365
374
|
invalid_state_error(__FILE__, __LINE__);
|
366
375
|
|
376
|
+
// if the view has been added to the window but on_update() has not yet
|
377
|
+
// been called, update_polygon() has also never been called.
|
378
|
+
update_polygon(shape);
|
379
|
+
|
367
380
|
Polygon polygon = get_polygon_for_fixtures();
|
368
381
|
if (!polygon || polygon.empty())
|
369
382
|
return NULL;
|
@@ -424,11 +437,7 @@ namespace Reflex
|
|
424
437
|
if (!shape)
|
425
438
|
argument_error(__FILE__, __LINE__);
|
426
439
|
|
427
|
-
|
428
|
-
&shape->self->flags, Shape::Data::UPDATE_POLYGON);
|
429
|
-
|
430
|
-
if (update || force)
|
431
|
-
shape->self->update_polygon(shape, force);
|
440
|
+
shape->self->update_polygon(shape, force);
|
432
441
|
}
|
433
442
|
|
434
443
|
void
|
@@ -552,36 +561,6 @@ namespace Reflex
|
|
552
561
|
return f ? f->is_sensor() : false;
|
553
562
|
}
|
554
563
|
|
555
|
-
void
|
556
|
-
Shape::set_category_bits (uint bits)
|
557
|
-
{
|
558
|
-
if (bits == category_bits()) return;
|
559
|
-
|
560
|
-
self->fixtures(this).set_category_bits(bits);
|
561
|
-
}
|
562
|
-
|
563
|
-
uint
|
564
|
-
Shape::category_bits () const
|
565
|
-
{
|
566
|
-
const Fixture* f = self->pfixtures.get();
|
567
|
-
return f ? f->category_bits() : 0x1;
|
568
|
-
}
|
569
|
-
|
570
|
-
void
|
571
|
-
Shape::set_collision_mask (uint mask)
|
572
|
-
{
|
573
|
-
if (mask == collision_mask()) return;
|
574
|
-
|
575
|
-
self->fixtures(this).set_collision_mask(mask);
|
576
|
-
}
|
577
|
-
|
578
|
-
uint
|
579
|
-
Shape::collision_mask () const
|
580
|
-
{
|
581
|
-
const Fixture* f = self->pfixtures.get();
|
582
|
-
return f ? f->collision_mask() : 0xffff;
|
583
|
-
}
|
584
|
-
|
585
564
|
void
|
586
565
|
Shape::on_draw (DrawEvent* e)
|
587
566
|
{
|
@@ -594,7 +573,13 @@ namespace Reflex
|
|
594
573
|
Shape::on_resize (FrameEvent* e)
|
595
574
|
{
|
596
575
|
if (!self->has_frame())
|
597
|
-
self->
|
576
|
+
self->update_polygon_later();
|
577
|
+
}
|
578
|
+
|
579
|
+
bool
|
580
|
+
Shape::will_contact (Shape* s)
|
581
|
+
{
|
582
|
+
return true;
|
598
583
|
}
|
599
584
|
|
600
585
|
void
|
@@ -695,7 +680,7 @@ namespace Reflex
|
|
695
680
|
{
|
696
681
|
get_data(*this).polygon = polygon;
|
697
682
|
|
698
|
-
self->
|
683
|
+
self->update_polygon_later();
|
699
684
|
}
|
700
685
|
|
701
686
|
const Polygon&
|
@@ -771,7 +756,7 @@ namespace Reflex
|
|
771
756
|
{
|
772
757
|
get_data(*this).points.emplace_back(point);
|
773
758
|
|
774
|
-
self->
|
759
|
+
self->update_polygon_later();
|
775
760
|
}
|
776
761
|
|
777
762
|
void
|
@@ -780,7 +765,7 @@ namespace Reflex
|
|
780
765
|
auto& array = get_data(*this).points;
|
781
766
|
array.insert(array.end(), points, points + size);
|
782
767
|
|
783
|
-
self->
|
768
|
+
self->update_polygon_later();
|
784
769
|
}
|
785
770
|
|
786
771
|
void
|
@@ -875,7 +860,7 @@ namespace Reflex
|
|
875
860
|
data.round_left_bottom = left_bottom;
|
876
861
|
data.round_right_bottom = right_bottom;
|
877
862
|
|
878
|
-
self->
|
863
|
+
self->update_polygon_later();
|
879
864
|
}
|
880
865
|
|
881
866
|
void
|
@@ -883,7 +868,7 @@ namespace Reflex
|
|
883
868
|
{
|
884
869
|
get_data(*this).round_left_top = round;
|
885
870
|
|
886
|
-
self->
|
871
|
+
self->update_polygon_later();
|
887
872
|
}
|
888
873
|
|
889
874
|
coord
|
@@ -897,7 +882,7 @@ namespace Reflex
|
|
897
882
|
{
|
898
883
|
get_data(*this).round_right_top = round;
|
899
884
|
|
900
|
-
self->
|
885
|
+
self->update_polygon_later();
|
901
886
|
}
|
902
887
|
|
903
888
|
coord
|
@@ -911,7 +896,7 @@ namespace Reflex
|
|
911
896
|
{
|
912
897
|
get_data(*this).round_left_bottom = round;
|
913
898
|
|
914
|
-
self->
|
899
|
+
self->update_polygon_later();
|
915
900
|
}
|
916
901
|
|
917
902
|
coord
|
@@ -925,7 +910,7 @@ namespace Reflex
|
|
925
910
|
{
|
926
911
|
get_data(*this).round_right_bottom = round;
|
927
912
|
|
928
|
-
self->
|
913
|
+
self->update_polygon_later();
|
929
914
|
}
|
930
915
|
|
931
916
|
coord
|
@@ -939,7 +924,7 @@ namespace Reflex
|
|
939
924
|
{
|
940
925
|
get_data(*this).nsegment = nsegment;
|
941
926
|
|
942
|
-
self->
|
927
|
+
self->update_polygon_later();
|
943
928
|
}
|
944
929
|
|
945
930
|
uint
|
@@ -1054,7 +1039,7 @@ namespace Reflex
|
|
1054
1039
|
{
|
1055
1040
|
get_data(*this).hole_size.reset(width, height);
|
1056
1041
|
|
1057
|
-
self->
|
1042
|
+
self->update_polygon_later();
|
1058
1043
|
}
|
1059
1044
|
|
1060
1045
|
void
|
@@ -1074,7 +1059,7 @@ namespace Reflex
|
|
1074
1059
|
{
|
1075
1060
|
get_data(*this).angle_from = degree;
|
1076
1061
|
|
1077
|
-
self->
|
1062
|
+
self->update_polygon_later();
|
1078
1063
|
}
|
1079
1064
|
|
1080
1065
|
float
|
@@ -1088,7 +1073,7 @@ namespace Reflex
|
|
1088
1073
|
{
|
1089
1074
|
get_data(*this).angle_to = degree;
|
1090
1075
|
|
1091
|
-
self->
|
1076
|
+
self->update_polygon_later();
|
1092
1077
|
}
|
1093
1078
|
|
1094
1079
|
float
|
@@ -1102,7 +1087,7 @@ namespace Reflex
|
|
1102
1087
|
{
|
1103
1088
|
get_data(*this).nsegment = num_of_segments;
|
1104
1089
|
|
1105
|
-
self->
|
1090
|
+
self->update_polygon_later();
|
1106
1091
|
}
|
1107
1092
|
|
1108
1093
|
uint
|
data/src/view.cpp
CHANGED
@@ -2322,40 +2322,6 @@ namespace Reflex
|
|
2322
2322
|
return s ? s->is_sensor() : false;
|
2323
2323
|
}
|
2324
2324
|
|
2325
|
-
void
|
2326
|
-
View::set_category_bits (uint bits)
|
2327
|
-
{
|
2328
|
-
Shape* s = shape();
|
2329
|
-
if (!s)
|
2330
|
-
invalid_state_error(__FILE__, __LINE__, "view has no shape.");
|
2331
|
-
|
2332
|
-
s->set_category_bits(bits);
|
2333
|
-
}
|
2334
|
-
|
2335
|
-
uint
|
2336
|
-
View::category_bits () const
|
2337
|
-
{
|
2338
|
-
const Shape* s = self->pshape.get();
|
2339
|
-
return s ? s->category_bits() : 0x1;
|
2340
|
-
}
|
2341
|
-
|
2342
|
-
void
|
2343
|
-
View::set_collision_mask (uint mask)
|
2344
|
-
{
|
2345
|
-
Shape* s = shape();
|
2346
|
-
if (!s)
|
2347
|
-
invalid_state_error(__FILE__, __LINE__, "view has no shape.");
|
2348
|
-
|
2349
|
-
s->set_collision_mask(mask);
|
2350
|
-
}
|
2351
|
-
|
2352
|
-
uint
|
2353
|
-
View::collision_mask () const
|
2354
|
-
{
|
2355
|
-
const Shape* s = self->pshape.get();
|
2356
|
-
return s ? s->collision_mask() : 0xffff;
|
2357
|
-
}
|
2358
|
-
|
2359
2325
|
void
|
2360
2326
|
View::set_linear_velocity (coord x, coord y)
|
2361
2327
|
{
|
@@ -2613,6 +2579,12 @@ namespace Reflex
|
|
2613
2579
|
{
|
2614
2580
|
}
|
2615
2581
|
|
2582
|
+
bool
|
2583
|
+
View::will_contact (View* v)
|
2584
|
+
{
|
2585
|
+
return true;
|
2586
|
+
}
|
2587
|
+
|
2616
2588
|
void
|
2617
2589
|
View::on_contact (ContactEvent* e)
|
2618
2590
|
{
|