libgdx

How do I make TextButtons using LibGDX?

强颜欢笑 提交于 2019-12-01 02:04:00
I've followed a few tutorials on youtube to make buttons for my libgdx game and have run into a problem where my button.pack cannot be loaded. stage = new Stage(); black = new BitmapFont(Gdx.files.internal("font/black.fnt")); white = new BitmapFont(Gdx.files.internal("font/white.fnt")); atlas = new TextureAtlas(Gdx.files.internal("buttons/button.pack")); skin = new Skin(atlas); table = new Table(skin); table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); TextButtonStyle textButtonStyle = new TextButtonStyle(); textButtonStyle.up = skin.getDrawable("buttons/buttonup.png");

Libgdx ModelBuilder.createRect only visible from one side

て烟熏妆下的殇ゞ 提交于 2019-12-01 01:46:05
In my first libgdx 3D game i now switched from createBox to createRect , to create only the visible faces (if a wall is on the left side of another wall, its right face is not visible...). I am creating 4 models: frontFace backFace rightFace leftFace They are almost drawn how they actually should. But there is one big issue: The side faces are only visible if i look in the positive z-Direction . If i look the other side (negative z-Direction ), they don't draw. The front and back faces only draw, if i look to them in negative x-Direction . Has this something to do with the normals? I have set

libGDX: How can I crop Texture as a circle

天大地大妈咪最大 提交于 2019-12-01 01:45:28
I achieved my goal with android development as shown in this link Cropping circular area from bitmap in Android but how can I achieve that with libGDX framework? I tried to do it with Pixmap but not succeeded with me. Anyone can Help me to achieve that. I don't know if there's an easier way, but I made a method for working with masks and combining the mask with the original pixmap into a resulting pixmap. public void pixmapMask(Pixmap pixmap, Pixmap mask, Pixmap result, boolean invertMaskAlpha){ int pixmapWidth = pixmap.getWidth(); int pixmapHeight = pixmap.getHeight(); Color pixelColor = new

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

送分小仙女□ 提交于 2019-12-01 01:39:38
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. http://code.google.com/p/codejie - this was down and finally found it online again.... I have an example of Scene2D elements with Box2d here: http://www.netthreads.co.uk/2012/04/23/libgdx-box2d

IntelliJ can't find any LibGDX packages?

那年仲夏 提交于 2019-12-01 01:33:50
I have just switched to Ubuntu and I've installed IntelliJ IDEA 14 Community Edition. When I imported my existing project, I found that IntelliJ can't seem to find any of the LibGDX dependencies. I installed Gradle beforehand. I've tried using the Gradle wrapper included with the IntelliJ project to and saying ./gradlew --refresh-dependencies , but this doesn't seem to do much of anything. My external TweenEngine packages were loaded just fine. It seems to only be with the LibGDX packages that IntelliJ is having a problem with. I do not wish to have IntelliJ see my project as a Gradle Project,

Difference between DEVICE_ID_EMULATOR and TEST_EMULATOR when testing Admob on mobile phone

折月煮酒 提交于 2019-12-01 01:04:24
What is the difference between using TEST_EMULATOR and DEVICE_ID_EMULATOR? I want to test the admob ad system on my mobile phones, NOT on an emulator on the PC. AdRequest ad = new AdRequest.Builder(). .addTestDevice(com.google.ads.AdRequest.TEST_EMULATOR). .addTestDevice("YOUR_HASHED_DEVICE_ID"). .build(); AdRequest ad = new AdRequest.Builder(). .addTestDevice(com.google.ads.AdRequest.DEVICE_ID_EMULATOR). .addTestDevice("YOUR_HASHED_DEVICE_ID"). .build(); The difference is that com.google.ads.AdRequest.TEST_EMULATOR refers to the old legacy admob and com.google.android.gms.ads.AdRequest.DEVICE

LibGDX - Custom Click Listener?

限于喜欢 提交于 2019-12-01 00:36:24
I want to make my own Button class, that will have a Sprite, and whenever i touch it it will grow or rotate, etc, the class will have also a Draw and Update function. To check if I touch it i can check if the sprite rectangle contains the position of the touch in the touchdown and touchup method of the screen class. I don't want to do that, i want to make something like android button click listener, is that possible? Something like myCoolButton.setOnClickListener(new CoolButtonClassClickListener( public void OnTouchDown() { } public void OnTouchUp() { } }); Is possible? Of course you can,

Unable to parse template “Class” Error whenever I try to open a new java class [closed]

走远了吗. 提交于 2019-12-01 00:33:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I'm doing an Android Studio project (from this tutorial here: http://www.kilobolt.com/day-2-setting-up-libgdx.html). When I press New Java Class I'm getting the error that's described in the title: Unable to parse template "Class" Error message: This template did not produce a Java class or an interface. I don't

Background transparency in libgdx

♀尐吖头ヾ 提交于 2019-11-30 23:38:36
How can I make background of screen transparent if I use libgdx in Android? The code I tried to use doesn't work. Gdx.gl.glClearColor( 0, 0, 0, 0 ); Gdx.gl.glClear( GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT ); Just found a solution! Just add this code to the class that extends AndroidApplication. AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.r = cfg.g = cfg.b = cfg.a = 8; cfg.useGL20 = false; View view = initializeForView(new LineDrawing(), cfg); if (graphics.getView() instanceof SurfaceView) { SurfaceView glView = (SurfaceView) graphics.getView();

Admob ads appear only after first refresh

一个人想着一个人 提交于 2019-11-30 22:58:04
i added banner ads from admob to my game and the banner add appears only after the first refresh (30 seconds) . And for the first 30 seconds it's there and if you click the bottom of the page where the addvertisment should be it takes you to the advertising page but the ad is not visible. You can see for yourself when you start the game and click bottom of the screen. Game #1 And my other game (if you start the intent from the menu in this game ( like facebook) and then return to the menu, ads appear instantly): Game #2 Anyone had this happen ? What can i do to fix this ? How I initialize my