Look at the MinMaxRect class
https://github.com/buxx/synergine2/blob/tile/synergine2_cocos2d/gui.py#L96
Is missing the method draw :)
Copy it from the cocos samples and it will work. Tested.
Nice trick you pulled with your 'Setup commands", the novelty make me
follow along against good sense, otherwise I would have replied with
the "please post a small script reproducing your problem"
For any other reader: this will not work again.
For future you: I probably will not put more than 15' in investigating
any further problem in an extended codebase, so try to ask over small
sample code.
I invested 2+ hours in this, to illustrate:
"""
I managed to adapt the instalation instructions to venv and Windows,
packages installation seems to terminate normal doing
python -m pip install --upgrade pip
python -m pip install --use-wheel psutil
# del psutil line from requirement.txt
python -m pip install -r requirements.txt
But when I try to run the script
(venv3.5) F:\dev\test_bux_cocos>python sandbox/tiledstrategy/run.py
maps/003
Traceback (most recent call last):
File "sandbox/tiledstrategy/run.py", line 11, in <module>
from sandbox.tiledstrategy.simulation.base import
TiledStrategySimulation, T
iledStrategySubjects
File
"F:\dev\test_bux_cocos\sandbox\tiledstrategy\simulation\base.py", line 2,
in <module>
from synergine2.xyz <http://synergine2.xyz> import XYZSimulation
File "F:\dev\test_bux_cocos\synergine2\xyz.py", line 7, in <module>
from synergine2.simulation import SubjectMechanism, Subjects, Subject
File "F:\dev\test_bux_cocos\synergine2\simulation.py", line 247, in
<module>
class SubjectBehaviourSelector(BaseObject):
File "F:\dev\test_bux_cocos\synergine2\simulation.py", line 250, in
SubjectBeh
aviourSelector
behaviours: typing.Dict[typing.Type[SubjectBehaviour], object],
AttributeError: module 'typing' has no attribute 'Type'
Now, I have a ubuntu 17.04 machine for testing some other code, but
psutil will not install there (compilation fails because no python
headers. I know they can be had by apt-get install python-dev, but
that is a global command and I don't want to risk the other work I m
doing.)
Trying to run the script at this point failed.
Searching for 'psutils' in ~/dev/test_bux_cocos/*.py the only use
seems to be in tests/test_processing.py , so I deleted the psutil line
in requirements.txt and rerun the pip install.
Then tried again the script; this time it runs.
Ok, it not draws the selection box.
Where to look? Multiple posibilities, of the top of my head
- how is the scene composed ? it is at the right layer ?
- coords conversion problems ?
- is the code from the cocos samples copied verbatim or there is
some subtle change ?
Looking a bit over your pointers to code; scene composition... too
much to read, editor... hang me if I know if it is verbatim, random
scrolling... , mhhh . This going nowhere, I have no time...; lets see
if anything on the selection box draw code has changed ... bingo!
Wrote reply
"""
I'm not angry, just explaining why probably seeking help over an
extended codebase will not work.
Cheers!
On Wed, Jun 28, 2017 at 5:45 PM, Bastien Sevajol
<[email protected] <mailto:[email protected]>> wrote:
Hello,
I'm tring to reproduce (copy-paste mouse_elastic_box_selection.py)
the MinMaxRect and ProbeQuad. ProbeQuad is working, but MinMaxRect
is not visible. When i debug/look at logs, python correctly enter
in begin_drag, adjust_elastic_box, etc functions. But rectangle
selection is not visible.
I hope it will be not to much difficult to enter in my code, but
to reproduce:
Setup commands:
git clone https://github.com/buxx/synergine2.git
<https://github.com/buxx/synergine2.git> test_bux_cocos
cd test_bux_cocos/
git checkout tile
virtualenv --no-site-packages -p /usr/bin/python3.5 venv3.5
source venv3.5/bin/activate
pip install -r requirements.txt
Run the script:
python sandbox/tiledstrategy/run.py maps/003
You should see a top view map, with some trees and some actors
moving. ProbeQuad is visible under mouse. When click, drag and
move, terminal who run command print the following log:
begin drag
begin drag selection: drag_selecting, drag_moving True False
But no rectangle appear.
Interesting source code is layer construction here
<https://github.com/buxx/synergine2/blob/tile/synergine2_cocos2d/layer.py#L32>
and layers classes (copy-paste mouse_elastic_box_selection.py
copied code is here) here
<https://github.com/buxx/synergine2/blob/tile/synergine2_cocos2d/gui.py>.
Regards,
Bux.
Le 27/06/2017 à 22:27, claudio canepa a écrit :
On Tue, Jun 27, 2017 at 4:42 PM, Bastien Sevajol
<[email protected] <mailto:[email protected]>> wrote:
Hi,
My intent is the number two: add actors who will move on a
grid specified in the tmx file.
That will not work with RectMapLayer; it can work with
tiles.TmxObjectLayer plus mapcoliders.TMXObjectMapCollider
There are some demos for them at
https://github.com/los-cocos/etc_code/tree/master/tmx_collision
<https://github.com/los-cocos/etc_code/tree/master/tmx_collision>
I thought RectMapLayer can help me about that with this
"grid" management and functions like
get_at_pixel/get_in_region (to select actor with click for
example).
If the actors quantity is big, the selection can be too slow;
then it would be better to use collision module (theres an
example of mouse picking with collision module in samples\
mouse_elastic_box_selection.py , available from the cocos repo ar
the zip downloaded from pipy)
--
You received this message because you are subscribed to the Google
Groups "cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/cocos-discuss
<https://groups.google.com/group/cocos-discuss>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to a topic in the
Google Groups "cocos2d discuss" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/cocos-discuss/WOdnOu_7y44/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.