<commit_before>package com.github.dreamsnatcher.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.github.dreamsnatcher.entities.*;
import com.github.dreamsnatcher.utils.Assets;

/**
 * Created by badlogic on 17/04/15.
 */
public class EditorScreen extends Screen {
    Skin skin;
    Stage stage;
    SpriteBatch batch;

    EditorController controller;
    ShapeRenderer renderer;


    public EditorScreen(ScreenManager manager) {
        super(manager);
        batch = new SpriteBatch();
        renderer = new ShapeRenderer();

        Assets.init();
        initUI();
        controller = new EditorController();

        ScreenManager.multiplexer.addProcessor(stage);
        ScreenManager.multiplexer.addProcessor(controller);
    }

    private void initUI() {
        stage = new Stage();

        skin = new Skin(Gdx.files.internal("editor/uiskin.json"));

        Table root = new Table();
        root.setFillParent(true);
        stage.addActor(root);

        root.top().pad(5).defaults().space(5);

        TextButton button = new TextButton("New", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.newWorld();
            }
        });

        button = new TextButton("Save", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.saveWorld();
            }
        });

        button = new TextButton("Load", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.loadWorld();
            }
        });

        button = new TextButton("Return to Main Menu", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                ScreenManager.multiplexer.removeProcessor(stage);
                ScreenManager.multiplexer.removeProcessor(controller);
                manager.setScreen(new MainMenuScreen(manager));
            }
        });
        root.row();
        button = new TextButton("Planet", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(Planet.class);
            }
        });

        button = new TextButton("Planet Bonus", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(PlanetBonus.class);
            }
        });

        button = new TextButton("Planet Bonus (rotating)", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(PlanetBonusRotating.class);
            }
        });

        button = new TextButton("Planet (rotating)", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(PlanetRotating.class);
            }
        });

        button = new TextButton("Spacebar", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(Spacebar.class);
            }
        });

        button = new TextButton("Asteroid", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(Asteroid.class);
            }
        });

        button = new TextButton("Asteroid (moving)", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.place(AsteroidRotating.class);
            }
        });
        button = new TextButton("Spaceship", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.camera.position.set(controller.world.spaceShip.position.x, controller.world.spaceShip.position.y, 0);
            }
        });

    }

    @Override
    public void render () {
        stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
        stage.draw();
<commit_msg>Generalise Editoractionbuttons, just add the class to the list now<commit_after>package com.github.dreamsnatcher.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.github.dreamsnatcher.entities.*;
import com.github.dreamsnatcher.utils.Assets;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by badlogic on 17/04/15.
 */
public class EditorScreen extends Screen {
    Skin skin;
    Stage stage;
    SpriteBatch batch;

    EditorController controller;
    ShapeRenderer renderer;


    public EditorScreen(ScreenManager manager) {
        super(manager);
        batch = new SpriteBatch();
        renderer = new ShapeRenderer();

        Assets.init();
        initUI();
        controller = new EditorController();

        ScreenManager.multiplexer.addProcessor(stage);
        ScreenManager.multiplexer.addProcessor(controller);
    }

    private void initUI() {
        stage = new Stage();

        skin = new Skin(Gdx.files.internal("editor/uiskin.json"));

        Table root = new Table();
        root.setFillParent(true);
        stage.addActor(root);

        root.top().pad(5).defaults().space(5);

        TextButton button = new TextButton("New", skin);
        root.add(button).colspan(2);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.newWorld();
            }
        });

        button = new TextButton("Save", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.saveWorld();
            }
        });

        button = new TextButton("Load", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.loadWorld();
            }
        });

        button = new TextButton("Return to Main Menu", skin);
        root.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                ScreenManager.multiplexer.removeProcessor(stage);
                ScreenManager.multiplexer.removeProcessor(controller);
                manager.setScreen(new MainMenuScreen(manager));
            }
        });

        Table actions = new Table();
        actions.setFillParent(true);
        stage.addActor(actions);

        actions.left().pad(5).defaults().space(5);

        List<Class> classes = new ArrayList<Class>();
        classes.add(Planet.class);
        classes.add(PlanetRotating.class);
        classes.add(PlanetBonus.class);
        classes.add(PlanetBonusRotating.class);
        classes.add(Asteroid.class);
        classes.add(AsteroidRotating.class);
        classes.add(Spacebar.class);

        for(final Class clazz : classes){
            actions.row().left();
            button = new TextButton(clazz.getSimpleName(), skin);
            actions.add(button);
            button.addListener(new ChangeListener() {
                public void changed(ChangeEvent event, Actor actor) {
                    controller.place(clazz);
                }
            });
        }

        actions.row().left();
        button = new TextButton("Spaceship", skin);
        actions.add(button);
        button.addListener(new ChangeListener() {
            public void changed(ChangeEvent event, Actor actor) {
                controller.camera.position.set(controller.world.spaceShip.position.x, controller.world.spaceShip.position.y, 0);
            }
        });

    }

    @Override
    public void render () {
        stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
        stage.draw();

{'fraction_non_alphanumeric': 0.1133015368309486, 'fraction_numerical': 0.004345521992580816, 'mean_word_length': 2.3155305692199577, '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': '5449287', 'n_tokens_mistral': 2667, 'n_tokens_neox': 2538, 'n_words': 491}