How can i make a slider for levels like in Angry Birds in Corona? - drag

How can i make a slider for levels like in Angry Birds in Corona or like Samsung Galaxy S2 mainpage? When i drag the scene, it brings the other parts of the scene. How can i do that in Corona? Thanks.

This might be of use to you: https://stackoverflow.com/a/7229683/1369488
You could make a display group, longer than the screen, that has all of your level icons. Use the "moved" touch event to sense when the user drags, and have the display group move according to the position of the touch.

Related

Crop and center an avatar in Codename One allowing the user to choose the region to crop

About cropping and centering an avatar in Codename One, I saw similar examples in the manual, in the Javadoc and in the blog, for example the first block of code here:
https://www.codenameone.com/javadoc/com/codename1/capture/Capture.html
But I need something that is different and more difficult.
The main problem is that the face is not always in the exact center of the photo. Some apps allow the user to choose the region to crop.
For example, suppose that after capturing a photo it looks automatically cropped and centered so:
Of course it's wrong, I want the lion at the center. In this case, it could be nice if the user can pinch-to-zoom the lion and drag it to the center of the cropping area, getting something like this:
I don't know where to start to do this with Codename One. Is it possible to do it with a Form shown immediately after capturing a photo, that allows to pinch-to-zoom and center the photo in the cropping area like in the above image? Thank you for suggestions.
This is non-trivial but we probably should have a standardized component that does that. Generally the best approach would be to have an ImageViewer as a layered layout component and an overlay mask on top. This is pretty easy to implement.
The hard part is cutting the image correctly based on the scale/pan values from the ImageViewer class.

Create something similar to the iPhone camera functions selector in Codename One

In this picture, there is a screenshot of the iPhone camera functions selector: the user can horizontally scroll them, and the function name moved to center is selected (it changes its color and it calls a listener that activate the function). It's easier to test on a real iPhone than to describe.
The behavior is very similar to the lightweight string picker, but the main differences are that it's horizontal and it's always shown (while the string picker can be opened and closed).
At the moment, I haven't no idea how to replicate it in Codename One: I need to put it over a camera PeerComponent. I need something "enough" similar and usable: the rotating effect (that I suppose hard to replicate) is very nice but not strictly necessary.
This is the one case where List has no better substitute. Notice that this doesn't cover the slight 3d effect in iOS. You can fake it a bit by using a layered layout and gradient fade on top of the list but that might not look great:
Form f = new Form("Horizontal List", new BorderLayout());
DefaultListCellRenderer.setShowNumbersDefault(false); com.codename1.ui.List<String> l = new com.codename1.ui.List<>("Time-Lapse", "Slo-Mo", "Video", "Foto", "Ritrato");
l.setOrientation(com.codename1.ui.List.HORIZONTAL);
l.setFixedSelection(com.codename1.ui.List.FIXED_CENTER);
f.add(SOUTH, l);
f.show();

Implementing graphics for windows-phone silverlight game

I need to implement a Snakes & Ladders board game for windows phone (8 or 8.1). There will be the classic snakes and ladders board map, but the graphics might need to change (frozen ladders if it is snowing outside, muddy spots on some of the tiles if it is raining etc)
I need a simple and easy way which will allow me to visualize the player moving through the tiles and ladders graphics etc changing. I have seen that in XAML grid if I set an image as background and then add controls in the grid (eg a button for each tile so I can visualize the player moving on each tile), the background image gets overwritten.
So, any ideas?
Ended up doing this via having a button represent the Player and changing the button's margin to move it through the board (represented by a background image). Was not a clean way but the job got done pretty well.
As for the board-graphics changing, i just had 4 different images with the board state and loaded which one i needed in each case. Also not clean, but again got the job done.

Silverlight MapLayer right click issue

I am currently developing a Silverlight OOB application using the Bing Map Control, however I have come across an issue I am struggling to resolve. Basically I have three map layers:-
Base Map (bottom layer)
Icon / Pushpin layer (middle layer)
Shape / drawing layer (top layer)
This all works fine, I have put mouse right click functionality on each of my icons (pushpins if you prefer), if I add a map polygon or polyline to the top layer and this item happens to cover the same area as one of my icons in the middle layer I can no longer get any of the mouse events to fire on my icon.
If anyone can think of a way I can pass the mouse operations from my top layer objects to the middle layer objects please let me know.
Many thanks in advance
Set the IsHitTestVisible of your top layer to false. I feel I need to type more text here but there really isn't much more to say.
It's not clear from your question if you need both the shape and the icon to get the mouse event.
If all you need is for the icon to get the event, then switch the order of your layers so Icon layer is on top.
If you need both shape and icon to get the event, then (if you keep your order with shapes on top) you would need to have some way to tell what icons a shape covers. Do you have a parent/child releationship between them? If not, can you create one? If you set up an event on the shape, and set up OnEvent handlers for the icons that listen to the events, then you can have the icons react as well.
If you are more clear about what your situation is, I could post some code that could help.

silverlight map application like showcase on silverlight.net

we want to make application like silverlight showcase Mapview
where we can search by different category on left hand side panel or people can select country or region on map. can anyone suggest some sample or guidelines to implement this?
Thanks
Given the complexity and obvious expense, I would be really impressed if anything like that was released as a sample (Microsoft are you listening?). It requires a lot of data to drive it.
I have been involved in creating a Xaml World map from scratch (below) and that alone took nearly a day for a stylised polygon version (no fine detail)....
Quoting myself: "You import a map as a background image and use the pen tool to dot-to-dot trace around the country. Combine all those path segments into a single path. Then create a separate poly-path for each state (close them to allow for a fill)."
Once you create them you can name the individual country polygons and connect up mouse logic to make them all glow on mouse over or change colour on press etc.
Basically all the other stuff on that screen are user controls and custom controls. Work out the behaviour you want and create controls to suit your own needs.

Resources