Mouse cursor is not showing in windows store game developing using monogame - xna

I am developing a game for windows store (desktops) using monogame framework. everything else is working excellent except the Mouse cursor which is working well but not showing at time of playing game.
protected override void Update(GameTime gameTime)
{
// TODO: Add your update logic here
TouchCollection touch = TouchPanel.GetState();
ms = Mouse.GetState();
if (ms.LeftButton == ButtonState.Pressed)
{
Debug.WriteLine("pressedddddd");
}
}
you can see above code ... i am getting ouptut in output window "pressed" but i cant see the cursor on screen i am developing this on windows 8.1 pc and visual studio 2013 using monogame

Put the below in the initialization function to make the mouse visible.
this.IsMouseVisible = true;

Related

GWT: Textbox doesn't show Cursor on Ipad

I am trying to implement a Textbox that can show fractions with GWT.
Therefor I have an Canvas were I can draw what I want and receive KeyEvents and MouseEvents.
But on Ipad (Safarie and Chrome) the software keyboard does not show, so I created an Composite and combined the Canvas with a Textbox witch gets the focus after each key or mouse Event on the Canvas.
But the softkeyboard does not show up every time so I tried a bit and can see, that the Textbox seems to get the focus (it gets a blue boarder) but does not always show the cursor.
This does not happen on my Notebook.
Is there any difference between being focused and showing the cursor?
I tried:
Setting the Cursor position
set the Text of the Textbox.
Any help would be appreciated,
Christoph
public void setFocus(boolean b) {
// if (hasFocus) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute () {
t.setFocus(b);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute () {
box.setFocus(true);
box.setText("x");
box.setCursorPos(0);
// box.setVisible(false);
// box.setVisible(true);
}
});
// t.setFocus(b);
// box.setFocus(b);
// }
}
The iOS browsers don't allow the focus to be set programmatically unless directly in response to a user interaction (i.e. a touch). I believe the reason is to prevent websites bringing up the virtual keyboard for no reason.
The downside is that it clobbers setFocus() for websites that want to use it for legitimate reasons. You can't call setFocus() in a deferred command because that doesn't count as a direct response to the user interaction.
(To be more precise, you can call setFocus() in a deferred command, but it won't have the desired effect as you found out.)

Enable WebView pinch and zoom in android xamarin forms

I use web view in xamarin forms (ios-android) and IOS recognize pinch and zoom but in android nothing happened . How can I add this and for android ?
I create custom renderer for WebView. I add following code inside OnElementPropertyChanged event.
Android
if(Control != null)
{
Control.Settings.BuiltInZoomControls = true;
Control.Settings.DisplayZoomControls = true;
}

JavaFX8: Application in fullscreen mode doesn't show focus on elements

I have the following problem: I would like to see which textfield or button is focused when I enter my multiscreen application in fullscreen mode. But for some reason, it is not showing the focus "glow" around for example a textfield. This is not a major problem, while it is focused the way I want it (requestFocus() does its job).
But it now gets annoying when I want to use AutoComplete TextField Completion from ControlsFX (How to implement AutoComplete TextField using ControlsFX), because the list is not shown in full screen mode.
I will clarify the situation with these screenshots:
How it is now in fullscreen mode:
How it should be (and how it is in non fullscreen):
To be clear: the problem doesn't only exist with AutoComplete TextField, but with every FXML element.
If I use the fullscreen mode from OSX itself, it works the proper way (It gives an error on the background). But I want the application to start in fullscreen mode.
This the code from my Main.java:
public class Main extends Application {
//Get the screenscontroller instance
octocash.GUI_Screens.ScreensController mainContainer = octocash.GUI_Screens.ScreensController.getInstance();
//Get the configuration instance
Configuration initApp = Configuration.getInstance();
//Create an object of Functions to establish a database connection
public static Functions databaseConnection = new Functions();
//Create a stage object to hold the primarystage
public static Stage primaryStage;
#Override
public void start(Stage stage) throws Exception {
primaryStage = stage; //set the primary stage
databaseConnection.DB_Connect(); //establish database connection
//Load the initial screen (lockscreen)
mainContainer.loadScreen(Configuration.lockScreen, Configuration.lockScreenFile);
mainContainer.setScreen(Configuration.lockScreen);
Group root = new Group(); //Create a group to hold all other screens
root.getChildren().addAll(mainContainer); //Add all Screenscontroller screens to the Group
Scene scene = new Scene(root); //set the group to the scene
stage.getIcons().add(new Image("file:src/octocash/images/octo_cash_logo.png")); //add a menubar icon
stage.setTitle("OctoCash Development"); //set the window name
stage.setScene(scene); //set the scene
stage.setFullScreen(true); //full screen without borders (no program menu bars)
stage.setFullScreenExitHint(""); //Don't show "Press ESC to exit full screen"
//stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); //DO NOT TURN ON UNLESS YOU CREATED ANOTHER METHOD TO EXIT THE PROGRAM
stage.show(); //show the application
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args); // start the application
}
}
As you can see, I am using a ScreensController, which is basically a StackPane with all of the screens in it.
I hope the question is clear to you all.
Any help is greatly appreciated!
I figured out that this is an error in Java JDK 8u25. I have now updated to Java JDK 8u40, and this solves the problem. Also, I have tested the fullscreen focus on Windows and Linux, and there it also works. So if you are having the same problem, just update your JDK.

XNA how to check if the game window cross "X" is clicked

Hi am making a game for Windows PC using XNA and I want to check when the game window cross "X" is clicked, so I can instead draw a menu and do other stuff instead of the game closing.
So yea, how can I check when the cross is clicked.
Thanks!
There is nothing special needed for XNA, you can do this the same way as you could without it.
In your Initialize or LoadContent method need to find the Windows form reference your game is using, and add a Closing event to it.
Form form = Form.FromHandle(Window.Handle) as Form;
form.FormClosing += OnClosing;
Then using this OnClosing method, you can cancel the close event, and run your own menu screen. (Probably by changing the game state and drawing something else)
void OnClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
ShowMenuScreen();
}

XNA loading/splash screen on game start

I'm trying to have a loading screen that pops up as soon as you run that executable that launches the game, whilst the game loads I want to display an image on the desktop much like how Gamemaker allows you to have a loading image.
I've had a brief look around and most people want an image to be shown whilst they load content which is not what I want, or perhaps it is... =P
My guess would be to set the game window borderless at the start, load the splash screen, draw it, then begin all the main loading (Specifically loading DirectInput through SlimDX takes a while). However would this support having a transparent/irregular shaped image? E.G if I wanted a borderless circle to be displayed whilst the game loads, would that be possible?
Thanks.
It's very simple. Just implement System.Threading and you're done.
Here's how it works, first add:
using System.Threading;
to the top of your class, then add the following things:
//the enum for state types
enum GameState
{
Loading,
StartMenu
}
//Init our gameState enum as variable
GameState gameState;
protected override void LoadContent()
{
gameState = GameState.Loading;
spriteBatch = new SpriteBatch(GraphicsDevice);
device = GraphicsDevice;
Window.Title = "Your Window";
//Other stuff that you had here before, now go in LoadGame()
loadingscreen = Content.Load<Texture2D>("loading");
Thread bgLoad = new Thread(new ThreadStart(LoadGame));
bgLoad.IsBackground = true;
bgLoad.Start();
}
public void LoadGame()
{
//Loading stuff here
gameState = GameState.StartMenu; //or GameState.Playing
}
and then put a loading texture in your Content Project
If I understand you correctly, you essentially want to have a window opened that is not full screen that also lacks the regular border and buttons that accompanies a window.
I can't test this but this should be a good start.
Here!
I would start by creating a bare bones Game1 class that can track an image and keep track of time for a timer.
Later you could add logic that actually tracks the loading of assets in the main program.
To start I'd just test it for a fixed time like 3 seconds.

Resources