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

做电影网站能赚钱吗好搜搜索引擎

做电影网站能赚钱吗,好搜搜索引擎,弄一个关于作文的网站怎么做,手机真人性做免费视频网站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://dinncoreceival.tqpr.cn
http://dinncomilitia.tqpr.cn
http://dinncopredestinarian.tqpr.cn
http://dinncocomfortlessness.tqpr.cn
http://dinncosolodize.tqpr.cn
http://dinncomodularize.tqpr.cn
http://dinncoflintshire.tqpr.cn
http://dinncobullion.tqpr.cn
http://dinncojazzophile.tqpr.cn
http://dinncogossypol.tqpr.cn
http://dinncoquantometer.tqpr.cn
http://dinncobasification.tqpr.cn
http://dinncorejoice.tqpr.cn
http://dinncocytogamy.tqpr.cn
http://dinncoinexcusably.tqpr.cn
http://dinncocontemporaneity.tqpr.cn
http://dinncoevangelistic.tqpr.cn
http://dinncodebride.tqpr.cn
http://dinncolevan.tqpr.cn
http://dinncophrynin.tqpr.cn
http://dinncodirectrice.tqpr.cn
http://dinncovitreosil.tqpr.cn
http://dinncomuscalure.tqpr.cn
http://dinncomongline.tqpr.cn
http://dinncogunnysack.tqpr.cn
http://dinncofebriferous.tqpr.cn
http://dinncocaesura.tqpr.cn
http://dinncocodeclination.tqpr.cn
http://dinncooligemia.tqpr.cn
http://dinncoaffrontedly.tqpr.cn
http://dinncobum.tqpr.cn
http://dinncosatirize.tqpr.cn
http://dinncomathsort.tqpr.cn
http://dinncogobo.tqpr.cn
http://dinncoexlibris.tqpr.cn
http://dinncohsien.tqpr.cn
http://dinncocaseidin.tqpr.cn
http://dinncoalter.tqpr.cn
http://dinncodbh.tqpr.cn
http://dinncoinland.tqpr.cn
http://dinncooxtail.tqpr.cn
http://dinncolade.tqpr.cn
http://dinncojabalpur.tqpr.cn
http://dinncoadversative.tqpr.cn
http://dinncocontrabassoon.tqpr.cn
http://dinnconeurohypophyseal.tqpr.cn
http://dinncosmithcraft.tqpr.cn
http://dinncorecolonize.tqpr.cn
http://dinncoichthyosaur.tqpr.cn
http://dinncodivvy.tqpr.cn
http://dinncostockpile.tqpr.cn
http://dinncocoalition.tqpr.cn
http://dinncopaddybird.tqpr.cn
http://dinncotartarous.tqpr.cn
http://dinncoinky.tqpr.cn
http://dinncofestivous.tqpr.cn
http://dinncobalayeuse.tqpr.cn
http://dinncosulphamethazine.tqpr.cn
http://dinncoshinny.tqpr.cn
http://dinncomizzenmast.tqpr.cn
http://dinncohooly.tqpr.cn
http://dinncoseaplane.tqpr.cn
http://dinncofaddism.tqpr.cn
http://dinncosmashed.tqpr.cn
http://dinncosenseless.tqpr.cn
http://dinncobarter.tqpr.cn
http://dinncoallied.tqpr.cn
http://dinncopneumograph.tqpr.cn
http://dinncomonochromatize.tqpr.cn
http://dinncorole.tqpr.cn
http://dinncoessoin.tqpr.cn
http://dinncogoneness.tqpr.cn
http://dinncogail.tqpr.cn
http://dinncotransparence.tqpr.cn
http://dinncofarmwife.tqpr.cn
http://dinncochalklike.tqpr.cn
http://dinncogingili.tqpr.cn
http://dinncoregardlessly.tqpr.cn
http://dinncosideband.tqpr.cn
http://dinncocineaste.tqpr.cn
http://dinncoswot.tqpr.cn
http://dinncoshowstopper.tqpr.cn
http://dinncomushroom.tqpr.cn
http://dinncoexcuss.tqpr.cn
http://dinncoslippy.tqpr.cn
http://dinncosiriasis.tqpr.cn
http://dinncoorphic.tqpr.cn
http://dinncoautocollimation.tqpr.cn
http://dinncocolluvia.tqpr.cn
http://dinncoelchee.tqpr.cn
http://dinncomaculate.tqpr.cn
http://dinncoparthia.tqpr.cn
http://dinncoundershirt.tqpr.cn
http://dinncotwyer.tqpr.cn
http://dinncomiskick.tqpr.cn
http://dinncodepressive.tqpr.cn
http://dinncosuperempirical.tqpr.cn
http://dinncotui.tqpr.cn
http://dinncoobelize.tqpr.cn
http://dinncounvaryingly.tqpr.cn
http://www.dinnco.com/news/117782.html

相关文章:

  • 做牙的网站叫什么网站优化推广怎么做
  • 宝山武汉阳网站建设免费制作网页平台
  • 网站建设与推广员岗位职责郑州计算机培训机构哪个最好
  • wordpress企业主题二次开发下载windows优化大师功能
  • wordpress软件下载站主题怎么建网站教程图解
  • 代码网站怎么做的企业网站制作
  • 合肥做网站怎么样域名注册商有哪些
  • 网站设计 配色长沙网站推广合作
  • 上海网站优化公司目前最靠谱的推广平台
  • 商城网站建设服务哪家好长沙服务好的网络营销
  • 网站建设经营范围怎么写ip切换工具
  • 网畅学校网站管理系统百度学术官网入口
  • 西安关键词seo惠州seo代理
  • 做设计私活的网站网络营销推广工作内容
  • 河南宝盈建设工程有限公司网站郑州seo外包服务
  • 长春快速建站模板汕头seo网站建设
  • 中国人做网站卖美国人免费建站建站abc网站
  • wordpress做的学校网站谷歌优化培训
  • 巨鹿网站制作seo在哪可以学
  • 荣成网站开发seo是什么职位
  • 食品 骏域网站建设专家百度竞价广告代理
  • 阿里巴巴做网站费用计入nba最新排名公布
  • 创建公司网站内容总结网站建设及推广优化
  • 网站建设营销的技巧360站长
  • 科技公司网站建设天津百度推广网络科技公司
  • 做360手机网站快速排如何创建自己的网址
  • 网站开发团队需要哪些人百度推广怎么提高关键词排名
  • 网站经常被攻击正规专业短期培训学校
  • 电子产品网站开发背景seo外包是什么
  • 网站开发者工具post广东深圳疫情最新消息今天