Skip to content

Document Class Shadowing #541

Open
Open
@AdamHarte

Description

@AdamHarte

Explanation from the Haxe Discord:

shadow
Shadowing classes in haxe, means, overwriting an original source file with a local copy without needing to modify the original copy.

This is useful under situations where you want to test out changes to libraries, or change something to fit your projects needs.

  1. Locate the full package of the file you wish to overwrite as an example - flixel/system/frontEnds/SoundFrontEnd.hx
  2. Go to your own project and locate your source directory. Create a file called SoundFrontEnd.hx at the exact same destination. So it looks a little like: your_project_root/src/flixel/system/frontEnds/SoundFrontEnd.hx
  3. Copy the contents of the original file (or a pr) to the file created within your project
  4. You've now overwritten the original source file! Make any changes you wish to this file and it will apply to all SoundFrontEnd references, including inside libraries.

Notes:
it's even possible with a lib, as long as -lib newImplem is later than -lib oldImplem in hxml order

It replaces the entire file, but it is possible to replace specific vars and functions using a macro, if that is actually what you want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions