<commit_before>#include <math.h>
#include "j1Player.h"
#include "j1Enemy.h"
#include "j1Collision.h"
#include "j1Pathfinding.h"
#include "p2Log.h"
#include "j1GameStartMenuBack.h"
#include "S_MainMenu.h"
#include "j1App.h"
#include "j1Textures.h"
#include "j1Render.h"
#include "j1Window.h"
#include "j1Gui.h"
#include "GuiImage.h"
#include "GuiButton.h"
#include "j1Audio.h"
#include "j1InputManager.h"

j1GameStartMenuBackground::j1GameStartMenuBackground()
{
	name = "gamestartmenubackground";
}

j1GameStartMenuBackground::~j1GameStartMenuBackground()
{

}

// Called before render is available
bool j1GameStartMenuBackground::Awake(pugi::xml_node& conf)
{
	LOG("Loading Game Start Menu Background atlas");
	bool ret = true;

	atlas_file_name = conf.child("atlas").attribute("file").as_string("");

	return ret;
}

// Called before the first frame
bool j1GameStartMenuBackground::Start()
{
	App->audio->PlayMusic("audio/music/Intro_Song.ogg", 1);
	atlas = App->tex->Load(atlas_file_name.c_str());

	Background_Initial_pos = App->win->GetWindowH() - background.h;

	BackgroundCharacterList.push_back(new BackgroundCharacter(&LinkRect, { (int)App->win->GetWindowW(),0 }));
	BackgroundCharacterList.push_back(new BackgroundCharacter(&ZeldaRect, { BackgroundCharacterList.back()->position.x + BackgroundCharacterList.back()->rect.w + spacebetweenbackgroundcharacters,0 }));
	BackgroundCharacterList.push_back(new BackgroundCharacter(&MessengerRect, { BackgroundCharacterList.back()->position.x + BackgroundCharacterList.back()->rect.w + spacebetweenbackgroundcharacters,26 }));

	Background_timer.Start();

	return true;
}

// Called each loop iteration
bool j1GameStartMenuBackground::PreUpdate()
{
	/*
	if (App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN)
		App->WantToQuit();
	*/
	/**/
	if (App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN || (App->inputM->EventPressed(INPUTEVENT::PAUSE, 1) == EVENTSTATE::E_DOWN)) {
		ingamenushow = !ingamenushow;
		App->player->paused = !App->player->paused;
		App->enemy->paused = !App->enemy->paused;
		App->collision->paused = !App->collision->paused;
		App->pathfinding->paused = !App->pathfinding->paused;
	}
	if (((App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN)|| (App->inputM->EventPressed(INPUTEVENT::PAUSE, 1) == EVENTSTATE::E_DOWN)) && (ingamenushow))
	{
		

		App->scene->Show(Scene_ID::ingamemenu);
		Freeze(false);
	}
	if (((App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN) || (App->inputM->EventPressed(INPUTEVENT::PAUSE, 1) == EVENTSTATE::E_DOWN)) && (!ingamenushow))<commit_msg>minus changes of menu input<commit_after>#include <math.h>
#include "j1Player.h"
#include "j1Enemy.h"
#include "j1Collision.h"
#include "j1Pathfinding.h"
#include "p2Log.h"
#include "j1GameStartMenuBack.h"
#include "S_MainMenu.h"
#include "j1App.h"
#include "j1Textures.h"
#include "j1Render.h"
#include "j1Window.h"
#include "j1Gui.h"
#include "GuiImage.h"
#include "GuiButton.h"
#include "j1Audio.h"
#include "j1InputManager.h"

j1GameStartMenuBackground::j1GameStartMenuBackground()
{
	name = "gamestartmenubackground";
}

j1GameStartMenuBackground::~j1GameStartMenuBackground()
{

}

// Called before render is available
bool j1GameStartMenuBackground::Awake(pugi::xml_node& conf)
{
	LOG("Loading Game Start Menu Background atlas");
	bool ret = true;

	atlas_file_name = conf.child("atlas").attribute("file").as_string("");

	return ret;
}

// Called before the first frame
bool j1GameStartMenuBackground::Start()
{
	App->audio->PlayMusic("audio/music/Intro_Song.ogg", 1);
	atlas = App->tex->Load(atlas_file_name.c_str());

	Background_Initial_pos = App->win->GetWindowH() - background.h;

	BackgroundCharacterList.push_back(new BackgroundCharacter(&LinkRect, { (int)App->win->GetWindowW(),0 }));
	BackgroundCharacterList.push_back(new BackgroundCharacter(&ZeldaRect, { BackgroundCharacterList.back()->position.x + BackgroundCharacterList.back()->rect.w + spacebetweenbackgroundcharacters,0 }));
	BackgroundCharacterList.push_back(new BackgroundCharacter(&MessengerRect, { BackgroundCharacterList.back()->position.x + BackgroundCharacterList.back()->rect.w + spacebetweenbackgroundcharacters,26 }));

	Background_timer.Start();

	return true;
}

// Called each loop iteration
bool j1GameStartMenuBackground::PreUpdate()
{
	/*
	if (App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN)
		App->WantToQuit();
	*/
	/**/
	if (App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN || (App->input->GetControllerButton(0, 6) == KEY_DOWN)) {
		ingamenushow = !ingamenushow;
		App->player->paused = !App->player->paused;
		App->enemy->paused = !App->enemy->paused;
		App->collision->paused = !App->collision->paused;
		App->pathfinding->paused = !App->pathfinding->paused;
	}
	if (((App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN)|| (App->input->GetControllerButton(0, 6) == KEY_DOWN)) && (ingamenushow))
	{
		

		App->scene->Show(Scene_ID::ingamemenu);
		Freeze(false);
	}
	if (((App->input->GetKey(SDL_SCANCODE_ESCAPE) == KEY_DOWN) || (App->input->GetControllerButton(0, 6) == KEY_DOWN)) && (!ingamenushow))
{'fraction_non_alphanumeric': 0.16811708860759494, 'fraction_numerical': 0.011669303797468354, 'mean_word_length': 6.627450980392157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4821325', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1802, 'n_words': 265}