libgdx

Java LibGDX BitmapFont setScale method not working

醉酒当歌 提交于 2019-12-03 04:22:59
I am currently trying to scale a font but I am receiving the error "the method setScale(float, float) is undefined for the type BitmapFont" This is the code section where I am getting the error, specifically in lines 2 and 4. font = new BitmapFont(Gdx.files.internal("text.fnt")); font.setScale (.25f, -.25f); shadow = new BitmapFont(Gdx.files.internal("shadow.fnt")); shadow.setScale (.25f -.25f); I created the variables here public static BitmapFont font; public static BitmapFont shadow; When I check other examples of using the setScale function, this seems to be the format used. Any ideas as

How to add libgdx as a sub view in android

廉价感情. 提交于 2019-12-03 04:22:20
问题 I have main.xml as follows: <RelativeLayout> ... <FrameLayout android:id="@+id/panel_sheet" android:layout_width="match_parent" android:layout_height="match_parent"> <com.libgdx.Sheet3DViewGdx android:id="@+id/m3D" android:layout_width="1000dp" android:layout_height="600dp" /> </FrameLayout> ... </RelativeLayout> And my main activity class is as follows: public class Test extends Activity { MainActivity m3DActivity; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto

libgdx difference between sprite and actor

依然范特西╮ 提交于 2019-12-03 04:10:13
问题 I'm just going through the javadoc and various tutorials on libgdx and I'm at the stage of trying to figure out differences between various concepts that seem similar to me or provide similar capabilities in libgdx. At first I thought scene2d was about creating interactive items such as menus, etc but various tutorials I'm reading use scene2d/actors for the main game items (i.e. the player, etc) and others just use sprites. What exactly is the difference between using Sprite and Actor (i.e.

Using a SQLite database in Libgdx

前提是你 提交于 2019-12-03 03:12:11
问题 I'm new in Libgdx and I'm getting trouble on using a database on my game. I searched for a tutorial on how to make SQLite work on both Android and Desktop applications using Libgdx but I didn't found a easy one. The last time I used a database in Android, I created a class that extends from SQLiteOpenHelper . Is there a simple way to do the same using Libgdx? Or at least, can anyone point me to a step-by-step tutorial or something similar? EDIT I forgot to say that I'm looking for something

libGDX Google Play Game Services - Android

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to implement Google play Game Services into libGDX project. In my android project, the MainActivity looks like this: public class MainActivity extends AndroidApplication implements GameHelper.GameHelperListener, ActionResolver { GameHelper gameHelper; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gameHelper = new GameHelper(this, GameHelper.CLIENT_ALL); gameHelper.enableDebugLog(true); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setRequestedOrientation

Java/libGDX - how to check Polygon collision with Rectangle or Circle

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to libGDX and from what I can tell the Intersector class has overlap methods for Rectangle/Rectangle, Circle/Circle, Circle/Rectangle, and Polygon/Polygon, but for some reason it doesn't seem to have any methods for checking Polygon/Rectangle or Polygon/Circle. Is there a recommended way to check for collision between polygon and rect/circle? Also, is there some reason why this has been left out of the Intersector class? (ie, should I avoid it? If so, what's the recommended alternative?) 回答1: The best way to handle those collisions

Libgdx pause/resume not called when window is being dragged (Windows)

匿名 (未验证) 提交于 2019-12-03 03:09:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am creating a Java game with libgdx. Really liking the engine so far but I noticed an issue when dragging the game window. Rendering seems to stop (which is okay) but I cant find any events that get called during this state. Is there any way I can trap it? It not a big deal for rendering as I cap the deltaTime, but for input the keyUp events don't get fired which messes up my movement code for the player (if you are to release the keys while dragging the window). Is there anything I can do? Thanks! 回答1: The problem you describe

Is there a way for push notifications in libGDX (Android and iOS projects)?

谁说我不能喝 提交于 2019-12-03 03:07:38
Does someone knows if it is possible to add push notifications(like Amazon Simple Notification Service) in an Android and iOS with RoboVM libGDX projects? And if it is possible, are there any good tutorials or good hints how to implement such things? I would be happy about every hint how I can implement it. Hi I know this is an old question but I was struggling to find a solution for this specially for iOS, but I finally found a way. If the explanation below is confusing and you prefer to see an example here is a github repo with a sample project: Repo GitHub I only show the code for iOS see

libgdx draw chinese characters

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I like to print Chinese text in my application. 1.When I try this, the screen will be empty. There is no error at the console. Create method: FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal("fonts/DFLS1B.TTF")); font = gen.generateFont(40, "好", false); Render method: spriteBatch.setColor(1, 1, 1, 1); spriteBatch.begin(); font.draw(spriteBatch, "好", 10, 100); spriteBatch.end(); 2.When I try this, 3 different Chinese characters show up on screen but I have no idea why these characters where draw. There is no connection

Libgdx game crashes on Android

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I made a game using libgdx and it runs fine on both desktop and android before. I'm not sure if its because I started using box2d physics engine and liquidfun particles,what basically happens is that when I click play on my game it start loading then after loading it should go to the gameScreen, but it crashes then says "Unfortunately, myGame has stopped". error message: E / AndroidRuntime : FATAL EXCEPTION : GLThread 3764 Process : com . nivekbryan . puffypuff , PID : 8416 java . lang . NoClassDefFoundError : Failed resolution of