I want my canvas to have a fixed width and high so when say item 200px, by 100px that is relative to the canvas but may get display bigger or smaller depending on the user screen size. So what it want to know is can make canvas 640x360 or what ever size i want but display it the bigger i can on the users screen as zoom so all distastes are the same.
Related
I would like the user of my software to resize the window that is presented to them when they launch the application. I can make the graphics of the game or application resize fine but I can't quite get the coordinates to be the same on every different size. If I have a collision detection box at 50,50 with the dimensions of 50,50. Of course the graphics are at those coordinates. But when I resize it the box stays in the same place but the graphic moves according to resizing.
When you resize the window, the size of the window changes, but the coordinates do not change.
What you need to do is register a listener to changing size, get the current size and change the coordinates of your detection box.
I'm new to LIBGDX game development, and I have faced my first problem. I've created 9.patch drawables (buttons) using texture packer. This drawables can be used on low density and also extra high density screens and quality is the same.
If I run my project with that drawable on desktop project the image shown is okay and perfect size. If I run project on low density android device, drawable becomes huge (almost half of the screen). And also If I run project on extra high density android device the button becomes really small.
So my question is, how to handle drawables in LIBGDX, so the ratio (screen:image size), stays the same no matter resolution/density..?
If your button is a text button. Change the font of your text.
If you are using image button, this might help you
It kind of depends on what you're drawing...If you are just drawing an image, I've found it easier to specify a float width and height in the last 2 parameters of the draw method. If you are using a camera with a fixed viewport size, you can simply use a fixed percentage of your camera viewport so it will always be the same dimensions and draw like this:
batch.draw(drawable,x,y,screenwidth * 0.5f,screenheight*0.5f);
However, if you are using buttons or some other widget inside of a table, you should specify the cell size and it should automatically be resized based on the size of the table cell. Something like:
myTable.add(myWidget).width(300).height(200);
Post up exactly what it is that you need to draw if you get a chance and it will be easier to figure out what needs to happen.
I am drawing a coordinate system with weight, height =10000*10000 on a frame. It too big, my graph can't fully display. I try to draw on scroll but it's lag. I want to display my graph on a frame 10000*10000, fit with my screen computer to print screen. What should I do?
You have to scale you graph. You know, Earth is very big but it fits map that can be shown on a screen of your smart phone :)
This means that if for example you want to show rectangle of 10000*10000 on screen that has (for example) 1000 pixels you have to scale your picture 10 times.
Option 1: Set the size of the JFrame on which you are displaying the graph to the desired size.
setSize(WIDTH, HEIGHT);
where WIDTH and HEIGHT are in pixels.
OR
Option 2: Scale the drawing. That is, simply divide each dimension in the drawing by 2 to make it half the size.
I need to crop images for a "Photoprint" app of mine. To create appropriate image for printing paper, image will be scaled up, scaled down and cropped by dragging to specific field of image in a frame. Only short edge or long edge of the image could have empty space, two edges shouldn't have empty spaces at the same time. Any of height or width should fit the crop frame. By the way, crop frame should stay the same size. For example; for a 5x7" printing paper, frame will have 504x306px size.
Could you help me, image crop algorithm?
I have a java game that I have made, is it a Canvas in a JFrame to run as an application and an applet.
When running as an applet, I want it so that when the user resizes the window, the game scales to fit the new size window.
Is there anyway of resizing the canvas and all the images or shapes that I have drawn on it to fit the new size window, or do I have to go though and change the code on all my objects and the positions they draw?
Any help would be very useful :)
You would have to add scaling to your painting. A transformation applied to your graphics might be the easiest way. You would determine the current size of the Canvas and scale based on the standard size.