<commit_before>//client main file
var socket = undefined;

$(document).ready(function() {
    initSocket();
});

function initSocket() {
    socket = io();

    socket.on('initGame', function(data) {
        //TODO: initalize game area and draw start objects
    });

    socket.on('gameObjectReceived', function(data) {
        //TODO: draw game out of objects
    });

    socket.on('counter', function(data) {
        //TODO: draw counter
    });

    socket.on('goal', function(data) {
        //TODO: play goal animation
    });
}

function onKeyDown() {
    //TODO: if up or down pressed tell server what key is pressed
    //socket.send('key', data);
}<commit_msg>add: createjs stage, shapes and basic event<commit_after>//client main file
var socket = undefined;
var stage;
var width, height;
var rect_player1, rect_player2, cir_ball;
var btn_search, btn_ready;
var txt_status, txt_score, txt_name1, txt_name2;
var playerHeight, playerWidth;


$(document).ready(function() {
    initStage();
    initSocket();
});

function initStage() {
    stage = new createjs.Stage('gameCanvas');
    stage.canvas.style.background = "#ffffff";
    width = stage.canvas.width;
    height = stage.canvas.height;
    //create objects to draw game
    rect_player1 = new createjs.Shape();
    rect_player1.x = playerWidth * 2;
    rect_player1.y = height / 2 - playerHeight / 2;
    rect_player1.graphics.beginFill("#000000").drawRect(0, 0, playerWidth, playerHeight);
    rect_player2 = new createjs.Shape();
    rect_player2.x = width - playerWidth * 2;
    rect_player2.y = height / 2 - playerHeight / 2;
    rect_player2.graphics.beginFill("#000000").drawRect(0, 0, playerWidth, playerHeight);
    rect_ball = new createjs.Shape();
    rect_ball.x = width / 2;
    rect_ball.y = height / 2;
    rect_ball.graphics.beginFill("#000000").drawCirecle(0, 0, 10);
    btn_search = new createjs.Shape();
    btn_search.x = 0;
    btn_search.y = 0;
    btn_search.graphics.beginFill("#ff0000").drawRect(0, 0, 200, 50);
    btn_ready = new createjs.Shape();
    btn_ready.x = 0;
    btn_ready.y = 0;
    btn_ready.graphics.beginFill("#ff0000").drawRect(0, 0, 200, 50);
    txt_status = new createjs.Text(); //waiting for player or wait till player is ready or start search
    txt_status.set({
        text: "Start Search For Opponent",
        font: "12px Arial",
        color: "#000000",
        x: 0,
        y: 0
    });
    txt_score = new createjs.Text(); //score of player one : score of player two
    txt_score.set({
        text: "0 : 0",
        font: "12px Arial",
        color: "#000000",
        x: 0,
        y: 0
    });
    txt_name1 = new createjs.Text(); //name of player one
    txt_name1.set({
        text: "Name1",
        font: "12px Arial",
        color: "#000000",
        x: 0,
        y: 0
    });
    txt_name2 = new createjs.Text(); //name of player two
    txt_name2.set({
        text: "Name2",
        font: "12px Arial",
        color: "#000000",
        x: 0,
        y: 0
    });
}

function initSocket() {
    socket = io();

    socket.on('initGame', function(data) {
        //TODO: initalize game area and draw start objects
    });

    socket.on('gameObjectReceived', function(data) {
        //TODO: draw game out of objects
    });

    socket.on('counter', function(data) {
        //TODO: draw counter
    });

    socket.on('goal', function(data) {
        //TODO: play goal animation
    });
}

function onKeyDown(e) {
    //TODO: if up or down pressed tell server what key is pressed
    if (e.keyCode == "38" || e.keyCode == "40") { //up = 38, down = 40
        var data = undefined;
        data.key = e.keyCode;
        socket.emit('keyDown', data);
    }
}
{'fraction_non_alphanumeric': 0.1427798810167658, 'fraction_numerical': 0.03461330448891293, 'mean_word_length': 2.5739130434782607, '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': '4800910', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1187, 'n_words': 328}