Search in sources :

Example 56 with SpriteBatch

use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project Alkahest-Coffee by AlkahestDev.

the class fakeMainGame method create.

@Override
public void create() {
    viewport = new FitViewport(1080, 720, new PerspectiveCamera());
    batch = new SpriteBatch();
    img = new Texture("badAlkahest.png");
    // Creating the menu
    menu.create(MenuState.MAIN);
    Gdx.input.setInputProcessor(menu);
}
Also used : SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Example 57 with SpriteBatch

use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project myFirstGame by Juicebox47.

the class MyFirstGame method create.

@Override
public void create() {
    spriteBatch = new SpriteBatch();
    gameStateManager = new GameStateManager(new Stack<State>(), new OrthographicCamera(), new Vector3());
    Gdx.gl.glClearColor(0, 0, 0, 0);
    gameStateManager.push(new MenuState(gameStateManager));
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) Vector3(com.badlogic.gdx.math.Vector3) MenuState(com.mygdx.game.states.MenuState) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) GameStateManager(com.mygdx.game.states.GameStateManager) Stack(java.util.Stack)

Example 58 with SpriteBatch

use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project gdx-skineditor by cobolfoo.

the class SkinEditorGame method create.

@Override
public void create() {
    opt = new OptionalChecker();
    fm = new SystemFonts();
    fm.refreshFonts();
    // Create projects folder if not already here
    FileHandle dirProjects = new FileHandle("projects");
    if (dirProjects.isDirectory() == false) {
        dirProjects.mkdirs();
    }
    // Rebuild from raw resources, kind of overkill, might disable it for production
    TexturePacker.Settings settings = new TexturePacker.Settings();
    settings.combineSubdirectories = true;
    TexturePacker.process(settings, "resources/raw/", ".", "resources/uiskin");
    batch = new SpriteBatch();
    skin = new Skin();
    atlas = new TextureAtlas(Gdx.files.internal("resources/uiskin.atlas"));
    skin.addRegions(new TextureAtlas(Gdx.files.local("resources/uiskin.atlas")));
    skin.load(Gdx.files.local("resources/uiskin.json"));
    screenMain = new MainScreen(this);
    screenWelcome = new WelcomeScreen(this);
    setScreen(screenWelcome);
}
Also used : WelcomeScreen(org.shadebob.skineditor.screens.WelcomeScreen) FileHandle(com.badlogic.gdx.files.FileHandle) TextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) TexturePacker(com.badlogic.gdx.tools.texturepacker.TexturePacker) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) MainScreen(org.shadebob.skineditor.screens.MainScreen)

Example 59 with SpriteBatch

use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.

the class FreeTypeMetricsTest method create.

@Override
public void create() {
    spriteBatch = new SpriteBatch();
    atlas = new TextureAtlas("data/pack");
    smallFont = new BitmapFont();
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 60;
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/arial.ttf"));
    font = generator.generateFont(parameter);
    generator.dispose();
    renderer = new ShapeRenderer();
    renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
}
Also used : FreeTypeFontGenerator(com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator) FreeTypeFontParameter(com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter) TextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) ShapeRenderer(com.badlogic.gdx.graphics.glutils.ShapeRenderer)

Example 60 with SpriteBatch

use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.

the class FreeTypePackTest method create.

@Override
public void create() {
    camera = new OrthographicCamera();
    batch = new SpriteBatch();
    long start = System.currentTimeMillis();
    int glyphCount = createFonts();
    long time = System.currentTimeMillis() - start;
    text = glyphCount + " glyphs packed in " + regions.size + " page(s) in " + time + " ms";
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

Aggregations

SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)121 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)64 Texture (com.badlogic.gdx.graphics.Texture)59 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)32 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)22 ShapeRenderer (com.badlogic.gdx.graphics.glutils.ShapeRenderer)16 Pixmap (com.badlogic.gdx.graphics.Pixmap)15 AssetManager (com.badlogic.gdx.assets.AssetManager)13 Stage (com.badlogic.gdx.scenes.scene2d.Stage)13 OrthoCamController (com.badlogic.gdx.tests.utils.OrthoCamController)13 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)11 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)10 InputAdapter (com.badlogic.gdx.InputAdapter)9 PerspectiveCamera (com.badlogic.gdx.graphics.PerspectiveCamera)9 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)8 InternalFileHandleResolver (com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver)7 ModelBatch (com.badlogic.gdx.graphics.g3d.ModelBatch)7 ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)7 ShaderProgram (com.badlogic.gdx.graphics.glutils.ShaderProgram)7 Vector2 (com.badlogic.gdx.math.Vector2)7