<commit_before>var include = function(file) {
    var args = 'type="text/javascript" src="' + file;
    document.write('<script '+args+'"></script>');
};

function inherit(a, b) {
    a.prototype = new b();
    a.prototype.constructor = a;
    return a;
}

include("b2Vec2.js");
include("Game.js");
include("FlyingObject.js");
include("World.js");
include("Obstacle.js");
include("Units.js");
include("Sprites.js");
include("ShootingModel.js");
include("Shell.js");
include("DamageModel.js");
include("MovementModel.js");
include("Timer.js");

window.onload = function(prog) {
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");
    
    this.keybindings = new KeyBindings();
    var game = new Game(canvas, this.keybindings);
    
    canvas.onmousemove = function(e) {
    };
    
    canvas.onmousedown = function(e) {
        if (e.button != 0) return;
        window.onkeydown({which: 16});
    };
    
    canvas.onmouseup = function(e) {
        if (e.button != 0) return;
        window.onkeyup({which: 16});
    };
    
    var interval = 10;
    var dt = interval/1000;
    
    setInterval(function() {
        loop(game, ctx, canvas, dt);
    }, interval);
};

var loop = function(game, ctx, canvas, dt) {
    game.step(dt);

    keybindings.step(dt);

    ctx.save();
    ctx.clearRect(0, 0, canvas.width, canvas.height);

    game.draw(ctx);

    ctx.restore();
};

+function(){
    var KeyBindings = function() {
        // down, up, during
        this.bindings = {}
        this.active_bindings = {}
    };
    this.KeyBindings = KeyBindings;
    var proto = KeyBindings.prototype;
    
    proto.enable = function(key, down, up, during) {
        this.bindings[key] = [down, up, during];
    };
    
    proto.disable = function(key) {
        delete this.bindings[key];
        delete this.active_bindings[key];
    };<commit_msg>I can't believe it took so long to fix this.<commit_after>var include = function(file) {
    var args = 'type="text/javascript" src="' + file;
    document.write('<script '+args+'"></script>');
};

function inherit(a, b) {
    a.prototype = new b();
    a.prototype.constructor = a;
    return a;
}

include("b2Vec2.js");
include("Game.js");
include("FlyingObject.js");
include("World.js");
include("Obstacle.js");
include("Units.js");
include("Sprites.js");
include("ShootingModel.js");
include("Shell.js");
include("DamageModel.js");
include("MovementModel.js");
include("Timer.js");

window.onload = function(prog) {
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");
    
    this.keybindings = new KeyBindings();
    var game = new Game(canvas, this.keybindings);
    
    canvas.onmousemove = function(e) {
    };
    
    canvas.onmousedown = function(e) {
        if (e.button != 0) return;
        window.onkeydown({which: 16});
    };
    
    canvas.onmouseup = function(e) {
        if (e.button != 0) return;
        window.onkeyup({which: 16});
    };
    
    var interval = 10;
    var dt = interval/1000;
    
    setInterval(function() {
        loop(game, ctx, canvas, dt);
    }, interval);
};

var loop = function(game, ctx, canvas, dt) {
    game.step(dt);

    keybindings.step(dt);

    ctx.save();
    ctx.clearRect(0, 0, canvas.width, canvas.height);

    game.draw(ctx);

    ctx.restore();
};

+function(){
    var KeyBindings = function() {
        // down, up, during
        this.bindings = {}
        this.active_bindings = {}
    };
    this.KeyBindings = KeyBindings;
    var proto = KeyBindings.prototype;
    
    proto.enable = function(key, down, up, during) {
        this.bindings[key] = [down, up, during];
    };
    
    proto.disable = function(key) {
        var active_binding = this.active_bindings[key];
        if (active_binding) { // if key is pressed
            if (active_binding[1])
                this.bindings[key][1](); // call up
        }
        delete this.bindings[key];
        delete this.active_bindings[key];
    };
{'fraction_non_alphanumeric': 0.1667913238593867, 'fraction_numerical': 0.008975317875841436, 'mean_word_length': 2.749532710280374, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7157600', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1312, 'n_words': 267}