libgdx

LibGDX FrameBuffer

一世执手 提交于 2020-04-10 08:32:30
问题 I'm trying to make a game where you build a spaceship from parts, and fly it around and such. I would like to create the ship from a series of components (from a TextureAtlas for instance). I'd like to draw the ship from it's component textures, and then save the drawn ship as one large Texture. (So i don't have to draw 50 component textures, just one ship texture. What would be the best way to go about this? I've been trying to do so using a FrameBuffer. I've been able to draw the components

Purpose of Virtual width/height in libgdx java

你。 提交于 2020-03-06 09:32:49
问题 I watched a video by a guy I think is very good with game development, ForeignGuyMike and in his tutorials he uses a virtual width and height and scales it by 2. Here is a screen shot of the code. I am starting a brand new game and want to know if there is some type of purpose to this. I want to know the pros and cons of this because I can't seem to find where he explains why and where on the internet someone does this. He then multiplies the virtual width and height by the scale for the size

LibGDX - Multitouch handling using InputProcessor

喜欢而已 提交于 2020-03-06 03:08:50
问题 I am trying to set up proper multitouch support in my android game for some time. For input handling I use my InputHandler(implementing InputProcessor). I use something like this @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); screen.renderer.cam.unproject(touchPos); if (left.isTouchDown((int) touchPos.x, (int) touchPos.y)) { player.setMovingLeft(true); player.leftPressed(); } and

possible lossy conversion from double to float [duplicate]

我们两清 提交于 2020-03-04 05:29:54
问题 This question already has an answer here : What does “possible lossy conversion” mean and how do I fix it? (1 answer) Closed 2 years ago . i am trying to get to divide and i keep getting this error ? gradle error; incompatible types; possible lossy conversion from double to float? protected World world; protected TiledMap map; protected TiledMapTile tile; protected Rectangle bounds; protected Body body; public InteractiveTileObject(World world, TiledMap map, Rectangle bounds ){ this.world =

possible lossy conversion from double to float [duplicate]

江枫思渺然 提交于 2020-03-04 05:28:47
问题 This question already has an answer here : What does “possible lossy conversion” mean and how do I fix it? (1 answer) Closed 2 years ago . i am trying to get to divide and i keep getting this error ? gradle error; incompatible types; possible lossy conversion from double to float? protected World world; protected TiledMap map; protected TiledMapTile tile; protected Rectangle bounds; protected Body body; public InteractiveTileObject(World world, TiledMap map, Rectangle bounds ){ this.world =

How to awake screen while game play in libgdx?

南笙酒味 提交于 2020-02-28 13:38:07
问题 I am creating an game using accelerometer in libgdx and while playing the game, it sleeps after some, i need awake this untill game-play. i got this in some forums getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); which work for android app,but don't how to do that in libgdx, it is unrecognizable by compiler.any help will be appreciated. 回答1: Best and easiest way to do that is Go to the android folder of your project in android studio then locate AndroidLauncher.java in

Normal mapping GLSL using LibGDX

一世执手 提交于 2020-02-23 09:30:47
问题 I try to implement normal mapping using LibGDX. So I got some positive results when I calculate diffuse and specular color in vertex shader (at least I think so). Vertex shader: attribute vec4 a_position; attribute vec2 a_texCoord0; attribute vec3 a_normal; varying vec2 v_texCoord; varying float v_diffuse; varying vec3 v_specular; varying vec3 v_lightVec; uniform mat4 u_worldTrans; uniform mat4 u_projTrans; uniform mat4 u_matViewInverseTranspose; uniform mat4 u_matModelView; const vec3

libgdx 学习笔记二 绘制图像

我们两清 提交于 2020-02-22 07:27:54
本章内容 概述了如何绘制图像的使用和libgdx如何简化并通过sprite batch类优化了任务。 Drawing images(绘制图像) 一张从它最初的格式(eg,PNG)被解码然后上传到图形处理器的图片被叫做纹理。绘制纹理,几何图形和纹理是通过指定每个几何图形的顶点来描述和应用实施的,这个顶点是与几何图形的纹理相一致的。。例如几何图形是一个矩形,然后应用纹理以便每个矩形的角落和纹理的角落相一致 在实际绘图中,首先纹理是有边界的,那么几何图形用OpenGL来绘制。由2者确认纹理在屏幕上位置尺寸和位置,一个是几何图形 另一个是如何配置 OpenGL viewport 。 许多2D游戏配置viewport来匹配屏幕分辨率。意思是几何图形由像素指定,在屏幕适当的尺寸和位置中使它容易绘制纹理。 绘制纹理映射到矩形这是很常见的。多次绘制同一个纹理或者纹理的不同部位也是很常见的。每次发送一个矩形到图形处理器来绘制这将是没有效率的 。对于被声明的纹理可以同时发送许多矩形到图形处理器。这就是SpriteBatch类做的事 SpriteBatch为每个矩形的绘制给出一个纹理坐标。它把没有提交给图形处理器的几何图形聚集到一起。如果和上一个纹理不同,那么它绑定上一个纹理,一起提交把几何图形聚集到一起绘制 ,然后开始为新的纹理来聚集几何图形。

What is a Delta time in LIBGDX

南楼画角 提交于 2020-02-20 07:59:45
问题 What is a Delta time in LIBGDX? I read many posts regarding that. To my knowledge, Delta time is, The time gap between previous and current frame delta time will add upto 1 since its the computation of x frames per second ie.(1/x of the frames) To make the speed constant for the game we use dt If we say 60 *dt then it will move 60 frames per second, no matter what the speed of the mobile(for instance) is. So, this is what I know about delta time but I am not getting a clear view about it

What is a Delta time in LIBGDX

北慕城南 提交于 2020-02-20 07:59:08
问题 What is a Delta time in LIBGDX? I read many posts regarding that. To my knowledge, Delta time is, The time gap between previous and current frame delta time will add upto 1 since its the computation of x frames per second ie.(1/x of the frames) To make the speed constant for the game we use dt If we say 60 *dt then it will move 60 frames per second, no matter what the speed of the mobile(for instance) is. So, this is what I know about delta time but I am not getting a clear view about it