How to clear the detection using on-screen buttons? - android

Basically, I want to be able to clear the augmentation using the X button on the top-left corner of the screen, as shown in the picture.
This was done using some script in Unity3D.
Any idea how this is done?
Here's the link to the video: https://www.youtube.com/watch?v=9tksyhVlIMQ

These are my findings:
If you want on-screen buttons, then just parent the button UI to the Camera and position in a particular corner of the screen or something.
Now if you function it to work like if pressed and you want to clear or start detection use these:
TrackerManager.Instance.GetTracker<ImageTracker>().Stop();
TrackerManager.Instance.GetTracker<ImageTracker>().Start();
Took me a long time to figure this out. Hope it helps someone out there. :)

Related

pygame - link an object to mouse event

I am trying to develop a game for Android using pygame.
It would be a platformer. To move the main charachter, I would make the game to wait for mouse events (like pygame.MOUSEBUTTONDOWN).
In order to do that on mobile, I'd like to create a graphic representation of a joypad with arrow keys to be shown on the bottom left corner of the screen.
Now, when the user touches one of the arrows, a MOUSEBUTTONDOWN event should be triggered and the charachter should move accordingly.
My question is: since the "joypad" object is a mere draw, how can I link it to the event with pygame?
Is there a way to do so? Should I use the pixel coordinates of the arrow keys of the joypad or is there a better choice?
As far as I know this is not possible.
When handling input, mouse input and touch input are to be handled separately.
So to answer the 2 questions you listed at the end:
As far as I know there is no way to implement this functionality.
You could use the pixel coordinates of the arrows. However you can use Rects for that and test if the place of mouse input/touch input is inside the arrow button Rect with the collidepoint method
You can achieve that as follows:
arrow_left.collidepoint(mouse_x, mouse_y)
I hope this answer helped you!

Animation Button that scales and surround with circle

For some reason,
I feel this kind of UI and it's interactive way
is highly profound and intuitive.
(Below picture shows the specific App).
Mainly speak,
when the user enters the screen,
the Scan button would scale out and back,
acting like a heartbeat, which gives the user an intention to click the button.
the button not only scale out but with a circle surround it, looks just like the ripple in the water.
Here comes the question of implementing these technique on Android UI,
I had do some survey and found that:
for UI component to scale out we can use android.view.animation.ScaleAnimation,
But how could I possible to draw a ripple that will surround the button while it scaling out?
Could anyone give me some advice of doing these kind of tasks?
Namely "the website resources", "Github", "Framework" or "API reference"?
I've already decompiler the apk and give up when I saw only mess code there
(I think due to the Proguard or something that protect peeking from decompile)

Android diagonal triangle buttons

I am working on an android application.
I need to have 2 buttons but similar to the following picture.
The red triangle is a button and the yellow is another button.
How can this be achieved?
Is there a way to do it other than having it as 1 picture and then checking the touch position? because that would involve a lot of math and might not be precise. Also if I use this method I cannot have a clicked state on the each button seperatly. (like when the button grays out on touch down)
Thanks for any tips.

Animation sinusoid in android

I have a problem with moving animation. I want to create animation which start when I to a screen and she starts from touched place and go to end place like on this picture:
The end place is constant. How Can I do this sinusoid movement?
edit1: I want to click and when i click, show image and he goes this way to end place. I don't click and drag this picture. This picture must shows and goes to this place without my help. Only what I do is touch the screen. How I can do that?I have a problem with moving animation. I want to create animation which start when I to a screen and she starts from touched place and go to end place like on this picture:
The end place is constant. How Can I do this sinusoid movement?
edit1: I want to click and when i click, show image and he goes this way to end place. I don't click and drag this picture. This picture must shows and goes to this place without my help. Only what I do is touch the screen. How I can do that?
I wrote something like this that allows curved animation, you can see the full answer (and working code) here: Problem to achieve curved animation
It shouldn't be too difficult to either chain a number of those together, or modify the algorithm to use a cubic (or higher) function to produce multiple curves.
Only caveat is that because of the bezier curve, there is no guarantee the path will actually travel through the middle point you give it. If this is a problem again you could easily replace the bezier algorithm I use in the above example with something more suitable for your needs.
Check the sources of TranslationAnimation where the translation is done. Then build your function that maps the sinus function on the line from start to end. You could start with setting a horizontal line of with length dist(start,end) starting at (start), mapping sinus on it and then rotating it around your starting point.

using onOffsetsChanged() to get home screen swipe direction

I'm working on my Live Wallpaper and I want it to scroll with the screen like a normal wallpaper does. I know I need to use onOffsetsChanged() but which parameter will tell me the direction that the home screen is being swiped? It seems like xOffset always returns a positive value no matter which way the screen slides.
Thank you.
The direction alone will not help you: you need to know the exact offset, because the user may have jumped several screens at once (e.g. by using a pop-up that displays mini-versions of all the home screens).
Generally speaking, you want to save the xPixel value you get in onOffsetsChanged, then use this to translate your canvas.
See my two answers below:
onOffsetsChanged: move Bitmap
android live wallpaper rescaling

Categories

Resources