<commit_before>/**
    * Declares all GameScenes: Splash Screen, Main Menu, Play, etc.
    *
    * Author: <NAME>
    * Date: 8/21/2013
    * File: GameScenes.cpp
**/

#include "GameScenes.h"

#include "IListener.h"

#include <lua.hpp>
#include "LuaBindings.h"

#include "PositionComponent.h"
#include "MovementComponent.h"
#include "ColliderComponent.h"
#include "CircleComponent.h"
#include "RectangleComponent.h"
#include "TextComponent.h"
#include "ScriptableBehavior.h"

#include "Entity.h"

#include "MovementSystem.h"
#include "CollisionSystem.h"
#include "BoundarySystem.h"
#include "RenderSystem.h"
#include "ScoringSystem.h"
#include "BehaviorSystem.h"

#include "AIControlSystem.h"

bool PlayScene::Load()
{
    RenderSystem* rs = new RenderSystem();
    MovementSystem* ms = new MovementSystem();
    CollisionSystem* cs = new CollisionSystem();
    BoundarySystem* bos = new BoundarySystem();
    ScoringSystem* ss = new ScoringSystem();
    BehaviorSystem* bs = new BehaviorSystem();
    AIControlSystem* as = new AIControlSystem();
    sm.Add(rs);
    sm.Add(ms);
    sm.Add(cs);
    sm.Add(ss);
    sm.Add(bos);
    sm.Add(bs);
    sm.Add(as);

    ef.Register("Position", []() { return new PositionComponent(); });
    ef.Register("Movement", []() { return new MovementComponent(); });
    ef.Register("Collider", []() { return new ColliderComponent(); });
    ef.Register("Circle", []() { return new CircleComponent(); });
    ef.Register("Rectangle", []() { return new RectangleComponent(); });
    ef.Register("Text", []() { return new TextComponent(); });

    rm.AddFont("resources/Corki-Regular.otf");

    ef.Create("scripts/ball.lua", 400, 300);
    ef.Create("scripts/paddle.lua", 0, this->GetWindow()->getSize().y / 2);
    ef.Create("scripts/ai_paddle.lua", this->GetWindow()->getSize().x - 10, this->GetWindow()->getSize().y / 2);
    return true;
}

void PlayScene::Update()
{
    sf::Event event;
    while(this->GetWindow()->pollEvent(event))
    {
        if(event.type == sf::Event::Closed)
        {
            ExitMessage msg;
            msg.ExitStatus = 0;
            Emit<ExitMessage>(msg);<commit_msg>Some testing<commit_after>/**
    * Declares all GameScenes: Splash Screen, Main Menu, Play, etc.
    *
    * Author: <NAME>
    * Date: 8/21/2013
    * File: GameScenes.cpp
**/

#include "GameScenes.h"

#include "IListener.h"

#include <lua.hpp>
#include "LuaBindings.h"

#include "PositionComponent.h"
#include "MovementComponent.h"
#include "ColliderComponent.h"
#include "CircleComponent.h"
#include "RectangleComponent.h"
#include "TextComponent.h"
#include "ScriptableBehavior.h"

#include "Entity.h"

#include "MovementSystem.h"
#include "CollisionSystem.h"
#include "BoundarySystem.h"
#include "RenderSystem.h"
#include "ScoringSystem.h"
#include "BehaviorSystem.h"

#include "AIControlSystem.h"

bool PlayScene::Load()
{
    RenderSystem* rs = new RenderSystem();
    MovementSystem* ms = new MovementSystem();
    CollisionSystem* cs = new CollisionSystem();
    BoundarySystem* bos = new BoundarySystem();
    ScoringSystem* ss = new ScoringSystem();
    BehaviorSystem* bs = new BehaviorSystem();
    AIControlSystem* as = new AIControlSystem();
    sm.Add(rs);
    sm.Add(ms);
    sm.Add(cs);
    sm.Add(ss);
    sm.Add(bos);
    sm.Add(bs);
    sm.Add(as);

    ef.Register("Position", []() { return new PositionComponent(); });
    ef.Register("Movement", []() { return new MovementComponent(); });
    ef.Register("Collider", []() { return new ColliderComponent(); });
    ef.Register("Circle", []() { return new CircleComponent(); });
    ef.Register("Rectangle", []() { return new RectangleComponent(); });
    ef.Register("Text", []() { return new TextComponent(); });

    rm.AddFont("resources/Corki-Regular.otf");

    ef.Create("scripts/ball.lua", this->GetWindow()->getSize().x / 2, this->GetWindow()->getSize().y / 2);
    ef.Create("scripts/paddle.lua", 0, this->GetWindow()->getSize().y / 2);
    ef.Create("scripts/ai_paddle.lua", this->GetWindow()->getSize().x - 10, this->GetWindow()->getSize().y / 2);

    PushEntityMessage msg;
    msg.ID = 0;
    msg.newVelocity.x = (rand() % 2) ? -7 : 7;
    msg.newVelocity.y = (rand() % 2) ? -4 : 4;
    Emit<PushEntityMessage>(msg);
    return true;
}

void PlayScene::Update()
{
    sf::Event event;
    while(this->GetWindow()->pollEvent(event))
    {
        if(event.type == sf::Event::Closed)
        {
            ExitMessage msg;
            msg.ExitStatus = 0;
            Emit<ExitMessage>(msg);
{'fraction_non_alphanumeric': 0.17813675591945122, 'fraction_numerical': 0.009072803717636645, 'mean_word_length': 3.728033472803347, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 30, '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': '7006785', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1503, 'n_words': 301}