當前位置: 首頁>>代碼示例>>Java>>正文


Java AndroidGraphics類代碼示例

本文整理匯總了Java中com.badlogic.gdx.backends.android.AndroidGraphics的典型用法代碼示例。如果您正苦於以下問題:Java AndroidGraphics類的具體用法?Java AndroidGraphics怎麽用?Java AndroidGraphics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AndroidGraphics類屬於com.badlogic.gdx.backends.android包,在下文中一共展示了AndroidGraphics類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPause

import com.badlogic.gdx.backends.android.AndroidGraphics; //導入依賴的package包/類
@Override
protected void onPause() {
    boolean isContinuous = graphics.isContinuousRendering();
    boolean isContinuousEnforced = AndroidGraphics.enforceContinuousRendering;

    // from here we don't want non continuous rendering
    AndroidGraphics.enforceContinuousRendering = true;
    graphics.setContinuousRendering(true);
    // calls to setContinuousRendering(false) from other thread (ex: GLThread)
    // will be ignored at this point...
    graphics.pause();

    input.onPause();

    if (isFinishing()) {
        graphics.clearManagedCaches();
        graphics.destroy();
    }

    AndroidGraphics.enforceContinuousRendering = isContinuousEnforced;
    graphics.setContinuousRendering(isContinuous);

    graphics.onPauseGLSurfaceView();

    super.onPause();
}
 
開發者ID:SiliconLabs,項目名稱:thunderboard-android,代碼行數:27,代碼來源:GdxDemoActivity.java

示例2: init

import com.badlogic.gdx.backends.android.AndroidGraphics; //導入依賴的package包/類
private void init(ApplicationListener listener, AndroidApplicationConfiguration config, boolean isForView) {
    if (this.getVersion() < MINIMUM_SDK) {
        throw new GdxRuntimeException("LibGDX requires Android API Level " + MINIMUM_SDK + " or later.");
    }
    graphics = new AndroidGraphics(this, config, config.resolutionStrategy == null ? new FillResolutionStrategy()
            : config.resolutionStrategy);
    input = AndroidInputFactory.newAndroidInput(this, this.getContext(), graphics.getView(), config);
    audio = new AndroidAudio(this.getContext(), config);
    this.getContext().getFilesDir(); // workaround for Android bug #10515463
    files = new AndroidFiles(this.getContext().getAssets(), this.getContext().getFilesDir().getAbsolutePath());
    net = new AndroidNet(this);
    this.listener = listener;
    this.handler = new Handler();
    this.useImmersiveMode = config.useImmersiveMode;
    this.hideStatusBar = config.hideStatusBar;

    // Add a specialized audio lifecycle listener
    addLifecycleListener(new LifecycleListener() {

        @Override
        public void resume() {
            // No need to resume audio here
        }

        @Override
        public void pause() {
            audio.pause();
        }

        @Override
        public void dispose() {
            audio.dispose();
        }
    });

    Gdx.app = this;
    Gdx.input = this.getInput();
    Gdx.audio = this.getAudio();
    Gdx.files = this.getFiles();
    Gdx.graphics = this.getGraphics();
    Gdx.net = this.getNet();

    if (!isForView) {
        try {
            supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        } catch (Exception ex) {
            log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex);
        }

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        setContentView(graphics.getView(), createLayoutParams());
    }

    createWakeLock(config.useWakelock);
    hideStatusBar(this.hideStatusBar);
    useImmersiveMode(this.useImmersiveMode);
    if (this.useImmersiveMode && getVersion() >= Build.VERSION_CODES.KITKAT) {
        try {
            Class<?> vlistener = Class.forName("com.badlogic.gdx.backends.android.AndroidVisibilityListener");
            Object o = vlistener.newInstance();
            Method method = vlistener.getDeclaredMethod("createListener", AndroidApplicationBase.class);
            method.invoke(o, this);
        } catch (Exception e) {
            log("AndroidApplication", "Failed to create AndroidVisibilityListener", e);
        }
    }
}
 
開發者ID:SiliconLabs,項目名稱:thunderboard-android,代碼行數:69,代碼來源:GdxDemoActivity.java

示例3: getGdxInput

import com.badlogic.gdx.backends.android.AndroidGraphics; //導入依賴的package包/類
@Override
public AndroidInput getGdxInput() {
	return new OuyaInput(Gdx.app, ((Activity)Gdx.app), ((AndroidGraphics)Gdx.graphics).getView(), cfgApp);
}
 
開發者ID:0x0ade,項目名稱:shadow-engine,代碼行數:5,代碼來源:OuyaBackend.java


注:本文中的com.badlogic.gdx.backends.android.AndroidGraphics類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。