I'm working on an android project in LibGDX which I mainly test using the DesktopLauncher. I have some UI, set using Scene2d elements. They look great on Desktop, but really off using an emulated nexus 7. How can I make them scale correctly and have the same position as on Desktop?
Thing is, I've set a button , for example, to have position x=300, y=200. While this looks good on Desktop, it differs on mobile. How can I scale them in such a way that the positions are the same, no matter the resolution?
I've found online about viewports, but they didn't help.
I have managed to find an answer. For all those who might have this issue in the future, I solved the problem using this guide
https://github.com/libgdx/libgdx/wiki/Viewports
On top of that, what fixed my issue was setting
viewport.apply(true);
The parameter centers the camera, that solved my issue.
Related
Why my text inside the android design viewer appears blurry. I tried changing the resolution DPI setting as well. But it didn't work for me.
Please look at my second picture, to let you know which one is I am talking about.
Try changing the scaling to 100% instead to 125%. Normally in Windows 10 default scale in 125% recommended. But using 100% will fix this.
To Find Scaling Setting:
Right Click on the desktop
Navigate to Display Setting
Dont Forget to go advanced scaling setting
And
Turn on the Fixed Scaling for the apps
Just incase sometimes
Before:
After:
How about changing device settings?
It just change the resolution of example device and it would make more clear sight from design view. It doesn't change the layout codes.
It would help the development with clear visual, but you have to test various resolutions of devices if you needed to.
Go to 'Help' tab and click on 'Edit Custom Properties'. It might ask you to generate a file if it doesn't already exist. Once this properties file was made, I wrote 'hidpi=false' (no quotations) on a new line, saved it, and restarted Android Studio.
Happy New Year,
I am developing my application by following This tutorial (using LibGdx, extents Game, with AbstractScreen, using Stage). However, currently I am experiencing a very funny issue. Everything display correct on my Samsung phone but not on my ASUS Nexus 7. Please see this link for the recorded video (MP4: ~800kb) of both devices. As you can see from the Samsung phone, you can see the “Fullmoon Inc.” splash screen (~25 secs). However, my nexus 7 display nothing at all even though I am sure that my application is running on my nexus 7 (sound played on certain timeframe). I tried to update my nexus 7, reset back to factory default, run on empty profile, still no luck at all. I am absolutely no idea what to do to fix it.
Another thing is that the loading bar on the loading screen (from 5secs – 23secs) is not display correctly. According to the following code, the loading bar (the yellow windows) should load in a smooth manner. However, as per what you can see on the video, it is not. Currently the bar only display "After" everything is loaded. Can anyone please lead me back to the correct path?
loadingPercent = Interpolation.linear.apply(loadingPercent, thisApps.assetManager.getProgress(), 0.1f);
this.loadingYellowBox.setWidth(-1040 + (int) (loadingPercent * 1040));
Thank you very much, and all comments are welcome.
I can answer the second part of question. AssetManager calculates percent based om number of asssets not on their size. Suppose you have huge texture atlas which is packed in one texture and several other small resources. Loading of the atlas takes 9 seconds and there are 4 other small resource which take 1 second to load.
So, see what happens. You have 20%-20%-20%-20%-20% when you expect 90%-10&.
If you want to more precise percentage you need to calculate percentage some other way.
Blank screen glitch is trickier. You need to check that Stage is properly initialized, aspect ratio is correct, resources are loaded correctly. You can download source code for libgdx, add it to your project and go through render method with debugger. If you find something suspicious there you can update this post or create a new one.
i finally figured out where the problem came from. the issue is that when i pack all my images, i set the Max page width and Max page height to 4086. i am guessing that somehow Nexus did not "really" load those images. problem solved when i reduced both Max page width and Max page height to 2048. anyway, i still appreciated helps from both #noone and #son-of-the-northern-darkness
we have got a requirement in our ongoing project where we need to show menu items in arc style at both upper space and lower space of the screen in reverse direction(will show you samples). i've tried to use some of the code from the demo of ArcMenu used in Path android application, but what i came up with is this:
This is not what i want to achieve but something like menus in following images.
I am trying to achieve this from last 4 to 5 days but not getting it right. if any one out there has done any research on such problem then please guide me.
any help would be greatly appreciated.
Make ListView in Circular
Follow this its working code. Code is provided by Samsung
may be it will workfor your issues
http://developer.samsung.com/android/samples/Circle-Launcher
That's quite a complicated task, especially since you want it to scroll while respecting its arc shape. There are probably no fixed answers for this, you'll have to manually create this type of interaction. Unless you have specific code examples of what you've tried and failed at, I don't think anyone can really help you here. Besides the technical difficulty, you could wonder if it is really a smart idea to have THAT many options in an already pretty unclear/overwhelming widget, that you can scroll to even more options. Maybe some design re-thinking is a better option.
Some examples though which could you get on the way would be here;
https://stackoverflow.com/questions/12072692/a-circular-layout-with-scrollable-contents-in-it
I have an Windows Phone 8 app made with PhoneGap framework to show a map of OpenLayers. Sometimes, although very rarely, I surf between views (jQuery Mobile is used) and suddenly when I am back on Map it shows an extra tile on the center of map. Tile is as wide as the map and starts some 20% before top and ends some 20% from bottom. It does disappear only when restarting the app.
I am trying to show up the phenomenon on dev mode of Google on browser, but so far no success.
No error is shown on console of wp8 sdk, I was testing it on device connected to visual studio.
What may cause that thing and could it be fixed somehow?
edit1: It may be possible I trigger a swipe event while moving the screen fast and that may make the Openlayers in error state.
First try:
I added this line:
-ms-scroll-chaining: chained;
to the div containing the map.
I used jQuery / HTML5 / gwt app for WP8 (Lumia 920) device: vertical css scroll fix to attach another things to same place, so I added it there.
UPDATE
This was not the fix, problem stayed. See below the correct answer:
The real answer:
https://github.com/openlayers/openlayers/issues/929 tells this is known issue of openlayers, that is already fixed in the latest version.
So, please update version of OpenLayers!
We have a problem in our swing based application since we've upgraded our java version from 6u5 to 6u18 (The application runs over WinXP).
Our application contains a Canvas object which resides in a JFrame. The application draws things on the canvas.
Every time we drag a lightweight swing object (popup or another frame) over the canvas, it has a refresh problem.
It blinks - becomes black. The problem only resolves after we move the swing component away from the canvas and click on it again.
We think this problem is related to the fact the the canvas is a heavyweight object.
And we know there were changes done in the new versions of java on the mixing of heavyweight and lightweight objects issue.
Some more details:
1) Our problem reproduces in java 6u14 and 6u16.
2) Everything works fine in java 6u5.
Another strange thing:
We have 2 types of stations running our application.
The first type has a ATI FireGL7100 PCI-E graphics card. The second type has a Matrox G450 PCI graphic card.
The problem does not reproduce on the Matrox based station in any java version.
One more thing:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6829858 - looks similar to our problem.
Is our problem familiar?
Do you have any suggestions (workarounds, ideas how the difference in graphics cards is connected to this problem)
Hope I was clear enough,
Yoav
The article Mixing heavy and light components describes how support for this changed in JDK 6 update 12. The two video cards may handle Z-order differently. Any chance your code has a workaround that's no longer needed?
We had problems w/ HW/LW mixing from 6u14+ (the fixes that breaks everything is in 14). Our problem was in a thirdy part library (JIDE) and they ended up fixing the problem on their end.
My suggestion is avoid HW where ever you can. You can get very decent performance out of LW if done correclty. What are you drawing that needs to be HW?
I don't know if this is relevant to anyone else, but we've found a workaround/fix for our problem.
We've set the system properties sun.awt.noerasebackground and sun.java2d.noddraw both to true. That eliminated our issue.
The only problem is that I'm not sure what other problems might rise from setting those system properties.