<commit_before>#include "p2Defs.h"
#include "p2Log.h"
#include "j1App.h"
#include "j1Input.h"
#include "j1Textures.h"
#include "j1Audio.h"
#include "j1Render.h"
#include "j1Window.h"
#include "j1Map.h"
#include "j1PathFinding.h"
#include "j1Gui.h"
#include "j1GuiEntity.h"
#include "j1GuiElements.h"
#include "j1Scene.h"
#include "j1Enemy.h"
#include "j1Player.h"
#include "j1FileSystem.h"

j1Scene::j1Scene() : j1Module()
{
	name="scene";
}

// Destructor
j1Scene::~j1Scene()
{}

// Called before render is available
bool j1Scene::Awake()
{
	LOG("Loading Scene");
	bool ret = true;
	return ret;
}

// Called before the first frame
bool j1Scene::Start()
{
	//UI
	charge = App->gui->CreateImage({ 20,18,16,42 }, { 20,18 });
	item = App->gui->CreateImage({ 37,20,22,22 }, { 37,20 });
	gems = App->gui->CreateImage({ 72,15,8,8 }, { 72,15 });
	woaw = App->gui->CreateDialogue({ 50,500 }, "Hi Link! Whatsapp Bro?");
	woaw->AddLine("-Ameisin");

	//Create First level
	player = App->entity_elements->CreatePlayer(iPoint(100, 90));
	App->map->Load("TiledLinkHouse.tmx");
	App->render->camera.x = -((player->position.x - (256 / 2)) * 2);//TODO LOW -> No Magic Numbers
	App->render->camera.y = -((player->position.y - (224 / 2)) * 2);

	//Load_new_map(1);
	switch_map = 0;
	return true;
}

// Called each loop iteration
bool j1Scene::PreUpdate()
{



	return true;
}

// Called each loop iteration
bool j1Scene::Update(float dt)
{
	App->map->Draw();
	if (App->input->GetKey(SDL_SCANCODE_LCTRL) == KEY_REPEAT)
	{
		//TODO LOW -> Directions + and - Inverse?? 
		if (App->input->GetKey(SDL_SCANCODE_LEFT) == KEY_REPEAT)
			App->render->camera.x += 2;
		if (App->input->GetKey(SDL_SCANCODE_DOWN) == KEY_REPEAT)
			App->render->camera.y -= 2;
		if (App->input->GetKey(SDL_SCANCODE_UP) == KEY_REPEAT)
			App->render->camera.y += 2;
		if (App->input->GetKey(SDL_SCANCODE_RIGHT) == KEY_REPEAT)
			App->render->camera.x -= 2;
	}

	if (enemy.size() > 0 && enemy.begin()._Ptr->_Myval != NULL)//TODO HIGH -> when enemy die on put this code?
	{
		if (enemy.begin()._Ptr->_Myval->hp == 0)
		{
			items.push_back(App->entity_elements->CreateItem(iPoint(300, 200), 1));
			enemy.begin()._Ptr->_Myval->AddItem(items.begin()._Ptr->_Myval);
			enemy.begin()._Ptr->_Myval->Drop_item();
			App->entity_elements->DeleteEnemy(enemy.begin()._Ptr->_Myval);
			enemy.begin()._Ptr->_Myval = NULL;
		}
	}


	if (switch_map == 2)
	{
		//TODO need destroy all enemies and items
		if (App->map->CleanUp())
		{
			Load_new_map(2);
			dynitems.push_back(App->entity_elements->CreateDynItem(iPoint(176, 245), 3));
			dynitems.push_back(App->entity_elements->CreateDynItem(iPoint(224, 273), 4));<commit_msg>Delete Comment Todo<commit_after>#include "p2Defs.h"
#include "p2Log.h"
#include "j1App.h"
#include "j1Input.h"
#include "j1Textures.h"
#include "j1Audio.h"
#include "j1Render.h"
#include "j1Window.h"
#include "j1Map.h"
#include "j1PathFinding.h"
#include "j1Gui.h"
#include "j1GuiEntity.h"
#include "j1GuiElements.h"
#include "j1Scene.h"
#include "j1Enemy.h"
#include "j1Player.h"
#include "j1FileSystem.h"

j1Scene::j1Scene() : j1Module()
{
	name="scene";
}

// Destructor
j1Scene::~j1Scene()
{}

// Called before render is available
bool j1Scene::Awake()
{
	LOG("Loading Scene");
	bool ret = true;
	return ret;
}

// Called before the first frame
bool j1Scene::Start()
{
	//UI
	charge = App->gui->CreateImage({ 20,18,16,42 }, { 20,18 });
	item = App->gui->CreateImage({ 37,20,22,22 }, { 37,20 });
	gems = App->gui->CreateImage({ 72,15,8,8 }, { 72,15 });
	woaw = App->gui->CreateDialogue({ 50,500 }, "Hi Link! Whatsapp Bro?");
	woaw->AddLine("-Ameisin");

	//Create First level
	player = App->entity_elements->CreatePlayer(iPoint(100, 90));
	App->map->Load("TiledLinkHouse.tmx");
	App->render->camera.x = -((player->position.x - (256 / 2)) * 2);//TODO LOW -> No Magic Numbers
	App->render->camera.y = -((player->position.y - (224 / 2)) * 2);

	//Load_new_map(1);
	switch_map = 0;
	return true;
}

// Called each loop iteration
bool j1Scene::PreUpdate()
{



	return true;
}

// Called each loop iteration
bool j1Scene::Update(float dt)
{
	App->map->Draw();
	if (App->input->GetKey(SDL_SCANCODE_LCTRL) == KEY_REPEAT)
	{
		if (App->input->GetKey(SDL_SCANCODE_LEFT) == KEY_REPEAT)
			App->render->camera.x += 2;
		if (App->input->GetKey(SDL_SCANCODE_DOWN) == KEY_REPEAT)
			App->render->camera.y -= 2;
		if (App->input->GetKey(SDL_SCANCODE_UP) == KEY_REPEAT)
			App->render->camera.y += 2;
		if (App->input->GetKey(SDL_SCANCODE_RIGHT) == KEY_REPEAT)
			App->render->camera.x -= 2;
	}

	if (enemy.size() > 0 && enemy.begin()._Ptr->_Myval != NULL)//TODO HIGH -> when enemy die on put this code?
	{
		if (enemy.begin()._Ptr->_Myval->hp == 0)
		{
			items.push_back(App->entity_elements->CreateItem(iPoint(300, 200), 1));
			enemy.begin()._Ptr->_Myval->AddItem(items.begin()._Ptr->_Myval);
			enemy.begin()._Ptr->_Myval->Drop_item();
			App->entity_elements->DeleteEnemy(enemy.begin()._Ptr->_Myval);
			enemy.begin()._Ptr->_Myval = NULL;
		}
	}


	if (switch_map == 2)
	{
		//TODO need destroy all enemies and items
		if (App->map->CleanUp())
		{
			Load_new_map(2);
			dynitems.push_back(App->entity_elements->CreateDynItem(iPoint(176, 245), 3));
			dynitems.push_back(App->entity_elements->CreateDynItem(iPoint(224, 273), 4));
{'fraction_non_alphanumeric': 0.1993946273174423, 'fraction_numerical': 0.04199772985244041, 'mean_word_length': 4.318913480885312, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 128, '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': '723596', 'n_tokens_mistral': 2350, 'n_tokens_neox': 2117, 'n_words': 384}