Report as inappropriate.
Source code included, feel free to take it and include it in whatever you need. Credit not required, however it'd be nice if you did :)
This scenario demonstrates a class (Magnify.class) which will (surprise surprise) magnify whatever's under it.
This is (as far as I know) the only magnifier on the gallery with support for magnifying actor's as well as the world image.
Also, hold space to spawn balloons of a random transparency to test the magnification of actors support.
Instructions for use:
- The magnifier will follow your mouse unless its locked on to an actor
- To lock it to an actor, simply click on an actor
- To unlock it, click it again (also it will unlock if the actor is removed from the world)
Instructions for adding it to one of your scenario's:
- Add the Magnify.class to your scenario
- In your world class, include the following line of code in the world's constructor:
setPaintOrder(Magnify.class, <Whatever other actor classes you have>);
- eg:
setPaintOrder(Magnify.class, AnActor.class, AnotherActor.class);
- and then obviously just add an object of the Magnify class to the world! :)
Notes:
- In Magnify.class, there are some fields you can adjust to your liking:
private double zoom = 1.75; //Adjust this to the level of zoom you want.
private int radius = 75, //Adjust this to the radius of the zoomed image you want.
private boolean shouldLock = true; //Turn this to false if you don't want locking to actors.
private boolean noCursor = true; //Turn this to false if you want to be able to see the mouse all the time.
If you have any trouble using this, please post a comment and I'll help you out.
Want to leave a comment? You must first log in.
No votes yet.
2012/1/23
2012/1/24
2012/1/24
2012/1/24
2012/1/24
2012/1/24
2012/1/24