<commit_before>/*global me: true, game: true */
game.TitleScreen = me.ScreenObject.extend({
    onResetEvent: function() {
        // me.input.bindKey(me.input.KEY.ENTER, 'enter', true);
        // me.input.bindPointer(me.input.mouse.LEFT, me.input.KEY.ENTER);
        // this.handler = me.event.subscribe(me.event.KEYDOWN, function (action) {
        //     if (action === "enter") {
        //         me.state.change(me.state.PLAY);
        //     }
        // });
        // Load title background
        me.game.world.addChild(
            new me.ImageLayer("background01-960x640", 0, 0, "background01-960x640"),
            0 // z-index
        );

        // Load title foreground
        me.game.world.addChild(
            new me.ImageLayer("foreground01-960x640", 0, 0, "foreground01-960x640"),
            1 // z-index
        );

        // Load title image
        me.game.world.addChild(
            new game.HUD.GUI_Button({
                "image" : "title",
                centerX: true,
                y: 80
            }),
            //new me.ImageLayer("title", 200, 0, "title"),
            //new me.SpriteObject((960 / 2) - (602 / 2), (640 / 2) - (306 / 2), me.loader.getImage("title")),
            2 // z-index
        );

        me.game.world.addChild(
            new game.HUD.GUI_Button({
                "image" : "bt01big",
                "subimage" : "aplaytext",
                centerX: true,
                y: 440,
                "onClick" : function () {
                    me.state.change(me.state.PLAY);
                    return true;
                }
            }),
            3 // z-index
        );
    },

    update: function () {
        if (me.input.isKeyPressed('enter')) {
            me.state.change(me.state.PLAY);
        }
        return true;
    },

    onDestroyEvent : function () {
        // me.input.unbindKey(me.input.KEY.ENTER);
        // me.input.unbindPointer(me.input.mouse.LEFT);
        // me.event.unsubscribe(this.handler);
    }
});<commit_msg>Added Enter key to enter the game<commit_after>/*global me: true, game: true */
game.TitleScreen = me.ScreenObject.extend({
    onResetEvent: function() {
        // me.input.bindKey(me.input.KEY.ENTER, 'enter', true);
        // me.input.bindPointer(me.input.mouse.LEFT, me.input.KEY.ENTER);
        // this.handler = me.event.subscribe(me.event.KEYDOWN, function (action) {
        //     if (action === "enter") {
        //         me.state.change(me.state.PLAY);
        //     }
        // });
        // Load title background
        me.game.world.addChild(
            new me.ImageLayer("background01-960x640", 0, 0, "background01-960x640"),
            0 // z-index
        );

        // Load title foreground
        me.game.world.addChild(
            new me.ImageLayer("foreground01-960x640", 0, 0, "foreground01-960x640"),
            1 // z-index
        );

        // Load title image
        me.game.world.addChild(
            new game.HUD.GUI_Button({
                "image" : "title",
                centerX: true,
                y: 80
            }),
            //new me.ImageLayer("title", 200, 0, "title"),
            //new me.SpriteObject((960 / 2) - (602 / 2), (640 / 2) - (306 / 2), me.loader.getImage("title")),
            2 // z-index
        );

        me.game.world.addChild(
            new game.HUD.GUI_Button({
                "image" : "bt01big",
                "subimage" : "aplaytext",
                centerX: true,
                y: 440,
                "onClick" : function () {
                    me.state.change(me.state.PLAY);
                    return true;
                }
            }),
            3 // z-index
        );

        // change to play state on press Enter or click/tap
        me.input.bindKey(me.input.KEY.ENTER, "enter", true);
        this.handler = me.event.subscribe(me.event.KEYDOWN, function (action, keyCode, edge) {
            if (action === "enter") {
                // play something on tap / enter
                // this will unlock audio on mobile devices
                me.audio.play("cling");
                me.state.change(me.state.PLAY);
            }
        });
    },

    update: function () {
        if (me.input.isKeyPressed('enter')) {
            me.state.change(me.state.PLAY);
        }
        return true;
    },

    onDestroyEvent : function () {
        me.input.unbindKey(me.input.KEY.ENTER);
        // me.input.unbindPointer(me.input.mouse.LEFT);
        me.event.unsubscribe(this.handler);
    }
});
{'fraction_non_alphanumeric': 0.15, 'fraction_numerical': 0.029515418502202642, 'mean_word_length': 1.3787323205866946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4359117', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1336, 'n_words': 247}