这篇文章主要围绕迁移到GoogleCloudNDB后替代webapp2.WSGIApplication和googleauthenticator迁移展开,旨在为您提供一份详细的参考资料。我们将全面介绍迁
这篇文章主要围绕迁移到Google Cloud NDB后替代webapp2.WSGIApplication和google authenticator迁移展开,旨在为您提供一份详细的参考资料。我们将全面介绍迁移到Google Cloud NDB后替代webapp2.WSGIApplication的优缺点,解答google authenticator迁移的相关问题,同时也会为您带来Android动态配置ApplicationId,App名字,AppLogo、Apache下的webapp2(=没有Google App Engine)、com.badlogic.gdx.Application.ApplicationType的实例源码、Debugging WebLogic Server Applications Using Eclipse and the WebLogic-Plugin的实用方法。
本文目录一览:- 迁移到Google Cloud NDB后替代webapp2.WSGIApplication(google authenticator迁移)
- Android动态配置ApplicationId,App名字,AppLogo
- Apache下的webapp2(=没有Google App Engine)
- com.badlogic.gdx.Application.ApplicationType的实例源码
- Debugging WebLogic Server Applications Using Eclipse and the WebLogic-Plugin
迁移到Google Cloud NDB后替代webapp2.WSGIApplication(google authenticator迁移)
如何解决迁移到Google Cloud NDB后替代webapp2.WSGIApplication?
我从google.appengine.ext.webapp
迁移并遇到了webapp2.WsgiApplication
的问题。我正在使用Django作为后端
主要部分是这样
application =webapp2.WsgiApplication([
(''/warmup'',warmupHandler)
(''/api/layer'',LayerService),debug=False)
def main():
google.appengine.ext.webapp.util.run_wsgi_app(application)
if __name__ == ''__main__'':
main()
我尝试使用Google Cloud提供的此代码段作为替代代码,但没有帮助。
def wsgi_middleware(app): 客户端= ndb.Client()
def middleware(request):
with client.context()
return app(request)
return middleware
他们也有代码片段,但我认为这是针对Flask的,我使用Django
def ndb_wsgi_middleware(wsgi_app):
def middleware(environ,start_response):
with client.context():
return wsgi_app(environ,start_response)
return middleware
在当前设置中,我得到的只是一个404错误。表示不选择模板
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
Android动态配置ApplicationId,App名字,AppLogo
需求:同一套代码,打一个京东,腾讯,小米的包,logo都是对应公司的logo,App名字为:京东,腾讯,小米
一、打开项目,在src目录下,与main同级的地方,将要打的包新建三个文件夹,分别以jingdong,tengxun,xiaomi命名,在这三个文件夹下面就放着和其他两个App不同的东西,比如logo图片,App名字等,结构如图:
strings.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">小米</string>
</resources>
styles.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
二、文件路径app ==> src ==> main ==> AndroidManifest.xml 文件配置
<application
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher"
android:theme="@style/LaunchTheme"
tools:replace="android:allowBackup,icon,theme,label">
...
</application>
三、对App 的build.gradle(android ==> app ==> build.gradle)进行配置,其中主要是productFlavors的配置,
注意点:
flavorDimensions "default"
//不同APP的配置
productFlavors {
//TODO:....
}
配置如下
def localProperties = new Properties()
def localPropertiesFile = rootProject.file(''local.properties'')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader(''UTF-8'') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty(''flutter.sdk'')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty(''flutter.versionCode'')
if (flutterVersionCode == null) {
flutterVersionCode = ''1''
}
def flutterVersionName = localProperties.getProperty(''flutter.versionName'')
if (flutterVersionName == null) {
flutterVersionName = ''1.0''
}
//打包时间
def releaseTime() {
return new Date().format("yyyyMMddHHmm")
}
apply plugin: ''com.android.application''
apply plugin: ''kotlin-android''
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
flavorDimensions "default"
signingConfigs {
debug {
storeFile file(''AndroidKeyStore'')
storePassword ''1234567''
keyAlias = ''keyforproject''
keyPassword ''123456''
}
release {
storeFile file(''AndroidKeyStore'')
storePassword ''1234567''
keyAlias = ''keyforproject''
keyPassword ''123456''
}
}
compileSdkVersion 28
sourceSets {
main.java.srcDirs += ''src/main/kotlin''
}
lintOptions {
disable ''InvalidPackage''
}
//APP默认配置
defaultConfig {
applicationId = ''com.xiaoxiao.tengxun''
signingConfig signingConfigs.debug
minSdkVersion 16
targetSdkVersion 28
versionName "1.0.1"
versionCode 10
// versionCode flutterVersionCode.toInteger()
// versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters ''armeabi'', ''armeabi-v7a'', ''x86'', ''x86_64'', ''mips'', ''mips64'', ''arm64-v8a''
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "appkey", // NOTE: JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
]
}
//不同APP的配置
productFlavors {
jingdong {
applicationId "com.xiaoxiao.jingdong"
resValue "string", "app_name", "jingdong"
manifestPlaceholders = [CHANNEL_VALUE: "jingdong"
,app_icon : "@mipmap/ic_launcher"]
}
tengxun {
applicationId "com.xiaoxiao.tengxun"
resValue "string", "app_name", "tengxun"
manifestPlaceholders = [CHANNEL_VALUE: "tengxun"
,app_icon : "@mipmap/ic_launcher"]
}
xiaomi {
applicationId "com.xiaoxiao.xiaomi"
resValue "string", "app_name", "xiaomi"
manifestPlaceholders = [CHANNEL_VALUE: "xiaomi",
app_icon : "@mipmap/ic_launcher",
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "appkey", // NOTE: JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
]
}
}
buildTypes {
//测试版本
debug {
/* 签名类型 */
signingConfig signingConfigs.debug
/* 是否开启代码混淆,默认false */
minifyEnabled false
/* 是否应该生成可调试的apk */
debuggable true
/* 混淆规则配置文件 */
// proguardFiles getDefaultProguardFile(''proguard-android.txt''), ''proguard-rules.pro''
/* 自定义buildType */
// buildConfigField ''String'', ''BASE_URL'', ''"http://api-debug.**/"''
}
//生产版本
release {
/* 签名类型 */
signingConfig signingConfigs.release
/* 是否开启代码混淆,默认false */
minifyEnabled false
/* 是否应该生成可调试的apk */
debuggable false
/* 移除无用的resource文件 */
// shrinkResources true
/* 混淆规则配置文件 */
// proguardFiles getDefaultProguardFile(''proguard-android.txt''), ''proguard-rules.pro''
/* 自定义buildType */
// buildConfigField ''String'', ''BASE_URL'', ''"http://api-release.**/"''
}
//预生产版本
/* 从给定的构建类型复制所有属性 */
pre.initWith(release)
pre {
buildConfigField "String", "BASE_URL", "http://api-pre.**/"
matchingFallbacks = [''pre'', ''debug'', ''release'']
}
}
// 当执行"Generate Signed Bundle or APK"时候,取消注释,生成apk文件名
// android.applicationVariants.all { variant ->
// variant.outputs.all { output ->
// def outputFile = output.outputFile
// if (outputFile != null && outputFile.name.endsWith(''.apk'')) {
// //这里修改apk文件名
// def fileName = "hu_${variant.productFlavors[0].name}-${defaultConfig.versionCode}-${defaultConfig.versionName}-${releaseTime()}.apk"
// //def fileName = outputFile.name.replace("app", "${rootProject.ext.appName}-${releaseTime()}-${defaultConfig.versionCode}-${defaultConfig.versionName}")
// // output.outputFile = new File(outputFile.parent, fileName)
// outputFileName = fileName
// }
// }
// }
}
flutter {
source ''../..''
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation ''junit:junit:4.12''
androidTestImplementation ''com.android.support.test:runner:1.0.2''
androidTestImplementation ''com.android.support.test.espresso:espresso-core:3.0.2''
}
参考链接
Android动态配置ApplicationId,App名字,AppLogo
一次搞懂Android签名文件的生成与配置
Apache下的webapp2(=没有Google App Engine)
我正在尝试在Apache和mod_wsgi的Python下运行webapp2 – 具体来说:Wampserver for Windows 7 with Apache 2.2.22。 到目前为止,我失败了。
总结
以上是小编为你收集整理的Apache下的webapp2(=没有Google App Engine)全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
com.badlogic.gdx.Application.ApplicationType的实例源码
/**创建一个Card2DEngine实例 */ public static final Engine newEngine(BaseGame card2dAppListener) { if(_instance == null){ if(_engineMode == null) { if(Gdx.app.getType() == ApplicationType.Desktop) { _engineMode = EngineMode.SingleThread; //桌面版本经过测试,backend已经实现了渲染线程分离,因此默认使用single模式 } else { _engineMode = EngineMode.DoubleThread; } } cclog.engine("Engine",">>>>>>>>>>>>>>>>>> engine run mode : " + _engineMode); _instance = new Engine(); _instance.game = card2dAppListener; _instance.director = Director.getInstance(); _instance.baseScheduler = BaseScheduler.instance(); } return _instance; }
public void startCubes() { compatibility = this; Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler.instance); Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandler.instance); try { if (applicationType == ApplicationType.HeadlessDesktop) { run(new ServerAdapter()); } else { run(new ClientAdapter()); } } catch (Exception e) { try { Log.error("Failed to start",CubesException.get(e)); } catch (Exception ex) { if (ex instanceof CubesException) { throw (CubesException) ex; } else { throw CubesException.get(e); } } } }
public void startCubes() { compatibility = this; Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler.instance); Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandler.instance); try { if (applicationType == ApplicationType.HeadlessDesktop) { run(new ServerAdapter()); } else { run(new ClientAdapter()); } } catch (Exception e) { try { Log.error("Failed to start",CubesException.get(e)); } catch (Exception ex) { if (ex instanceof CubesException) { throw (CubesException) ex; } else { throw CubesException.get(e); } } } }
@Override public void create () { // Net Shit System.out.println("Good morning!"); game = this; batch = new SpriteBatch(); if(Gdx.app.getType() == ApplicationType.Desktop) { // Run server server = new NetServer(); setScreen(new SplashScreen(game)); } else { // Run client client = new NetClient(); setScreen(new LobbyScreen(game)); } }
/** * Method called once when the application is created. */ @Override public void create() { //Load all textures TextureManager.load(); AudioManager.load(); this.setScreen(new StartScreen(this,client,server)); if(Constants.TINYWINDOWS) { Gdx.graphics.setwindowedMode(Constants.SCREENWIDTH / 2,Constants.SCREENHEIGHT/ 2); } if(Gdx.app.getType().equals(ApplicationType.Android)) { Constants.ISRUNNINGONSMARTPHONE = true; } }
@Override public void pause() { if (!Gdx.app.getType().equals(ApplicationType.Desktop)) { systemPaused = true; } log("Pause"); Gdx.input.setInputProcessor(null); if (music != null) { if (!Gdx.app.getType().equals(ApplicationType.Desktop)) { wasMusicPlaying = music.isPlaying(); music.pause(); } } else { wasMusicPlaying = false; } }
public static void saveScreenshot(final int w,final int h,final String prefix) { try { FileHandle fh; do { if (Gdx.app.getType() == ApplicationType.Desktop) { fh = Gdx.files.local("bin/screenshot_" + prefix + "_" + counter++ + ".png"); } else { fh = Gdx.files.local("screenshot_" + prefix + "_" + counter++ + ".png"); } } while (fh.exists()); final pixmap pixmap = getScreenshot(0,w,h,true); pixmapIO.writePNG(fh,pixmap); pixmap.dispose(); Gdx.app.log("screenshot","Screenshot saved to " + fh); } catch (final Exception e) { } }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,480,320); spriteBatch.setProjectionMatrix(viewMatrix); spriteBatch.setTransformMatrix(transformMatrix); spriteBatch.begin(); spriteBatch.disableBlending(); spriteBatch.setColor(Color.WHITE); spriteBatch.draw(background,320,512,false,false); spriteBatch.enableBlending(); spriteBatch.draw(logo,320 - 128,128,256,false); spriteBatch.setBlendFunction(GL20.GL_ONE,GL20.GL_ONE_MINUS_SRC_ALPHA); glyphLayout.setText(font,"Touch screen to start!"); font.draw(spriteBatch,glyphLayout,240 - glyphLayout.width / 2,128); if (Gdx.app.getType() == ApplicationType.WebGL) { glyphLayout.setText(font,"Press Enter for Fullscreen Mode"); font.draw(spriteBatch,128 - font.getLineHeight()); } spriteBatch.end(); }
@Override public void create () { Array<Controller> controllers = Controllers.getControllers(); if (controllers.size > 0) { controller = controllers.first(); } Controllers.addListener(controllerListener); setScreen(new MainMenu(this)); music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3",FileType.Internal)); music.setLooping(true); music.play(); Gdx.input.setInputProcessor(new InputAdapter() { @Override public boolean keyUp (int keycode) { if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) { Gdx.graphics.setFullscreenMode(Gdx.graphics.getdisplayMode()); } return true; } }); fps = new FPSLogger(); }
@Override public void show () { font = new BitmapFont(Gdx.files.internal("fonts/font.fnt")); cache = font.getCache(); if (Gdx.app.getType() == ApplicationType.Android) font.getData().setScale(2); polygonBatch = new polygonspriteBatch(); camera = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); pixmap pixmap = new pixmap(1,1,Format.RGB565); pixmap.setColor(Color.WHITE); pixmap.fill(); emptyTexture = new Texture(pixmap); pixmap.dispose(); }
public ShaderManager (String shaderDir,AssetManager am,boolean addProcessors) { shaders = new ObjectMap<String,ShaderProgram>(); shaderPaths = new ObjectMap<String,String>(); sourcesvert = new ObjectMap<String,String>(); sourcesFrag = new ObjectMap<String,String>(); frameBuffers = new ObjectMap<String,FrameBuffer>(); openedFrameBuffers = new Array<String>(true,MAX_FRAMEBUFFERS); screenCamera = new OrthographicCamera(Gdx.graphics.getWidth() + 2,Gdx.graphics.getHeight() + 2); createScreenQuad(); screenCamera.translate(0,-1); screenCamera.update(); setShaderDir(shaderDir); setAssetManager(am); // add("empty","empty.vert","empty.frag"); // add("default","default.vert","default.frag"); if (addProcessors && (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet || Gdx.app.getType() == ApplicationType.WebGL)) { /* * add("processor","processor.vert","processor.frag"); add("processor_blur","processor_blur.frag"); * add("copy","copy.frag"); add("processor_draw","processor_draw.frag"); * add("processor_fill","processor_fill.frag"); */ } }
private void tryLoadDesktopTwitteraPI() { if (Gdx.app.getType() != ApplicationType.Desktop) { Gdx.app.debug(TAG,"Skip loading Twitter API for Desktop. Not running Desktop. \n"); return; } try { final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.desktop.DesktopTwitteraPI"); Object twitter = ClassReflection.getConstructor(twitterClazz,TwitterConfig.class).newInstance(config); twitteraPI = (TwitteraPI) twitter; Gdx.app.debug(TAG,"gdx-twitter for Desktop loaded successfully."); } catch (ReflectionException e) { Gdx.app.debug(TAG,"Error creating gdx-twitter for Desktop (are the gdx-twitter **.jar files installed?). \n"); e.printstacktrace(); } }
private void tryLoadHTMLTwitteraPI() { if (Gdx.app.getType() != ApplicationType.WebGL) { Gdx.app.debug(TAG,"Skip loading gdx-twitter for HTML. Not running HTML. \n"); return; } try { final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.html.HTMLTwitteraPI"); Object twitter = ClassReflection.getConstructor(twitterClazz,"gdx-twitter for HTML loaded successfully."); } catch (ReflectionException e) { Gdx.app.debug(TAG,"Error creating gdx-twitter for HTML (are the gdx-twitter **.jar files installed?). \n"); e.printstacktrace(); } }
private void tryLoadioSTWitteraPI() { if (Gdx.app.getType() != ApplicationType.iOS) { Gdx.app.debug(TAG,"Skip loading gdx-twitter for iOS. Not running iOS. \n"); return; } try { // Class<?> activityClazz = // ClassReflection.forName("com.badlogic.gdx.backends.iosrobovm.IOSApplication"); final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.ios.IOSTwitteraPI"); Object twitter = ClassReflection.getConstructor(twitterClazz,TwitterConfig.class).newInstance(config); twitteraPI = (TwitteraPI) twitter; Gdx.app.debug(TAG,"gdx-twitter for iOS loaded successfully."); } catch (ReflectionException e) { Gdx.app.debug(TAG,"Error creating gdx-twitter for iOS (are the gdx-twitter **.jar files installed?). \n"); e.printstacktrace(); } }
public FinishScene(Application app) { setFillParent(true); Label label = new Label("You have beaten this level!",app.getGuiSkin()); add(label); row().padTop(175.f); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or click left to go to the next level",app.getGuiSkin()); label2 = new Label("Press Escape to go back to menu",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to go to the next level",app.getGuiSkin()); label2 = new Label("Press the back button to go back to the menu",app.getGuiSkin()); } add(label1); row().padTop(75.f); add(label2); pack(); setColor(1,0); }
public PauseScene(Application app) { setFillParent(true); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or press Left to resume the game",app.getGuiSkin()); label2 = new Label("Press Escape to go back to the menu",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to resume the game",app.getGuiSkin()); } add(new Label("Game paused",app.getGuiSkin())); row().padTop(150.f); add(label1); row().padTop(75.f); add(label2); pack(); setColor(1,0); }
public ModalScene(Application app) { setFillParent(true); mText = new Label("No Text set yet",app.getGuiSkin()); mText.setWrap(true); add(mText).width(900); row().padTop(175.f); Label label1; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or click left to resume the game",app.getGuiSkin()); } add(label1); pack(); setColor(1,0); }
public CrashedScene(Application app) { setFillParent(true); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or press Left to start again from the last checkpoint",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to start again from the last checkpoint",app.getGuiSkin()); } add(new Label("You crashed into the wall",app.getGuiSkin())); row().padTop(150.f); add(label1); row().padTop(75.f); add(label2); pack(); setColor(1,0); }
public StartScene(Application app) { setFillParent(true); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or press Left to start the game",app.getGuiSkin()); label2 = new Label("Press Escape to pause the game",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to start the game",app.getGuiSkin()); label2 = new Label("Press the back button to pause the game",app.getGuiSkin()); } add(label1); row().padTop(150.f); add(label2); pack(); }
private void installDesktopGDXDialogs() { if (Gdx.app.getType() != ApplicationType.Desktop) { showDebugSkipInstall(ApplicationType.Desktop.name()); return; } try { final Class<?> dialogManagerClazz = ClassReflection.forName("de.tomgrill.gdxdialogs.desktop.DesktopGDXDialogs"); Object dialogManager = ClassReflection.getConstructor(dialogManagerClazz).newInstance(); this.gdxDialogs = (GDXDialogs) dialogManager; showDebugInstallSuccessful(ApplicationType.Desktop.name()); } catch (ReflectionException e) { showErrorInstall(ApplicationType.Desktop.name(),"desktop"); e.printstacktrace(); } }
private void installHTMLGDXDialogs() { if (Gdx.app.getType() != ApplicationType.WebGL) { showDebugSkipInstall(ApplicationType.WebGL.name()); return; } try { final Class<?> dialogManagerClazz = ClassReflection.forName("de.tomgrill.gdxdialogs.html.HTMLGDXDialogs"); Object dialogManager = ClassReflection.getConstructor(dialogManagerClazz).newInstance(); this.gdxDialogs = (GDXDialogs) dialogManager; showDebugInstallSuccessful(ApplicationType.WebGL.name()); } catch (ReflectionException e) { showErrorInstall(ApplicationType.WebGL.name(),"html"); e.printstacktrace(); } }
public Db() { // deserialize all deFinitions deFinitions = new ObjectMap<>(); Json json = new Json(); json.setIgnoreUnkNownFields(true); for (DeFinitionReference reference : DeFinitionReference.values()) { final String name = reference.id; final FileHandle handle = Gdx.files.external("umbracraft/" + name + ".json"); if (handle.exists() && Gdx.app.getType() == ApplicationType.Desktop) { deFinitions.put(name,json.fromJson(reference.clazz,handle)); } else { final FileHandle internalHandle = Gdx.files.internal("db/" + name + ".json"); if (internalHandle.exists()) { deFinitions.put(name,internalHandle)); } else { try { deFinitions.put(name,reference.clazz.newInstance()); } catch (InstantiationException | illegalaccessexception e) { Game.error("Could not instantiate class: " + reference.clazz); e.printstacktrace(); } } } } }
public void savescoreEtc() { Preferences prefs = Gdx.app.getPreferences(GameSaves); // sum of all scores ever totalscoreSum += currentscore; prefs.putInteger("total_score_sum",totalscoreSum); // games played by player ++totalGamesPlayed; prefs.putInteger("total_games_played",totalGamesPlayed); // save top score if (topscore < currentscore) { topscore = currentscore; // Save top score!!!! prefs.putInteger("topscore",topscore); } // hack / dont want to kill my ssd if (Gdx.app.getType() != ApplicationType.Desktop) { prefs.flush(); } }
@Override public void render(float dt) { Gdx.gl.glClearColor(0,1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); //compara si la aplicacion se ejecuta en escritorio o en android if(Gdx.app.getType() == ApplicationType.Desktop){ this.enTradaEscritorio(dt); }else if(Gdx.app.getType() == ApplicationType.Android){ this.enTradaAndroid(dt); } //actualizamos camara.update(); this.juegoGanado(); batch.setProjectionMatrix(camara.combined); manejadorDeSprite.update(dt,arcanoid,jugador); //renderiza el manejadorDeSprite,fondo de pantalla y fuente de jugador batch.begin(); batch.draw(fondoPantalla,Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); jugador.draw(batch); batch.end(); manejadorDeSprite.render(); }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,GL20.GL_ONE_MINUS_SRC_ALPHA); String text = "Touch screen to start!"; float width = font.getBounds(text).width; font.draw(spriteBatch,text,240 - width / 2,128); if (Gdx.app.getType() == ApplicationType.WebGL) { text = "Press Enter for Fullscreen Mode"; width = font.getBounds(text).width; font.draw(spriteBatch,"Press Enter for Fullscreen Mode",128 - font.getLineHeight()); } spriteBatch.end(); }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,128 - font.getLineHeight()); } spriteBatch.end(); }
@Override public void create () { Array<Controller> controllers = Controllers.getControllers(); if (controllers.size > 0) { controller = controllers.first(); } Controllers.addListener(controllerListener); setScreen(new MainMenu(this)); music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3",FileType.Internal)); music.setLooping(true); music.play(); Gdx.input.setInputProcessor(new InputAdapter() { @Override public boolean keyUp (int keycode) { if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) { if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setdisplayMode(Gdx.graphics.getdisplayModes()[0]); } return true; } }); fps = new FPSLogger(); }
public float getInputRotation() { float rawRotation = 0f; if (Gdx.app.getType() == ApplicationType.Android) { float added = Prefs.prefs.getFloat("calibratedX",0f); rawRotation = (Gdx.input.getAccelerometerX() - added) * -0.1f; } else if (Gdx.app.getType() == ApplicationType.Desktop) { if (Gdx.input.isKeypressed(Input.Keys.LEFT)) { rawRotation = -0.3f; } else if (Gdx.input.isKeypressed(Input.Keys.RIGHT)) { rawRotation = 0.3f; } } float rotation = 0f; // Don't be too sensitive on the rotation: it only counts if it's above a threshold if (rawRotation > rotationThreshold) { rotation = rawRotation - rotationThreshold; } else if (rawRotation < -rotationThreshold) { rotation = rawRotation + rotationThreshold; } return rotation; }
@Override public void consumeCustomData (int target) { if (!Gdx.graphics.supportsExtension("texture_float")) throw new GdxRuntimeException("Extension OES_TEXTURE_FLOAT not supported!"); // this is a const from GL 3.0,used only on desktops final int GL_RGBA32F = 34836; // GLES and WebGL defines texture format by 3rd and 8th argument,// so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there. if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS || Gdx.app.getType() == ApplicationType.WebGL) { Gdx.gl.glTexImage2D(target,GL20.GL_RGBA,width,height,GL20.GL_FLOAT,buffer); } else { // in desktop OpenGL the texture format is defined only by the third argument,// hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL) Gdx.gl.glTexImage2D(target,GL_RGBA32F,buffer); } }
public static String createPrefix(final Renderable renderable,final Config config) { String prefix = ""; if(Gdx.app.getType() == ApplicationType.Desktop) prefix +="#version 120\n"; else prefix +="#version 100\n"; if(config.type == ParticleType.Billboard){ prefix +="#define billboard\n"; if(config.align == AlignMode.Screen) prefix += "#define screenFacing\n"; else if(config.align == AlignMode.ViewPoint) prefix += "#define viewPointFacing\n"; //else if(config.align == AlignMode.ParticleDirection) // prefix += "#define paticleDirectionFacing\n"; } return prefix; }
@Override public Shader getShader (Renderable renderable) { try { return super.getShader(renderable); } catch (Throwable e) { if (tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) Gdx.files.absolute(tempFolder).child(name + ".log.txt").writeString(e.getMessage(),false); if (!revert()) { Gdx.app.error("shadercollectionTest",e.getMessage()); throw new GdxRuntimeException("Error creating shader,cannot revert to default shader",e); } error = true; Gdx.app.error("ShaderTest","Could not create shader,reverted to default shader.",e); return super.getShader(renderable); } }
@Override public void create () { super.create(); lights = new Environment(); lights.set(new ColorAttribute(ColorAttribute.AmbientLight,0.1f,1.f)); lights.add(new DirectionalLight().set(0.8f,0.8f,-0.5f,-1.0f,-0.8f)); shaderProvider = new TestShaderProvider(); shaderBatch = new ModelBatch(shaderProvider); cam.position.set(1,1); cam.lookAt(0,0); cam.update(); showAxes = true; onModelClicked("g3d/shapes/teapot.g3dj"); shaderRoot = (hotLoadFolder != null && Gdx.app.getType() == ApplicationType.Desktop) ? Gdx.files.absolute(hotLoadFolder) : Gdx.files.internal("data/g3d/shaders"); }
/** * Sets the up game name. * * @param menu_screen the new up game name */ public void setUpGameName(final MAMainMenuScreen menu_screen) { menu_screen.title = new EmptyActorLight(TITLE_W,TITLE_H,true); menu_screen.title.setTextureRegion(UIAssets.image_main_title,true); menu_screen.title.setorigin( menu_screen.title.getWidth() / 2,menu_screen.title.getHeight() / 2); menu_screen.title.setPosition( AppSettings.SCREEN_W / 2 - menu_screen.title.getWidth() / 2,AppSettings.SCREEN_H + menu_screen.title.getHeight()); if (Gdx.app.getType() == ApplicationType.Android) { menu_screen.title.setPosition( AppSettings.SCREEN_W / 2 - menu_screen.title.getWidth() / 2,AppSettings.SCREEN_H + menu_screen.title.getHeight() - 50); } // menu_screen.getStage().addActor(menu_screen.title); }
/** * Setzen des root-Verzeichnisses. Wird fuer den Zugriff auf Assets * benoetigt. Weiterhin werden die Sound,Music und Texture Pfade gesetzt */ private static void setApplicationRoot() { if (Gdx.app.getType() == ApplicationType.Android) { assetDir = ""; } else if (Gdx.app.getType() == ApplicationType.Desktop) { assetDir = System.getProperty("user.dir") + FILESEParaTOR + "bin" + FILESEParaTOR; } else { Gdx.app.log("AssetManager","No android or desktop device"); } directorySounds = assetDir + FOLDERNAME_SOUNDS; directoryMusic = assetDir + FOLDERNAME_MUSIC; directoryPictures = assetDir + FOLDERNAME_PICTURES; directoryFonts = assetDir + FOLDERNAME_FONTS; }
@Override protected void initShaderProgram() { // Initialise renderer if (Gdx.app.getType() == ApplicationType.WebGL) shaderProgram = new ShaderProgram(Gdx.files.internal("shader/point.vertex.glsl"),Gdx.files.internal("shader/point.fragment.wgl.glsl")); else shaderProgram = new ShaderProgram(Gdx.files.internal("shader/point.vertex.glsl"),Gdx.files.internal("shader/point.fragment.glsl")); if (!shaderProgram.isCompiled()) { Logger.error(this.getClass().getName(),"Pixel shader compilation Failed:\n" + shaderProgram.getLog()); } pointAlpha = new float[] { GlobalConf.scene.POINT_ALPHA_MIN,GlobalConf.scene.POINT_ALPHA_MIN + GlobalConf.scene.POINT_ALPHA_MAX }; shaderProgram.begin(); shaderProgram.setUniform2fv("u_pointAlpha",pointAlpha,2); shaderProgram.end(); }
public FileHandle getUserFile(String filename) { FileHandle file = null; if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) { String dir = Config.getProperty(Config.TITLE_PROP,DESKTOP_PREFS_DIR); dir.replace(" ",""); StringBuilder sb = new StringBuilder(); sb.append(".").append(dir).append("/").append(filename); if (System.getProperty("os.name").toLowerCase().contains("mac") && System.getenv("HOME").contains("Containers")) { file = Gdx.files.absolute(System.getenv("HOME") + "/" + sb.toString()); } else { file = Gdx.files.external(sb.toString()); } } else { file = Gdx.files.local(NOT_DESKTOP_PREFS_DIR + filename); } return file; }
public FileHandle getUserFolder() { FileHandle file = null; if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) { String dir = Config.getProperty(Config.TITLE_PROP,""); StringBuilder sb = new StringBuilder("."); if (System.getProperty("os.name").toLowerCase().contains("mac") && System.getenv("HOME").contains("Containers")) { file = Gdx.files.absolute(System.getenv("HOME") + "/" + sb.append(dir).toString()); } else { file = Gdx.files.external(sb.append(dir).toString()); } } else { file = Gdx.files.local(NOT_DESKTOP_PREFS_DIR); } return file; }
public DeFinitionDeterminer(){ super(); int w = Gdx.graphics.getWidth(); int h = Gdx.graphics.getHeight(); int m = 0; if(w>h) m = w; else m = h; if(Gdx.app.getType() == ApplicationType.Desktop){ screenType = TextureSize.HIGH; } else if(m <= 480){ screenType = TextureSize.LOW; } else if(m <= 1024){ screenType = TextureSize.MEDIUM; } else { screenType = TextureSize.HIGH; } System.out.println("System screen deFinition : " + screenType.toString()); }
public static FileHandle[] getFontTxtDir() { if (Gdx.app.getType().equals(ApplicationType.Desktop)) { System.out.println(System.getProperty("user.dir") + "\\bin\\fonts\\"); return Gdx.files.absolute( System.getProperty("user.dir") + "\\bin\\fonts\\").list(); } else if (Gdx.app.getType() == ApplicationType.Android) { return Gdx.files.internal("fonts/").list(); } return null; }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,128 - font.getLineHeight()); } spriteBatch.end(); }
Debugging WebLogic Server Applications Using Eclipse and the WebLogic-Plugin
http://www.oracle.com/technetwork/cn/tutorials/eclipse-plugin-093411.html
今天关于迁移到Google Cloud NDB后替代webapp2.WSGIApplication和google authenticator迁移的讲解已经结束,谢谢您的阅读,如果想了解更多关于Android动态配置ApplicationId,App名字,AppLogo、Apache下的webapp2(=没有Google App Engine)、com.badlogic.gdx.Application.ApplicationType的实例源码、Debugging WebLogic Server Applications Using Eclipse and the WebLogic-Plugin的相关知识,请在本站搜索。
本文标签: