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


Java ShapeRenderer.setAutoShapeType方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.glutils.ShapeRenderer.setAutoShapeType方法的典型用法代碼示例。如果您正苦於以下問題:Java ShapeRenderer.setAutoShapeType方法的具體用法?Java ShapeRenderer.setAutoShapeType怎麽用?Java ShapeRenderer.setAutoShapeType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.glutils.ShapeRenderer的用法示例。


在下文中一共展示了ShapeRenderer.setAutoShapeType方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
    sb.setProjectionMatrix(camera.combined);
    sr.setAutoShapeType(true);
    sr.setProjectionMatrix(camera.combined);
    //SHAPERENDERER
    sr.begin();
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.setColor(new Color(23 / 255f, 23 / 255f, 23 / 255f, 1f));
    sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
    for (int i = 0; i < background.length; i++) {
        background[i].renderSR(sr);
    }
    play.renderSR(sr);
    music.renderSR(sr);
    sr.end();

    //SPRITEBATCH
    sb.begin();
    sb.draw(logo, Game.WIDTH / 2 - (logo.getTexture().getWidth() * 10) / 2, Game.HEIGHT - 50 - logo.getHeight() * 10, logo.getWidth() * 10, logo.getHeight() * 10);
    play.renderSB(sb);
    music.renderSB(sb);
    betaText.draw(sb, "Beta Release - Copyright 2017 Gussio. All rights reserved. Visit https://gussio.nl/ for more info.", 10, 25);
    sb.end();
}
 
開發者ID:MrGussio,項目名稱:EarthInvadersGDX,代碼行數:26,代碼來源:MenuScreen.java

示例2: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
    sb.setProjectionMatrix(camera.combined);
    sr.setAutoShapeType(true);
    sr.setProjectionMatrix(camera.combined);

    //BACKGROUND
    sr.begin();
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.setColor(Color.WHITE);
    sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
    sr.end();

    //LOGO
    sb.begin();
    sb.draw(logo, Game.WIDTH / 2 - logo.getWidth() * 20 / 2, Game.HEIGHT / 2 - logo.getHeight() * 20 / 2, logo.getWidth() * 20, logo.getHeight() * 20);
    sb.end();
}
 
開發者ID:MrGussio,項目名稱:EarthInvadersGDX,代碼行數:19,代碼來源:SplashScreen.java

示例3: create

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void create() {
    overlayCamera = new OrthographicCamera(424, 240);
    overlayCamera.translate(overlayCamera.viewportWidth / 2, overlayCamera.viewportHeight / 2, 0);
    overlayCamera.update();
    overlayViewPort = new StretchViewport(424, 240, overlayCamera);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);
    initializeTextures();
}
 
開發者ID:gradualgames,項目名稱:ggvm,代碼行數:11,代碼來源:TouchInputProcessor.java

示例4: MainWindow

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public MainWindow(String title) {
    setSize(480, 800);
    cubDrawable = DrawableUtil.getRectLineDrawable("icon/select.9.png");
    debug();
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    EditorManager.getInstance().getEventBus().register(this);
    font = EditorManager.getInstance().getMainFont();
    this.addListener(clickListener);
    this.addCaptureListener(selectListener);
    this.addActor(selectedGroup);
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:14,代碼來源:MainWindow.java

示例5: show

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void show() {
    renderer = new ShapeRenderer();
    renderer.setAutoShapeType(true);
    batch = new SpriteBatch();

    hud = new Hud();
    Pathway pathway = new Pathway(match.getTiles(), match.getPlayer());
    manager = new Manager(pathway);
    grabber = new Grabber(match.getTiles(), match.getCam(), manager, pathway, match.getPlayer());

    Gdx.input.setInputProcessor(new InputMultiplexer(manager.getStage(), grabber, match.getStage()));
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:14,代碼來源:MatchScreen.java

示例6: drawPath

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public static void drawPath(ArrayList<Node> path , ShapeRenderer sr , OrthographicCamera camera){
	sr.setAutoShapeType(true);
	sr.setProjectionMatrix(camera.combined);
	sr.begin();
	for(Node node : path){
		Vector2 start = node.getParent() != null ? node.getParent().getCordinates().cpy().scl(32) : LevelManager.tileSpawn.getTileCenter();
		sr.setColor(Color.WHITE);
		sr.set(ShapeType.Line);
		sr.line(start , node.getCordinates().cpy().scl(32));
	}
	sr.end();
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:13,代碼來源:PathFinder.java

示例7: TowerSelectionSystem

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public TowerSelectionSystem(EntityFactory factory , OrthographicCamera gameCam) {
	super(Families.TOWER);
	_gameCam = gameCam;
	player = factory.getPlayer();
	_shapeRenderer = new ShapeRenderer();
	_shapeRenderer.setAutoShapeType(true);
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:8,代碼來源:TowerSelectionSystem.java

示例8: create

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void create () {

	loadHighScore();
	stage = new Stage();
	group = new WidgetGroup();
	stage.addActor(group);
	createToolTip();
	createResetButton();
	createUndoButton();
	batch = new SpriteBatch();
	polyBatch = new PolygonSpriteBatch();

	HexagonalGridBuilder<TileData> builder = new HexagonalGridBuilder<TileData>()
			.setGridHeight(GRID_WIDTH)
			.setGridWidth(GRID_HEIGHT)
			.setGridLayout(HexagonalGridLayout.HEXAGONAL)
			.setOrientation(HexagonOrientation.FLAT_TOP)
			.setRadius(Gdx.graphics.getWidth()/16);

	grid = builder.build();
	initHexData();
	initInput();
	shapeRenderer = new ShapeRenderer();
	shapeRenderer.setAutoShapeType(true);

	AssetLoader.load();

	String vertexShader = Gdx.files.internal("defaultvertex.vs").readString();
	String redShader = Gdx.files.internal("redtrans.fs").readString();
	invalidPlacement = new ShaderProgram(vertexShader, redShader);
	if (!invalidPlacement.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + invalidPlacement.getLog());

	String okShader = Gdx.files.internal("slightlytrans.fs").readString();
	okPlacement = new ShaderProgram(vertexShader, okShader);
	if (!okPlacement.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + okPlacement.getLog());

	initGrid();

	menuTextures = new ArrayList<>();
	menuTextures.add(AssetLoader.assetManager.get("farm.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("house.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("mine.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("wind.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("factory.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("market.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("bank.png", Texture.class));
	menuTextures.add(AssetLoader.assetManager.get("rocket.png", Texture.class));

	for(int i = 0; i < START_CLOUDS_COUNT; i++)
	{
		Coord c = new Coord();
		c.x = r.nextInt() % Gdx.graphics.getWidth();
		c.y = r.nextInt() % Gdx.graphics.getHeight();
		clouds.add(c);
	}
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:58,代碼來源:LudumDare38.java

示例9: initialize

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
private void initialize() {
    //LibGDX setup
    camera = new OrthographicCamera();
    viewPort = new FitViewport(256, 240, camera);
    viewPort.apply();
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    //Initialize shaders
    vertexShader = Gdx.files.internal("shaders/vertex_shader.glsl").readString();
    fragmentShader = Gdx.files.internal("shaders/fragment_shader.glsl").readString();
    shaderProgram = new ShaderProgram(vertexShader, fragmentShader);

    //Initialize attribute value (used by fragmentShader)
    initializeAttributes();

    //Make the mouse cursor transparent
    Pixmap pixmap = new Pixmap(16, 16, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.argb8888(0, 0, 0, 0));
    pixmap.fill();
    Gdx.graphics.setCursor(Gdx.graphics.newCursor(pixmap, 0, 0));
    pixmap.dispose();

    //Initialize transparent mask sprite
    transparentMaskPixmap = new Pixmap(8, 8, Pixmap.Format.RGBA8888);
    transparentMaskPixmap.setColor(Color.CLEAR);
    transparentMaskPixmap.fill();
    transparentMaskTexture = new Texture(transparentMaskPixmap);
    transparentMaskSprite = new Sprite(transparentMaskTexture);

    //Initialize main frame buffer
    FrameBuffer.FrameBufferBuilder frameBufferBuilder = new FrameBuffer.FrameBufferBuilder(256, 240);
    frameBufferBuilder.addBasicColorTextureAttachment(Pixmap.Format.RGBA8888);
    mainFrameBuffer = frameBufferBuilder.build();

    mainTextureRegion = new TextureRegion(mainFrameBuffer.getColorBufferTexture(), 0, 0,
            256, 240);
    mainTextureRegion.flip(false, true);
    mainTextureRegion.getTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    //Initialize special frame buffer for foreground sprites so
    //we can hide them with fake background sprites
    foregroundSpritesFrameBuffer = frameBufferBuilder.build();
    foregroundSpritesTextureRegion = new TextureRegion(foregroundSpritesFrameBuffer.getColorBufferTexture(), 0, 0,
            256, 240);
    foregroundSpritesTextureRegion.flip(false, true);
    foregroundSpritesTextureRegion.getTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    //Initialize palette information
    palettePixmap = new Pixmap(32, 1, Pixmap.Format.RGBA8888);
    paletteTexture = new Texture(palettePixmap);
    masterPalette = loadPalette("palette/nespalette.bmp", 1, 1, 32, 32, 16, 4);
}
 
開發者ID:gradualgames,項目名稱:ggvm,代碼行數:55,代碼來源:RenderManager.java

示例10: show

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
    public void show() {


        batch = new SpriteBatch();

        viewport = new FitViewport(Constants.DIFFICULTY_WORLD_SIZE_WIDTH, Constants.DIFFICULTY_WORLD_SIZE_HEIGHT);
        renderer = new ShapeRenderer();
        renderer.setAutoShapeType(true);


        stage = new Stage(viewport);
        Gdx.input.setInputProcessor(stage);
        Skin uiSkin = new Skin(Gdx.files.internal("UiSkin/uiskin.json"));
        button = new TextButton(menucontinue, uiSkin);

        TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
        textButtonStyle.font = font12;
        textButtonStyle.up = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.down = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.checked = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.over = uiSkin.newDrawable("white", Color.DARK_GRAY);
        button.setStyle(textButtonStyle);

        imageLogo = new Image();
        imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Star.png")))));


        /*container=new Container<Image>(imageLogo);
        container.setTransform(true);   // for enabling scaling and rotation
        container.size(100, 100);
        container.setOrigin(Align.center);//container.getWidth() / 2, container.getHeight() / 2);
        container.setPosition(100,100);
        container.setScale(1);  //scale according to your requirement
*/


        Table table = new Table();
        table.setFillParent(true);
        table.add(imageLogo);
        table.row();
        table.add(button).width(450).height(300).pad(10);
        table.row();

        stage.addActor(table);
        //container.addAction(Actions.parallel(/*Actions.moveTo(500, 300, 2.0f),*/Actions.rotate(1.f,1.0f)));//Actions.scaleTo(0.1f, 0.1f,2.0f)));

        button.addListener(new ChangeListener() {
            public void changed (ChangeEvent event, Actor actor) {

                if(!victory || (victory && level == maxNumLevels))
                    game.ShowMenuScreen();
                else
                    game.ShowSuperBullScreen(level +1);

            }
        });





    }
 
開發者ID:luarca84,項目名稱:Caramelos,代碼行數:64,代碼來源:StatusScreen.java

示例11: show

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void show() {
    batch = new SpriteBatch();
    Skin uiSkin = new Skin(Gdx.files.internal("UiSkin/uiskin.json"));

    Preferences prefs = Gdx.app.getPreferences("MyPreferences");
    flagSound = prefs.getBoolean("sound");
    mp3Music = Gdx.audio.newMusic(Gdx.files.internal("Music/Intro.mp3"));
    mp3Music.setLooping(true);
    if(flagSound){
        mp3Music.play();
    }

    viewport = new FitViewport(Constants.DIFFICULTY_WORLD_SIZE_WIDTH, Constants.DIFFICULTY_WORLD_SIZE_HEIGHT);
    renderer = new ShapeRenderer();
    renderer.setAutoShapeType(true);

    Gdx.input.setInputProcessor(this);

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("Vollkorn/Vollkorn-Regular.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 24;
    BitmapFont font12 = generator.generateFont(parameter); // font size 12 pixels
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    FileHandle baseFileHandle = Gdx.files.internal("Messages/menus");
    String localeLanguage =java.util.Locale.getDefault().toString();
    Locale locale = new Locale(localeLanguage);
    I18NBundle myBundle = I18NBundle.createBundle(baseFileHandle, locale,"UTF-8");
    String menuabout = myBundle.get("menuabout");
    String menudevelopers = myBundle.get("menudevelopers");

    stage = new Stage(viewport);
    Label label = new Label(menuabout,uiSkin);
    Label label2 = new Label("\n"+menudevelopers+":\nluarca84\n" +
            "laibach" ,uiSkin);
    label2.setAlignment(Align.center);
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = font12;
    label2.setStyle(labelStyle);
    label.setStyle(labelStyle);

    Texture texture = new Texture("android_libgdx.png");
    TextureRegion textureRegion = new TextureRegion(texture);
    Image image = new Image(textureRegion);

    Table tableParent = new Table();
    tableParent.setFillParent(true);
    Table table = new Table();
    table.add(label);
    table.row();
    table.add(label2);
    table.row();

    tableParent.add(table);
    tableParent.row();
    tableParent.add(image).width(450);
    stage.addActor(tableParent);

}
 
開發者ID:luarca84,項目名稱:Caramelos,代碼行數:61,代碼來源:AboutScreen.java


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