Skip to content

Commit

Permalink
camera
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Nov 30, 2023
1 parent ce768ad commit a86d660
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions source/modding/ModchartUtilities.hx
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,26 @@ class ModchartUtilities {
return null;
}

function getCameraByName(id:String):LuaCamera{
if(lua_Cameras.exists(id))
return lua_Cameras.get(id);

switch(id.toLowerCase()){
case 'camhud' | 'hud': return lua_Cameras.get("hud");
}


return lua_Cameras.get("game");
}

public function die() {
PlayState.songMultiplier = oldMultiplier;

lua_Sprites.clear();
lua_Characters.clear();
lua_Shaders.clear();
lua_Custom_Shaders.clear();
lua_Cameras.clear();
lua_Sounds.clear();

Lua.close(lua);
Expand Down Expand Up @@ -178,6 +191,9 @@ class ModchartUtilities {
lua_Characters.set("girlfriend", PlayState.gf);
lua_Characters.set("dad", PlayState.dad);

lua_Cameras.set("game", {cam: PlayState.instance.camGame, shaders: [], shaderNames: []});
lua_Cameras.set("hud", {cam: PlayState.instance.camHUD, shaders: [], shaderNames: []});

lua_Sounds.set("Inst", FlxG.sound.music);
@:privateAccess
lua_Sounds.set("Voices", PlayState.instance.vocals);
Expand Down Expand Up @@ -2699,7 +2715,7 @@ class ModchartUtilities {

//dumb vc functions
setLuaFunction("initShader", function(id:String, file:String, ?glslVersion:Int = 120){
var funnyCustomShader:CustomShader = new CustomShader(Assets.getText(Paths.frag(file)));
var funnyCustomShader:CustomShader = new CustomShader(Assets.getText(Paths.frag(file)), null, glslVersion);
lua_Custom_Shaders.set(id, funnyCustomShader);
});

Expand Down Expand Up @@ -2924,18 +2940,6 @@ class ModchartUtilities {

return PlayState.instance.camGame;
}
function getCameraByName(id:String):LuaCamera{
if(lua_Cameras.exists(id))
return lua_Cameras.get(id);

switch(id.toLowerCase()){
case 'camhud' | 'hud': return lua_Cameras.get("hud");
}


return lua_Cameras.get("game");
}


@:access(openfl.display.BlendMode)
function blendModeFromString(blend:String):BlendMode {
Expand Down

0 comments on commit a86d660

Please sign in to comment.