Emulate mouse in ALL directX games - c++

I want to emulate mouse movement using C++ code inside directX games.
I know that we cannot use setCursorPos since inside the game the cursor position stays fixed.
I tried making an HID using arduino controller but that only moves mouse in integer values and does not give smooth transitions.
So I want to do that at kernel level wherein I can take external inputs from a controller and move mouse inside all of the existing directX games as though the game is reading HID signal itself.
This is my problem statement however I don't know how to go about solving this.
I found a few similar questions simulate mouse click in DirectX game, DirectX Game Hook , Hook/OverLay a directX game where DirectX hook implementation was asked but no implementable answers were provided.
I tried using the GlovePIE application but that did not work when I tried it inside a game. I tried it with GTA V and COD.
So basically my question is how do I emulate mouse through a C++ code inside a DirectX game.

Related

CocosSharp - using device camera as a game background

I am currently going through some game cross-platform frameworks and I really like the sound and look for CocosSharp.
However I haven't been able to find out if it is possible to use device camera in the game itself. In my case I would like to use whatever the device camera is seeing to project as a background to my game.
Is this possible with CocosSharp? If so, would anyone be able to point me to a code snippet / which class to work with?

Manage touch events to draw lines in cocos2d-x

I am coding a game with cocos2d-x in c++.
In my game scene i will place some instances of my class CircleSprite (Which is an extension of Layer where i create multiple items and set them like child of CircleSprite.
In my scene the user should touch one circle and connect it to another one by moving the finger until another circle is reached. While doing this a line (sprite or draw it dosen't matter) should appear and follow the finger until reach the choosen circle.
I'm new with cocos2d programming and i'm not a c++ expert...i don't know how to manage the events.
Check this official tutorial
http://www.cocos2d-x.org/wiki/User_Tutorials-Dragging_a_Sprite_Around_the_Screen
Also check the version of cocos2dx for which this tutorial was written. If yours is a lower version then v2.3, then you just need to override onTouchesBegin and onTouchesEnded onTouchesMoved functions of the layer, the are already registered with the touch events.

Changing the cursor in a C++ game

I'm currently creating a 2D game using C++ and OpenGL. I was wondering whether anyone could explain the best way to change the current cursor from the mouse icon. I am creating a top down shooting game and therefore would like the cursor to be displayed as a crosshair instead.
You can either use your OS-specific function for manually changing the mouse pointer icon (and the "hot point" of that icon), or you can use the OS-specific functions for hiding the mouse pointer, and manually drawing your own image using the last mouse-move event that your application received.
Alternatively, instead of using OS-specific functions, you can use a cross-platform API that wraps those kinds of functions for you (SDL, SFML, Qt, to name a few).
OpenGL doesn't have any functions that specifically operate on mouse pointers - that'd be a windowing API thing, not a 3D graphics thing. OpenGL only deals with drawing graphics.
If you are using GLUT (which isn't 'OpenGL' but an add-on library), you can call:
glutSetCursor(GLUT_CURSOR_NONE);

Achieve Infinite Scrolling for a platformer game using cocos2d language objective c

I am trying to develop an 2D game using cocos2d library. I am still learning the framework.
Please understand that I am new to game development but not new to programming using objective c.
Here is the issue I am facing when it comes to my game development effort - I feel that I am missing the theoretical understanding of how to develop an infinite scrolling game. Is it possible for any of you to provide me some guidance on that ?
Here is my understanding of achieving infinite scrolling using cocos2d framework:
Cocos2d has a singleton director class which handles the current scene and scene transitions
In the current scene, I feel like I have to create an platform object consisting of several images and add them as a child to the current layer. And constantly run a move action to the platform sprite. So as and when I detect a particular image is off screen I have to replace it with another image. That way I will be able to create an infinite scrolling.
I am sorry if point 2 is not coherent. I just attempted to put my understanding of how to infinite scrolling.
Can you please help me with this ?
Thanks
I dissected how to implement scrolling with cocos2d-iphone in this article. What you probably want is the "fake scrolling" approach where two background images are moved and switch position after one completely left the screen.
You want to do this for the background layer only, not individual sprites. Your world isn't really moving, it's just the background panning that creates the illusion of movement. All sprites etc (player, enemies) movement is still relative to screen coordinates.
You'll find a working implementation in the code for my Learn Cocos2D 2 book in the Shoot'em Up project.
If you don't want to bother implementing this yourself, KoboldTouch supports endless/infinite scrolling for tilemaps. Here the game objects actually move along with the background infinitely (up to the maximum coordinates supported by float which is around +/- 16 million points).

See if mouse click was handled

I'm currently making a whimsical iPhone app that will allow you to change your windows cursor into a space ship controlled by the iPhone (simple rotation and such), and currently I have the movement and clicking handled, however I'd like to add additional features, such as bullets that you can shoot around the screen which will move until they die or hit a button, which will then be clicked. And I have two questions:
Question number one: Is there any way to detect if the mouse is currently over some click-able button? OR is there any way to see if a mouse event was handled?
Question number two: Is there any way to overlay the screen with small bullets? (perhaps small [3,3] child windows or something?)
Further Information:
The client program will be in c++
SDL or SFML will likely be the graphics libs, if any are necessary (winAPI should be fine)
The most reliable route would be the Microsoft Active Accessibility interface. Many tools to help visually impaired people need to answer the question "Is this a button?", and MSAA answers that question.
Overlaying the screen is trvial in a Windows environment; just create a window :). It can be partially transparent, so you're not restricted to rectangular bullets.