Detect volume and home button presses on the Siri Remote - tvos

It's relatively straightforward to detect some button presses on the tvOS Siri Remote: the pause/play button, the touchpad area, and with marginally more effort, the MENU button. But there seems to be no way detect or override the function of the + and - buttons, or the Siri or home buttons.
Or is there?

Currently the + and - (volume) buttons on the Siri remote are accessed through private functions. These can't be overwritten or detected, as they have a reserved function. The same goes for the home button.
There are a couple of points that support this claim. First, as the OP noted, there are no events that detect any actions related to the volume buttons. They don't trigger the pressesBegan or similar events either.
Another good place to look for more options with the remote/controller is GCGameController. It looks like it has functionality related to all, but the volume buttons, which are reserved. Take a look at the
Using the Apple TV Remote as a Game Controller section here. It mentions all of the buttons on the remote that can be used in a CGGameController.
As I mention in my other posts, this is a fairly new OS and not everything is available yet. You can always file a bug report with Apple and request certain API to be made public.

Related

Game show buzzer screens

I'm doing a training class right now and one of the games I plan on doing is a Jeopardy style of Q & A. The problem I'm trying to figure out is the buzzer. My idea is to use the projector as the question board I control. The trainees would go to an HTML page with nothing more than a single button. They would turn their monitors around to face me up front. As soon as I read the question they would click the button and it would change their screens the color red.
The button and background color change is easy enough, I got that. There are two problems I'm facing: 1) I need it so that they can't click the button until I'm done reading the question - this one isn't as important, I can just make up a rule. 2) Only the fastest person will have a red screen. To show me who clicked first. The others' buttons will be disabled.
I just have no idea how to even Google these two things. Like: "Disable button for other users"...? Or maybe, "only one click"...?
Any direction to search is appreciated. Eventually, I'd like to add other aspects to like the presenter could click an "incorrect button" then it would clear the screen and enable all the buttons again, for the answer steal.
You can do it with modern WebSocket or applications interact via TCP. However, WebSocket may be overkill for the simple application with a few teams. I faced the same problem before and developed a simple solution with PHP using Flock to write into a shared file on disk. Only request from one team gets the chance to write into that file. Stick to not to use WebSocket, the web page on client site does some polling to receive the "restart" signal from the server for the new question/round. It can run in LAN, different team gets different site, i.e. http://[server-ip]/team1, http://[server-ip]/team2.
You can have control over the round: allow them to press button/ restart, start a new question in http://[server-ip]/admin.
Further improvement can be made in several ways to facilitate your needs (i.e. assign team name, register team, use database instead of a flock file). The code is available here : https://github.com/minhhn2910/buzzergameshow

Use AS3 to open an swf. in a browser without the browser toolbar (forward / back buttons)

I have developed a very large swf. that will only be accessed in-house. There are over 100 scenes & 10000 frames (I had no idea the project would grow this large). I have developed a navigation system within the swf., but I have found that many users are clicking the forward / back buttons in the browser toolbar (IE8). This is a big issue for me, because the user then has no way to return to the location in the swf. that they were in before hitting the back button. Is there a way to code into the swf. using AS3 to ensure that the browser toolbar is disabled?
Disabling the parts of the user interface that the users are using a lot is a very bad idea.
Instead, simply use the browser buttons for navigation.
SWFAddress let's you do that
You can have deep linking, too. (allows users to send a link of where they are to other people)
Take a look at this answer:
How to make the browser back button work for a Flash-based Website?

Catching back and home keys

After I set up my new project with libGDX v1.3.1 i am stuck with something that should be easy. In my main class which extends game I have:
Gdx.input.setCatchBackKey(true);
but I cannot get any response from this (in render method):
if(Gdx.input.isButtonPressed(Keys.BACK)){
this.dispose();
}
It like nothing was pressed, although I can see that the button was pressed in logCat console.
I need to mention that I was using the exact same code until libGDX version 1.0.0 (or the first one with gradle).
Note: i have also tried implementing InputProcessor and then setting the input processor. Result was the same.
And for the home button: using Gdx.input.setCatchMenuKey(true); is not working.
Use isKeyPressed instead of isButtonPressed. Buttons only refers to the three mouse buttons on a desktop game. Everything on Android is a Key (or Peripheral).
You mentioned "home button" but the code you posted is for the menu button. There is no way to catch the home button unless you make your manifest declare your app as a launcher replacement, in which case, the home button will always open your app, even when it's closed, and the user will have no easy way to get to the home screen. And libgdx doesn't have that functionality built in, since that would be weird. You would have to implement it yourself in your manifest and main Activity.
Also, disposing of this, whatever this is, sounds dangerous to do from the input handler. You could be about to render stuff and cause a crash. But I'm not sure where you're trying to use it from. Maybe it's OK.

Is a "close" icon necessary in other platforms?

In iOS, one doesn't need to add a close icon for an app. In the rare event that one wants to kill an app they can do it via the OS.
When looking at the cocos2d-x project that is created by default when using the console (v3.1.1), the sample HelloWorld scene places a button on screen to "close" the app.
Is this actually required in ANY platform ? Does it make sense to add this button at all ?
Apple usually rejects on this and Google and Microsoft don't like it.
You can, however, have close buttons on menus or popovers (say, like a pause screen).

Send mouse events to inactive and hidden windows/WPF forms

I'm developing an app that needs to generate mouse events on a window Win32/WPF which may be minimized or hidden from view on the desktop.
I have tried the user32.dll APIs SendInput, SendMessage, PostMessage etc. These work only if the window is visible on the desktop. Would you know about any methods that work for hidden/inactive windows?
I've also tried .NET's UI Automation library. In this case, a window is brought to the front or I'm not able to get a clickable point for the control.
Any ideas how I can proceed? If I can proceed?
I don't know if you're still interested in an answer (I just stumbled upon this question out of sheer dumb luck), but have you tried making a global windows hook?
I have no honest idea on how to properly go about implementing one; but I know you should be able to add a global windows hook to, well, Windows, to listen for whatever events you want (should include mouse and keyboard events!)
Good luck...