module RaylibAdditions::FlatClassMethods

Overview

Raylib class methods for WAD::Flat

Defined in:

raylib.cr

Instance Method Summary

Instance Method Detail

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

Gets the absolute Color Distance between color1 to color2


def from_image(image : Raylib::Image, palette : ::WAD::Playpal::Palette) : ::WAD::Flat #

Converts a Raylib::Image to a WAD::Flat given the image and the palette

NOTE The image has to be 64x64 and have no transparent pixels

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

palette = my_wad.playpal.palettes[0]

my_image = Raylib.gen_image_color(64, 64, Raylib::RED)

my_image_flat = WAD::Flat.from_image(my_image, palette)

def from_png(filename : String | Path, palette : ::WAD::Playpal::Palette) : ::WAD::Flat #

Converts a .png to a WAD::Flat given the filename and the palette

NOTE The png has to be 64x64 and have no transparent pixels

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

palette = my_wad.playpal.palettes[0]

my_png_flat = WAD::Flat.from_png("Path/To/MyFlat.png", palette)