module

RaylibAdditions::GraphicClassMethods

Raylib class methods for WAD::Graphic

Instance methods

color_distance(color1 : Raylib::Color, color2 : Raylib::Color) : Int

Gets the absolute Color Distance between color1 to color2

from_image(image : Raylib::Image, palette : ::WAD::Playpal::Palette, offset : ::WAD::Graphic::Offsets = ::WAD::Graphic::Offsets::TopLeft) : ::WAD::Graphic

Converts a Raylib::Image to a WAD::Graphic given the filename, the palette, and the offset

NOTE: If you get an arithmetic overflow error at any point, chances are that your image is too big

my_wad = WAD.read("Path/To/Wad")

palette = my_wad.playpal.palettes[0]

my_image = Raylib.gen_image_color(100, 80, Raylib::RED)

my_image_graphic = WAD::Graphic.from_image(my_image, palette, WAD::Graphic::Offsets::BottomCenter)
from_png(filename : String | Path, palette : ::WAD::Playpal::Palette, offset : ::WAD::Graphic::Offsets = ::WAD::Graphic::Offsets::TopLeft) : ::WAD::Graphic

Converts a .png to a WAD::Graphic given the filename, the palette, and the offset

NOTE: If you get an arithmetic overflow error at any point, chances are that your image is too big

my_wad = WAD.read("Path/To/Wad")

palette = my_wad.playpal.palettes[0]

my_png_graphic = WAD::Graphic.from_png("Path/To/MyGraphic.png", palette, WAD::Graphic::Offsets::BottomCenter)