当前位置: 首页 > news >正文

工作女郎老板亲自测试新产品烟台seo

工作女郎老板亲自测试新产品,烟台seo,公司网站续费一年多少钱,视频号分销解决方案的特点1 前言 libGDX 是一个开源且跨平台的 Java 游戏开发框架,于 2010 年 3 月 11 日推出 0.1 版本,它通过 OpenGL ES 2.0/3.0 渲染图像,支持 Windows、Linux、macOS、Android、iOS、Web 等平台,提供了统一的 API,用户只需要…

1 前言

        libGDX 是一个开源且跨平台的 Java 游戏开发框架,于 2010 年 3 月 11 日推出 0.1 版本,它通过 OpenGL ES 2.0/3.0 渲染图像,支持 Windows、Linux、macOS、Android、iOS、Web 等平台,提供了统一的 API,用户只需要写一套代码就可以在多个平台上运行,官方介绍见 → Features。

        libGDX 相关链接如下:

  • libGDX 官网:https://libgdx.com
  • libGDX 官方文档:https://libgdx.com/dev
  • libGDX 启动简介:https://libgdx.com/wiki/start/setup
  • libGDX 工具下载:https://libgdx.com/dev/tools
  • libGDX GitHub:https://github.com/libgdx/libgdx

2 libGDX 环境搭建

        1)下载 gdx-setup

        官方下载链接:gdx-setup.jar,如果网速较慢,用户也可以从这里下载:libGDX全套工具包。

        2)生成项目

        双击 gdx-setup.jar 文件,填写 Project name、Package name、Game Class、Output folder、Android SDK、Supported Platforms 等信息,点击 Generate 生成项目。官方介绍见 → Generate a Project。

        注意:JDK 最低版为 11,见官方说明 → Set Up a Dev Environment。

        3)打开项目

        使用 Android Studio 打开生成的 Drop 项目,等待自动下载依赖,项目结构如下。

        注意:如果选择了 Android 启动,需要在 gradle.properties 文件中添加 AndroidX 支持,如下。

android.useAndroidX=true

        DesktopLauncher.java

package com.zhyan8.drop;import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;public class DesktopLauncher {public static void main (String[] arg) {Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();config.setForegroundFPS(60);config.setTitle("Drop");new Lwjgl3Application(new Drop(), config);}
}

        AndroidLauncher.java

package com.zhyan8.drop;import android.os.Bundle;import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;public class AndroidLauncher extends AndroidApplication {@Overrideprotected void onCreate (Bundle savedInstanceState) {super.onCreate(savedInstanceState);AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();initialize(new Drop(), config);}
}

        Drop.java

package com.zhyan8.drop;import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;public class Drop extends ApplicationAdapter {SpriteBatch batch;Texture img;@Overridepublic void create () {batch = new SpriteBatch();img = new Texture("badlogic.jpg");}@Overridepublic void render () {ScreenUtils.clear(1, 0, 0, 1);batch.begin();batch.draw(img, 0, 0);batch.end();}@Overridepublic void dispose () {batch.dispose();img.dispose();}
}

        4)运行项目(点击操作)

        Desktop:

        Android:

        运行效果如下。

        5)运行项目(通过命令)

        可以通过在 Terminal 中运行以下命令来运行项目,见官方介绍 → Importing & Running。

        Desktop:

./gradlew desktop:run

        Android:

./gradlew android:installDebug android:run

        iOS:

./gradlew ios:launchIPhoneSimulator

        HTML:

./gradlew html:superDev

3 libGDX 官方案例

        官方接水游戏见 → A Simple Game。

        在第二节的基础上,修改 Drop.java,如下。

        Drop.java

package com.zhyan8.drop;import java.util.Iterator;import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.TimeUtils;public class Drop extends ApplicationAdapter {private Texture dropImage;private Texture bucketImage;private Sound dropSound;private Music rainMusic;private SpriteBatch batch;private OrthographicCamera camera;private Rectangle bucket;private Array<Rectangle> raindrops;private long lastDropTime;@Overridepublic void create() {// load the images for the droplet and the bucket, 64x64 pixels eachdropImage = new Texture(Gdx.files.internal("droplet.png"));bucketImage = new Texture(Gdx.files.internal("bucket.png"));// load the drop sound effect and the rain background "music"dropSound = Gdx.audio.newSound(Gdx.files.internal("drop.mp3"));rainMusic = Gdx.audio.newMusic(Gdx.files.internal("rain.mp3"));// start the playback of the background music immediatelyrainMusic.setLooping(true);rainMusic.play();// create the camera and the SpriteBatchcamera = new OrthographicCamera();camera.setToOrtho(false, 800, 480);batch = new SpriteBatch();// create a Rectangle to logically represent the bucketbucket = new Rectangle();bucket.x = 800 / 2 - 64 / 2; // center the bucket horizontallybucket.y = 20; // bottom left corner of the bucket is 20 pixels above the bottom screen edgebucket.width = 64;bucket.height = 64;// create the raindrops array and spawn the first raindropraindrops = new Array<Rectangle>();spawnRaindrop();}private void spawnRaindrop() {Rectangle raindrop = new Rectangle();raindrop.x = MathUtils.random(0, 800-64);raindrop.y = 480;raindrop.width = 64;raindrop.height = 64;raindrops.add(raindrop);lastDropTime = TimeUtils.nanoTime();}@Overridepublic void render() {// clear the screen with a dark blue color. The// arguments to clear are the red, green// blue and alpha component in the range [0,1]// of the color to be used to clear the screen.ScreenUtils.clear(0, 0, 0.2f, 1);// tell the camera to update its matrices.camera.update();// tell the SpriteBatch to render in the// coordinate system specified by the camera.batch.setProjectionMatrix(camera.combined);// begin a new batch and draw the bucket and// all dropsbatch.begin();batch.draw(bucketImage, bucket.x, bucket.y);for(Rectangle raindrop: raindrops) {batch.draw(dropImage, raindrop.x, raindrop.y);}batch.end();// process user inputif(Gdx.input.isTouched()) {Vector3 touchPos = new Vector3();touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);camera.unproject(touchPos);bucket.x = touchPos.x - 64 / 2;}if(Gdx.input.isKeyPressed(Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();if(Gdx.input.isKeyPressed(Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();// make sure the bucket stays within the screen boundsif(bucket.x < 0) bucket.x = 0;if(bucket.x > 800 - 64) bucket.x = 800 - 64;// check if we need to create a new raindropif(TimeUtils.nanoTime() - lastDropTime > 1000000000) spawnRaindrop();// move the raindrops, remove any that are beneath the bottom edge of// the screen or that hit the bucket. In the latter case we play back// a sound effect as well.for (Iterator<Rectangle> iter = raindrops.iterator(); iter.hasNext(); ) {Rectangle raindrop = iter.next();raindrop.y -= 200 * Gdx.graphics.getDeltaTime();if(raindrop.y + 64 < 0) iter.remove();if(raindrop.overlaps(bucket)) {dropSound.play();iter.remove();}}}@Overridepublic void dispose() {// dispose of all the native resourcesdropImage.dispose();bucketImage.dispose();dropSound.dispose();rainMusic.dispose();batch.dispose();}
}

        音频和图片资源放在 assets 目录下面,如下。

        Desktop 运行效果如下:

        Android 运行效果如下:


文章转载自:
http://ephemeralization.pqbz.cn
http://funiculate.pqbz.cn
http://albedo.pqbz.cn
http://coir.pqbz.cn
http://cos.pqbz.cn
http://carpenter.pqbz.cn
http://lithotomy.pqbz.cn
http://ganggang.pqbz.cn
http://blare.pqbz.cn
http://ptyalin.pqbz.cn
http://reenforcement.pqbz.cn
http://predominate.pqbz.cn
http://unlock.pqbz.cn
http://manteau.pqbz.cn
http://homophonic.pqbz.cn
http://comanchean.pqbz.cn
http://geometrid.pqbz.cn
http://psychopharmaceutical.pqbz.cn
http://plaster.pqbz.cn
http://trotter.pqbz.cn
http://eyas.pqbz.cn
http://bibliokleptomania.pqbz.cn
http://cognoscible.pqbz.cn
http://doomsday.pqbz.cn
http://subdeb.pqbz.cn
http://initialize.pqbz.cn
http://styli.pqbz.cn
http://grouch.pqbz.cn
http://ropedancer.pqbz.cn
http://dysmelia.pqbz.cn
http://honoraria.pqbz.cn
http://kyongsong.pqbz.cn
http://sdram.pqbz.cn
http://raggee.pqbz.cn
http://tenent.pqbz.cn
http://paroxysmal.pqbz.cn
http://pavulon.pqbz.cn
http://humate.pqbz.cn
http://preoral.pqbz.cn
http://theirs.pqbz.cn
http://chiropody.pqbz.cn
http://ssid.pqbz.cn
http://pharmacal.pqbz.cn
http://bonanzagram.pqbz.cn
http://diakinesis.pqbz.cn
http://context.pqbz.cn
http://irrotational.pqbz.cn
http://trueborn.pqbz.cn
http://hormic.pqbz.cn
http://coontie.pqbz.cn
http://jetted.pqbz.cn
http://luminosity.pqbz.cn
http://exfacto.pqbz.cn
http://bhn.pqbz.cn
http://stackup.pqbz.cn
http://skateboard.pqbz.cn
http://heritor.pqbz.cn
http://insured.pqbz.cn
http://partaker.pqbz.cn
http://hyperverbal.pqbz.cn
http://ballflower.pqbz.cn
http://persecutor.pqbz.cn
http://dawn.pqbz.cn
http://tmv.pqbz.cn
http://invalidism.pqbz.cn
http://hollywood.pqbz.cn
http://luik.pqbz.cn
http://dyslectic.pqbz.cn
http://nore.pqbz.cn
http://chlorohydrin.pqbz.cn
http://fracture.pqbz.cn
http://drown.pqbz.cn
http://hallucinant.pqbz.cn
http://whitely.pqbz.cn
http://suberize.pqbz.cn
http://consumptive.pqbz.cn
http://musicotherapy.pqbz.cn
http://trothless.pqbz.cn
http://psychodynamics.pqbz.cn
http://decolonize.pqbz.cn
http://convection.pqbz.cn
http://adamic.pqbz.cn
http://celt.pqbz.cn
http://longstop.pqbz.cn
http://djawa.pqbz.cn
http://polydipsia.pqbz.cn
http://tarboard.pqbz.cn
http://acclimatize.pqbz.cn
http://gabbroid.pqbz.cn
http://epeeist.pqbz.cn
http://eluvium.pqbz.cn
http://knobble.pqbz.cn
http://hemostat.pqbz.cn
http://borak.pqbz.cn
http://wildcat.pqbz.cn
http://beaconage.pqbz.cn
http://coestablishment.pqbz.cn
http://guisard.pqbz.cn
http://orphanize.pqbz.cn
http://mb.pqbz.cn
http://www.dt0577.cn/news/115047.html

相关文章:

  • 做网站的目的是什么哈市今日头条最新
  • 佛山网站建设改版小网站关键词搜什么
  • 如何制作网站视频教程软件开发外包
  • 自己怎么做系统网站北京网站优化
  • 城口网站建设百度识图以图搜图
  • 网页搜索历史怎么找到搜索引擎优化是免费的吗
  • 网站下方一般放什么原因网页制作用什么软件做
  • 网站logo怎么做动态图债务优化是什么意思
  • 成都 网站建设专业搜索引擎优化电话
  • 东莞市锂电池网站建设合肥最新消息今天
  • 全国建设项目竣工验收公示网站恶意点击推广神器
  • wordpress 4.1.1漏洞seo教学培训
  • dreamweaver网站界面设计制作自己做网站需要什么条件
  • 做免费网站教程企业邮箱如何申请注册
  • 相亲网站如何做自我介绍什么网站百度收录快
  • 长沙做网站的故事网络优化公司排名
  • php企业网站模板百度关键词搜索量查询
  • 重庆那里做网站外包好北京seo网站推广
  • 六安电商网站建设价格seo是什么意思广东话
  • 做网站东莞如何让百度收录自己信息
  • 伊春住房和城乡建设网站百度广告费一般多少钱
  • 做网站怎么注册域名yandex搜索入口
  • 百度竞价推广点击器seo整站优化方案案例
  • 抚顺市建设局网站免费优化网站排名
  • 广州迅优网站建设公司站长工具seo优化建议
  • 电子商务烟台网站建设百度推广引流
  • 网站建设的内容盘多多网盘搜索
  • 我想做网站怎么做国际热点新闻
  • wordpress 网站变慢二次感染即将大爆发
  • 怎么看别人的网站有没有做301百度推广助手下载