
//======================================
//リソース読み込み、グラフィックレクトなど
//
//======================================

let img_Sphere = GetCurrentScriptDirectory() ~ "img\sphere.png";
//let img_Sphere2 = GetCurrentScriptDirectory() ~ "img\shot_bomb.png";
let img_BG01 = GetCurrentScriptDirectory() ~ "img\background01.png";
let img_BG02 = GetCurrentScriptDirectory() ~ "img\cloud.png";
let img_Burst = GetCurrentScriptDirectory() ~ "img\circle_white.png";
let img_BurstRed = GetCurrentScriptDirectory() ~ "img\circle_fire.png";
let img_BurstBlue = GetCurrentScriptDirectory() ~ "img\circle_ice.png";
let img_CountNum = GetCurrentScriptDirectory() ~ "img\text.png";
let img_Text = GetCurrentScriptDirectory() ~ "img\text2.png";
let img_Life = GetCurrentScriptDirectory() ~ "img\life_gauge.png";
let img_Words = GetCurrentScriptDirectory() ~ "img\title_words.png";
let img_Danger = GetCurrentScriptDirectory() ~ "img\danger.png";
let img_Magic = GetCurrentScriptDirectory() ~ "img\magic.png";
let img_MagicMini = GetCurrentScriptDirectory() ~ "img\ibukihyou.png";
let img_TitleRock = GetCurrentScriptDirectory() ~ "img\title_rock.png";

let img_Ending = GetCurrentScriptDirectory() ~ "img\ending.dat";
let img_EndingText = GetCurrentScriptDirectory() ~ "img\ending_text.dat";


let img_SphereRender = "__SPHERIA_RENDER_TARGET01";
CreateRenderTarget(img_SphereRender, 256, 256);


let se_Swing = GetCurrentScriptDirectory() ~ "se\swing05+.wav";
let se_Item = GetCurrentScriptDirectory() ~ "se\cursor.wav";
let se_Move = GetCurrentScriptDirectory() ~ "se\slash01+.wav";
let se_Crash = GetCurrentScriptDirectory() ~ "se\bom26_a.wav";
let se_LvUp = GetCurrentScriptDirectory() ~ "se\puu84.wav";
let se_LvDown = GetCurrentScriptDirectory() ~ "se\cursor01.wav";
let se_Reflect = GetCurrentScriptDirectory() ~ "se\metal14.wav";


let bgm_01 =  GetCurrentScriptDirectory() ~ "bgm\kyrill167.mp3";
let bgm_02 =  GetCurrentScriptDirectory() ~ "bgm\heaven.mp3";
let bgm_03 =  GetCurrentScriptDirectory() ~ "bgm\utyouten.mp3";
let bgm_Ending =  GetCurrentScriptDirectory() ~ "bgm\suika_ending.mp3";

function once_system_LoadResource(){
	//ClearRenderTarget(img_render_Circle);

	LoadGraphic(img_Sphere);
	LoadGraphic(img_BG01);
	LoadGraphic(img_BG02);
	LoadGraphic(img_Burst);
	LoadGraphic(img_CountNum);
	LoadGraphic(img_Magic);
	LoadGraphic(img_MagicMini);
	LoadGraphic(img_Life);
	LoadGraphic(img_Words);
	LoadGraphic(img_Text);
	LoadGraphic(img_Danger);
	LoadGraphic(img_TitleRock);
	LoadSE(se_Swing);
	LoadSE(se_Item);
	LoadSE(se_Move);
	LoadSE(se_Crash);
	LoadSE(se_LvUp);
	LoadSE(se_LvDown);
	LoadSE(se_Reflect);


	//LoadMusic(bgm_01);
	return;

}//end function

function once_system_DeleteResource(){

	DeleteGraphic(img_Sphere);
	DeleteGraphic(img_BG01);
	DeleteGraphic(img_BG02);
	DeleteGraphic(img_Burst);
	DeleteGraphic(img_CountNum);
	DeleteGraphic(img_Magic);
	DeleteGraphic(img_MagicMini);
	DeleteGraphic(img_Life);
	DeleteGraphic(img_Words);
	DeleteGraphic(img_Text);
	DeleteGraphic(img_Danger);
	DeleteGraphic(img_TitleRock);
	DeleteSE(se_Swing);
	DeleteSE(se_Item);
	DeleteSE(se_Move);
	DeleteSE(se_Crash);
	DeleteSE(se_LvUp);
	DeleteSE(se_LvDown);
	DeleteSE(se_Reflect);
	//DeleteMusic(bgm_01);
	//DeleteSE(se_Supression01);

}//end function


function once_system_LoadEndingResource()
{
	LoadGraphic(img_Ending);
	LoadGraphic(img_EndingText);
	LoadMusic(bgm_Ending);
}//end function

function once_system_DeleteEndingResource()
{
	DeleteGraphic(img_Ending);
	DeleteGraphic(img_EndingText);
	DeleteMusic(bgm_Ending);
}//end function

function system_SetGraphicRect(let type){

	let rect = system_GetGraphicRect(type);
	SetGraphicRect( rect[0], rect[1], rect[2], rect[3] );
	return;

}//end function


function system_GetGraphicRect(let type){

	alternative(type)
	case("SPHERE_MAIN01"){return [32*0, 32*0, 32*4, 32*4];}
	case("SPHERE_MARKER_FRAME"){return [32*5, 32*0, 32*8, 32*1];}
	case("SPHERE_MARKER01"){return [32*5, 32*2, 32*8, 32*3];}
	case("SPHERE_MARKER02"){return [32*5, 32*3, 32*8, 32*4];}
	case("SPHERE_MARKER03"){return [32*5, 32*4, 32*8, 32*5];}
	case("SPHERE_WHITE"){return [32*5, 32*1, 32*6, 32*2];}
	case("SPHERE_STONE"){return [32*6, 32*1, 32*7, 32*2];}
	case("SPHERE_HEART"){return [32*5, 32*5, 32*6, 32*6];}
	case("SPHERE_CHAIN01"){return [32*0, 32*6+1, 32*8, 32*7-1];}

	case("SPHERE_GAUGE_FRAME"){return [32*0, 16*8, 32*5, 16*9];}
	case("SPHERE_GAUGE01"){return [32*0, 16*9, 32*5, 16*10];}
	case("SPHERE_GAUGE02"){return [32*0, 16*10, 32*5, 16*11];}
	case("SPHERE_GAUGE03"){return [32*0, 16*11, 32*5, 16*12];}

//	case("SPHERE_CATCH"){return [0, 32*5, 32*2, 32*6];}
	case("SPHERE_STOP"){return [32*7, 32*1, 32*8, 32*2];}

	case("BG_TOWN01"){return [GetClipMinX(), GetClipMinY(), GetClipMaxX(), GetClipMaxY()];}
	case("BG_CLOUD"){return [GetClipMinX(), GetClipMinY(), GetClipMaxX(), GetClipMaxY()];}

	case("BURST_01"){return [32*0, 32*0, 32*4, 32*4];}
	case("BURST_02"){return [32*4, 32*0, 32*8, 32*4];}
	case("BURST_03"){return [32*8, 32*0, 32*12, 32*4];}
	case("BURST_04"){return [32*12, 32*0, 32*16, 32*4];}
	case("BURST_05"){return [32*0, 32*4, 32*4, 32*8];}
	case("BURST_06"){return [32*4, 32*4, 32*8, 32*8];}
	case("BURST_07"){return [32*8, 32*4, 32*12, 32*8];}
	case("BURST_08"){return [32*12, 32*4, 32*16, 32*8];}

	case("NUM_01TON"){return [0, 32*2, 32*2, 32*3];}
	case("NUM_02TON"){return [32*2, 32*2, 32*4, 32*3];}
	case("NUM_04TON"){return [32*4, 32*2, 32*6, 32*3];}
	case("NUM_08TON"){return [32*6, 32*2, 32*8, 32*3];}
	case("NUM_12TON"){return [32*0, 32*3, 32*2, 32*4];}
	case("NUM_16TON"){return [32*2, 32*3, 32*4, 32*4];}

	case("TEXT_SCORE"){return [32*0, 32*4, 32*3, 32*5];}
	case("TEXT_COMBO"){return [32*0, 32*5, 32*3, 32*6];}
	case("TEXT_LIFE"){return [32*0, 32*6, 32*3, 32*7];}
	case("TEXT_WEIGHT"){return [32*0, 32*7, 32*4, 32*8];}

	case("SPHERE_CATCH"){return [32*0, 32*0, 32*3, 32*1];}
	case("DANGER"){return [32*0, 32*1, 32*4, 32*2];}

	case("ROCK01"){return [32*0, 32*0, 32*1, 32*1];}
	case("ROCK02"){return [32*1, 32*0, 32*2, 32*1];}
	case("ROCK03"){return [32*2, 32*0, 32*3, 32*1];}
	case("ROCK04"){return [32*3, 32*0, 32*4, 32*1];}
	

	case("MAGIC"){return [0,0,256,256];}
	case("MAGIC_MIN"){return [0,0,64,64];}

	case("WORDS_GAMEOVER"){return [0,0,160,48];}
	case("WORDS_GAMECLEAR"){return [0,48,128,96];}
	case("WORDS_CLEARTEXT1"){return [128,48,256,96];}
	case("WORDS_CLEARTEXT2"){return [160,0,256,48];}
	case("WORDS_TO_TITLE"){return [0,96,128,116];}
	case("WORDS_END_GAME"){return [128,96,256,116];}
	case("WORDS_TITLE"){return [0,128,256,256];}
//	case("DANGER"){return [0,0,94,64];}


	return [0,0,0,0];

}//end function


function system_SetGraphicRectNum(let val){

	let rect = system_GetGraphicRectNum(val);
	SetGraphicRect( rect[0], rect[1], rect[2], rect[3] );
	return;

}//end function

function system_GetGraphicRectNum(let val){

	return [32 * (val%5), 32*trunc(val/5), 32*((val%5)+1), 32*trunc(1 + val/5)];


}//end function

