<commit_before>package de.verygame.square.core;

import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
import com.badlogic.gdx.utils.viewport.Viewport;

/**
 * @author <NAME>
 *
 * Context which can contain several subscreens.
 */
public class SubScreenContext implements ScreenContext {

    /** List of subScreen's plus visibility flag */
    protected final ScreenSwitch screenSwitch;

    /** viewport of the screen (manages the glViewport) */
    protected final Viewport viewport;

    /** True if a subScreen is visible  */
    protected boolean showSubScreen = false;

    /**
     * Constructs a context with the given viewport.
     *
     * @param viewport viewport viewport of the screen
     */
    public SubScreenContext(Viewport viewport) {
        super();

        this.viewport = viewport;
        this.screenSwitch = new ScreenSwitch();
    }

    /**
     * Sets the batch of the context.
     *
     * @param polygonSpriteBatch batch
     */
    public void setBatch(PolygonSpriteBatch polygonSpriteBatch) {
        screenSwitch.setBatch(polygonSpriteBatch);
    }

    /**
     * Applies the viewport of the context. Calls {@link Viewport#apply(boolean)}.
     */
    public void applyViewport() {
        viewport.apply(true);
    }

    /**
     * Updates the viewport of the context. Calls {@link Viewport#update(int, int, boolean)}.
     *
     * @param width width of the frame
     * @param height height of the frame
     */
    public void updateViewport(int width, int height) {
        viewport.update(width, height, true);
    }

    public void update() {
        screenSwitch.updateSwitch();
        screenSwitch.updateScreen();
    }

    public void renderScreen() {
        if (showSubScreen) {
            screenSwitch.renderScreen();
        }
    }

    public void resizeSubScreen(int width, int height) {
        screenSwitch.resize(width, height);
    }

    public void pauseSubScreen() {
        screenSwitch.pause();
    }

    public void resumeSubScreen() {
        screenSwitch.resume();
    }

    public void dispose() {
        screenSwitch.dispose();
    }

    @Override
    public Viewport getViewport() {
        return viewport;
    }
<commit_msg>The projection matrix will be set in the screen context now.<commit_after>package de.verygame.square.core;

import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
import com.badlogic.gdx.utils.viewport.Viewport;

/**
 * @author <NAME>
 *
 * Context which can contain several subscreens.
 */
public class SubScreenContext implements ScreenContext {

    /** List of subScreen's plus visibility flag */
    protected final ScreenSwitch screenSwitch;

    /** viewport of the screen (manages the glViewport) */
    protected final Viewport viewport;

    /** True if a subScreen is visible  */
    protected boolean showSubScreen = false;

    /**
     * Constructs a context with the given viewport.
     *
     * @param viewport viewport viewport of the screen
     */
    public SubScreenContext(Viewport viewport) {
        super();

        this.viewport = viewport;
        this.screenSwitch = new ScreenSwitch();
    }

    /**
     * Sets the batch of the context.
     *
     * @param polygonSpriteBatch batch
     */
    public void setBatch(PolygonSpriteBatch polygonSpriteBatch) {
        screenSwitch.setBatch(polygonSpriteBatch);
    }

    /**
     * Applies the viewport of the context. Calls {@link Viewport#apply(boolean)}.
     */
    public void applyViewport() {
        viewport.apply(true);
    }

    /**
     * Updates the viewport of the context. Calls {@link Viewport#update(int, int, boolean)}.
     *
     * @param width width of the frame
     * @param height height of the frame
     */
    public void updateViewport(int width, int height) {
        viewport.update(width, height, true);
    }

    public void update() {
        screenSwitch.updateSwitch();
        screenSwitch.updateScreen();

        screenSwitch.getBatch().setProjectionMatrix(viewport.getCamera().combined);
    }

    public void renderScreen() {
        if (showSubScreen) {
            screenSwitch.renderScreen();
        }
    }

    public void resizeSubScreen(int width, int height) {
        screenSwitch.resize(width, height);
    }

    public void pauseSubScreen() {
        screenSwitch.pause();
    }

    public void resumeSubScreen() {
        screenSwitch.resume();
    }

    public void dispose() {
        screenSwitch.dispose();
    }

    @Override
    public Viewport getViewport() {
        return viewport;
    }

{'fraction_non_alphanumeric': 0.09714285714285714, 'fraction_numerical': 0.00043956043956043956, 'mean_word_length': 2.5061633281972266, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3997860', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1252, 'n_words': 349}