NarumiSTG_HyperSnowDrifter/script/Package_FuncLib.dnh

195 lines
9.1 KiB
Plaintext
Raw Normal View History

2023-01-26 11:34:56 +00:00
<EFBFBD><EFBFBD>function <void> ImgLoad(){
string[] imgList = GetFilePathList("script/Jam10/PackageLib/");
for each (string img in ref imgList){
if (GetFileExtension(img) == ".png" || GetFileExtension(img) == ".jpg")
{LoadTextureEx(img, true, true);}
else{continue;}
}
}
task _RenderTitleBackground(){
// Create all images
// BG
int BG = _Create2DImage("script/Jam10/PackageLib/ImgTitle.png", [0, 0, 1280, 720]);
2023-01-26 11:34:56 +00:00
//LoadTextureEx(BG, true, true);
Obj_SetRenderPriorityI(BG, 0);
ObjSprite2D_SetDestCenter(BG);
ObjRender_SetPosition(BG, GetScreenWidth()/2, GetScreenHeight()/2, 0);
// Card rings
/*
// Large
int cardRing1 = _Create2DImage("script/GunnerParade/PackageLib/Title_CardRing1.png", [0, 0, 1024, 1024]);
//LoadTextureEx(cardRing1, true, true);
Obj_SetRenderPriorityI(cardRing1, 2);
ObjSprite2D_SetDestCenter(cardRing1);
ObjRender_SetScaleXYZ(cardRing1, 2);
// Small
int cardRing2 = _Create2DImage("script/GunnerParade/PackageLib/Title_CardRing2.png", [0, 0, 1024, 1024]);
//LoadTextureEx(cardRing2, true, true);
Obj_SetRenderPriorityI(cardRing2, 1);
ObjSprite2D_SetDestCenter(cardRing2);
ObjRender_SetScaleXYZ(cardRing2, 1.75);
// Anim
while(true){
ObjRender_SetPosition(cardRing1, 1536, 128, 1);
ObjRender_SetPosition(cardRing2, 360, 1000, 1);
ObjRender_SetAngleZ(cardRing1, ObjRender_GetAngleZ(cardRing1)+0.25);
ObjRender_SetAngleZ(cardRing2, ObjRender_GetAngleZ(cardRing2)+0.5);
if(IsGameStart){
Obj_SetVisible(BG, false);
Obj_SetVisible(cardRing1, false);
Obj_SetVisible(cardRing2, false);
}
else{
Obj_SetVisible(BG, true);
Obj_SetVisible(cardRing1, true);
Obj_SetVisible(cardRing2, true);
}
yield;
}
*/
}
function TInstallFont{
/*
// JP Text
InstallFont(dirSystem ~ "./font/FOT-NewCinemaAStd-D_1.otf");
InstallFont(dirSystem ~ "./font/Corporate-Logo-Rounded.otf");
InstallFont(dirSystem ~ "./font/OtsutomeFont_Ver3.ttf");
// English Text
InstallFont(dirSystem ~ "./font/Revue Regular.ttf");
InstallFont(dirSystem ~ "./font/Uni Sans Heavy.otf");
InstallFont(dirSystem ~ "./font/Exotic 350 Demi Bold BT.ttf");
InstallFont(dirSystem ~ "./font/unispace rg.ttf");
InstallFont(dirSystem ~ "./font/Connecting Chain Handserif.ttf");
InstallFont(dirSystem ~ "./font/AnkeCall.ttf");
*/
// Misc
InstallFont(dirSystem ~ "./font/origa___.ttf");
string[] FontList = GetFilePathList("script/KevinSystem/font/");
for each(string font in ref FontList){
InstallFont(font);
}
}
function CreateTextObject(
float mx, my, size,
string text, font,
int colorTop, colorBottom,
int borderColor, borderWidth,
int renderPriority
){
let obj = ObjText_Create();
ObjText_SetText(obj, text);
ObjText_SetFontSize(obj, size);
ObjText_SetFontType(obj, font);
ObjText_SetFontColorTop(obj, colorTop);
ObjText_SetFontColorBottom(obj, colorBottom);
ObjText_SetFontBorderType(obj, BORDER_FULL);
ObjText_SetFontBorderColor(obj, borderColor);
ObjText_SetFontBorderWidth(obj, borderWidth);
Obj_SetRenderPriorityI(obj, renderPriority);
ObjRender_SetX(obj, mx);
ObjRender_SetY(obj, my);
return obj;
}
function <int> _Create2DImage(imgpath, int[] rectarray){
int imgname = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(imgname, imgpath);
ObjSprite2D_SetSourceRect(imgname, rectarray);
ObjSprite2D_SetDestCenter(imgname);
return imgname;
}
function DigitToCommaArray(num){ //Natashinitai
let srcStr = IntToString(num);
let res = [];
let nChar = 0;
for(let i = length(srcStr) - 1; i >= 0; i--){
res = [srcStr[i]] ~ res;
nChar++;
if(nChar % 3 == 0 && i > 0) res = "," ~ res;
}
return res;
}
function <int[]> TMenuItem(
int renderPriority, string font,
float mx, my, size,
int fontColorTop, fontColorBottom, fontColorBorder,
string text
)
{
int objText = CreateTextObject(
mx, my, size,
text, font,
0xFFFFFF, 0xFFFFFF,
0x070076, size/10,
2
);
int objSelect = CreateTextObject(
mx, my, size,
text, font,
0xFFFFFF, 0xFFFFFF,
0x070076, size/10,
2
);
//ObjText_SetMaxWidth(objText, GetScreenWidth());
ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
//ObjText_SetMaxWidth(objSelect, GetScreenWidth);
ObjText_SetHorizontalAlignment(objSelect, ALIGNMENT_CENTER);
ObjRender_SetBlendType(objSelect, BLEND_ADD_ARGB);
Obj_SetVisible(objSelect, false);
// Menu logic handled in functions
return [objText, objSelect];
}