How do I change the angle of the window in Haxe? - window

I wanted to try doing some stuff with the game window.
But I don't know a variable represents that the window's angle.
So yeah, does anyone know?

Related

Unity -- 2d platformer sprite animation in different position

I'm trying to make a simple 2D platformer game. So I got the walking and idle animations working for my sprite, but for some reason when it transitions to the run animation, the sprite is a little off the ground? Does anyone know how I could fix this?
The sprite looks like this in the two animations:
idle:
run:
There's a number of things this could be. Here's some things to consider.
Ensure that the location of the sprite hasn't changed. Do this by looking in the inspector.
Look at the anchor point for each sprite, and make sure they are at the same point.
Check for size differences.
Make sure the sprite is cropped correctly
Look at the animation state diagram to see if an unusual state change occurred.
I'm sure I could find more possible causes, but the bottom line is, take a look at everything you can think of that might be causing the issue. If you've tried that, then look around and see what else you can see. Finally, if that doesn't work, try asking here with everything you've tried included.
I had this problem too and just fixed it. it's actually simple. What causes this is the pivot of your Sprites. You have to go back to the sprite editor and set the privot of your sprites to the same value and that's it.

how make my picturebox cover only my image nt the boarder around it

I'm doing a game app in Visual Studio 2010 windows forms, I had inserted an image in the picture box and I need to bounce my image in the form when it bounces the boarder of the picutre box is overlying on another label or it is distracting another label i.e., it is looking weird as if is is a rectangular image(but i saved the image in .png format)
so is there any one who could help me in this.
and also if possible plz notify me any best technique which is used to make the object jump on to another object(Picture).
(i.e., how to give a best movement to the ball when I press a key) :)
I'm not quite sure what you wanted, isn't the image box same size as your picture?
If there is white in your pic that you don't want to show, you should make it transparent with image editor.
Better way of moving that ball would probably be BitBlt function.
Anyway, it's hard to say what is the best way to move the ball since you did not say how you want to move it. Timer which moves ball while key is pressed is probably the simplest way to do that.

LibGDX: is there a way to check if the window is in focus?

I'm really not sure if this is the solution to my problem, but it's the only thing I can think of. I'm designing a simple platforming engine in LibGDX, but whenever you drag the game window (or hold the left mouse button over the window pane) for a certain period of time, when you let go the character will fall through the floor due to a build up of acceleration (the longer you hold it the further he'll teleport down after letting go). For some reason the act of dragging the window prevents the ground from stopping the acceleration buildup. The only solution I can think of is to pause the game when the window is out of focus, but that might be completely wrong.
Thanks.
I solved it by only updating the position if deltaTime is small enough, since deltaTime increases while the window is being dragged.

Using Auto Layout to position an NSWindow

Is it possible to use Auto Layout to position a window on the screen?
I'd like to set up constraints to position a window relative to an NSStatusItem. I'd like the window to be centered below the NSStatusItem, but also not be partially offscreen. So, I'd need weak constraints for centering relative to the NSStatusItem and strong constraints for maintaining a minimum distance from the screen edges.
How can I accomplish this?
Auto Layout doesn't work to position windows. The layout engine works per-window to lay out views within that window.
Luckily, this particular layout problem doesn't look too difficult to accomplish the old way. Figure the frame of the window below the NSStatusItem assuming it fits. Then check to see if that frame intersects with the screen edge. If it does, nudge it to the left until it doesn't.

Absolute Mouse Positions on Processing

This is a copy paste of a post i made on the processing forum (where i haven't got an answer so far) thought i might as well try here.
Processing is a very cool way to draw stuff, specially for the webpages. Just as a reference http://processing.org
Hey, i'm new to processing, i'm using it to make a flashless website, so i'm pretty much drawing on a canvas.
I'm having a problem with the mouse position, although the coordinates, when drawing, consider the top left corner to be position 0,0; the actual mouse coordinates consider the 0,0 to be the top left corner of the browser window.
So my problem is this, the canvas is operating on a centered web-page, whenever the browser changes size, so does the coordinates of the mouse within the canvas.
Is there any way to make the coordinates of the mouse relative to the canvas? So that i can change the size of my browser window and the top left corner will be always 0,0 for the mouse coordinates?
So that's the problem, i dunno how many ppl here in stackoverflow are experienced with this, but i hope someone could help me :)
thanks to the stack overflow community in advance.
I'm not familiar with processing, but can't you just calculate the difference between the top left corner of the browser window and the top left corner of the canvas?
i.e. (using jquery)
$(window).onresize = function() {
//offset return position realive to the document.
var offset = $('#canvas').offset();
window.canvasLeft = offset.left;
window.canvasTop = offset.top;
}
Then you can do something like:
relativeMouseLeftPosition = mouseLeftPosition() - window.canvasLeft;
You should replace #canvas with a css selector for your canvas area.
Also note that window is the global object, I use it here to deal with possible scope problems.
Processing really isn't intended for creating webpages.. It's worse than Flash for sites (processing sketches being Java applets - Java being less common, far more resource-intensive and slow to load..)
That said, there is processing.js, a Javascript port of Processing.
The snake example accesses the mouse. Since it is Javascript, and the canvas is a div, the coordinates should be a bit more sane than Java (which lives in it's own VM world), but I could be wrong..
You can ask the user to calibrate the system, before use. It's not fully an answer to the question, but a sollution to the problem.
Just draw a red dot in the center of the screen, top left and bottem right. Ask the user to click on them, and retrieve the coordinates. Then, you know where the corners of the screen are.

Resources