libgdx

Calculating frustum FOV for a PerspectiveCamera

点点圈 提交于 2019-12-19 10:16:57
问题 I currently have a screen consisting of two areas: (Values are just assumed for this particular example and may of course vary depending on screen). The screen in total is 1080x1432px (WxH) and consists of two areas, each clipped using glViewPort . This because I want area (1) not to fill the screen when zooming. Game area. Can be zoomed. The size is 1080x1277px (WxH) and located at the top. The HUD (FYI objects from here can be moved to area (1). Non zoomable. The size is 1080x154 (WxH).

Libgdx box2d body moves slow

折月煮酒 提交于 2019-12-19 09:30:34
问题 This is a very simple scene with box2d. I tried different viewports and different screen sizes. I could not figure out why the body drops very slow. Actually, I am not quite sure that it is slow, the reason is maybe the viewport settings etc. This is main class: public class Main extends Game { LevelScreen levelScreen; @Override public void create () { levelScreen = new LevelScreen(); setScreen(levelScreen); } @Override public void render () { super.render(); } } And level screen: public

LibGDX Moving a Rotated Camera

£可爱£侵袭症+ 提交于 2019-12-19 09:07:17
问题 I've come to a situation in my application, built using LibGDX, where I need the camera to be able to rotate, and also be moveable by the user, as well as being able to be zoomed. My camera controls for moving and zooming the camera work beautifully, however, when the camera is rotated, the camera is then moved based on that rotation. For example, if the camera is turned 45 degrees to the left, and the user drags to the right to move the camera, it will move towards the upper right, because

Mouse hover - libgdx

删除回忆录丶 提交于 2019-12-19 08:26:12
问题 Is there any listener in libgdx that would allow me to detect just mouse hover not pressed just hover. In the button class of scene 2D you have 2 methods isOver and isPressed but they do the same thing ... Anyone else having this problem? Is there another way to detect mouse hover over actor? 回答1: There's the ClickListener which can be attached to an Actor and it offers events like the following ones: public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) public

Making a Group hide Actors outside of its bounds

偶尔善良 提交于 2019-12-19 07:39:21
问题 I have created a very simple plot that is dynamically updated by adding new images on the right side of the screen, and then making them move towards the left side. This way, the plot within the screen's bounds looks like they are plotted as time goes by. Unfortunately, when doing it this way, I have to let the images start outside of the screen, and move into view, and I can't remove them again before they are completely outside of the screen on the left side. This results in the images

How to draw a BitmapFont in LibGDX?

痞子三分冷 提交于 2019-12-19 05:24:00
问题 I'm seriously betting that I did something effing stupid and just can't seem to notice it. package com.me.mygdxgame; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic

Example of Director, Stage, Group, Actor, Box2D and GestureDector LibGdx

杀马特。学长 韩版系。学妹 提交于 2019-12-19 04:42:08
问题 Im curious to know, cant seem to find on Google or Wiki and solid examples so my quest is to drum up a decent example..using Director, Stage, Group, Actor, Box2D and GestureDector in LibGdx. (Using Textures, Images, TextureRegions etc) Would any genius out there have any reference material - example source code so I can learn. I've looked at dozens of sites, wiki, blogs etc and need some guidance. 回答1: http://code.google.com/p/codejie - this was down and finally found it online again.... 回答2:

(Libgdx 1.6.1) BitmapFontCache.draw crashing due to index out of bounds

烈酒焚心 提交于 2019-12-18 17:34:23
问题 I just recently updated my Libgdx project from 1.4.x to 1.6.1. I use BitmapFontCache for my dialogue in my game, drawing a string character by character using BitmapFontCache.draw(start, end). This was working fine in 1.4.x but after making the necessary changes to get 1.6.1 to build, it seems to cause a crash when wrapping is enabled after the last character is displayed. Strangely this does not seem to be a problem with one line strings. Here is how I add my text: fontCache.addText( message

Using SQLite from libGDX on Android

社会主义新天地 提交于 2019-12-18 15:01:03
问题 Does anyone have any tips on storing data from libGDX on Android in SQLite. I am very familiar with the techniques used in the Android SDK but I don't have any idea how to call those Android database functions from libGDX. I know that calling the functions from libGDX will make my game unusable on the desktop but I can deal with that. 回答1: One approach is always to create an interface in your main project, let's call it NativeFunctions . You then let both your desktop and your Android

Putting Freetypefont into libgdx skin

大憨熊 提交于 2019-12-18 14:48:21
问题 In my uiskin.json I have this com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: text/default.fnt } } This is fine for when I have the default.fnt in my text folder in the assets folder... However I want to use a Freetypefont. How do I create a Freetypefont and load it into the uiskin file? 回答1: It is not possible to do it beforehand, since you are going to generate it at runtime. My workaround would be to keep the default font as it is and replace it at runtime via code. You