Skip to content

A community-maintained Celeste helper, originally by PenguinOwl.

License

Notifications You must be signed in to change notification settings

CommunalHelper/BGswitch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BGswitch

A helper for Celeste. Originally created by PenguinOwl and now maintained by the Communal Helper organization.

The release build can be downloaded here.

Head to our issues page to leave a bug report or feature request.

API

This mod uses a ModInterop API, which allows you to import methods into your own mods without referencing BGswitch directly. To use it, add BGswitch as an optional dependency and use the version where the methods you need were exported (or later).

Check out the API code for documentation on individual methods.

Basic usage guide and version info:

// Add somewhere in your mod. You only need to include delegates that you need.
[ModImportName("BGswitch")]
public static class BGswitchImports {
  // Added in v1.2.0
  public static Func<bool> IsBGMode;
  public static Action<bool, bool> SetBGMode;
  public static Func<Action<bool>, Component> GetBGModeListener;
}

// Add to YourModule.Load()
typeof(BGswitchImports).ModInterop();

// Example usages
public void LogMode(bool mode) {
  Logger.Log("MyMod", $"BG mode changed to: { mode }");
}

Component listener = GetBGModeListener?.Invoke(LogMode);
if (listener != null) {
  myEntity.Add(listener);
}

if (BGswitchImports.IsBGMode?.Invoke() ?? false) {
  Logger.Log("MyMod", "BG mode is active! Let's turn it off.");
  SetBGMode?.Invoke(false, false);
}

About

A community-maintained Celeste helper, originally by PenguinOwl.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 77.9%
  • Julia 12.6%
  • Lua 9.5%