module RaylibAdditions::Flat
Overview
A WAD flat
Direct including types
Defined in:
raylib.crInstance Method Summary
-
#get_pixel(x : Int, y : Int, palette : ::WAD::Playpal::Palette) : Raylib::Color
Returns a Raylib Color for the pixel of a flat
-
#to_image(palette : ::WAD::Playpal::Palette) : Raylib::Image
Converts a flat to a Raylib Image using a palette
-
#to_png(filename : String | Path, palette : ::WAD::Playpal::Palette)
Exports a flat to a png given a filename and a palette
Instance Method Detail
def get_pixel(x : Int, y : Int, palette : ::WAD::Playpal::Palette) : Raylib::Color
#
Returns a Raylib Color for the pixel of a flat
Gets the Raylib Color of the pixel [5, 2] and draws it:
require "wa-cr/raylib"
palette = my_wad.playpal.palettes[0]
my_pixel = my_wad.flats["FLOOR0_1"].get_pixel(5, 2)
Raylib.draw_pixel(
0,
0,
my_pixel
)
def to_image(palette : ::WAD::Playpal::Palette) : Raylib::Image
#
Converts a flat to a Raylib Image using a palette
Converts a flat to a Raylib Image given a palette: and draws that image.
require "wa-cr/raylib"
palette = my_wad.playpal.palettes[0]
my_image = my_wad.flats["FLOOR0_1"].to_image(palette)
Raylib.draw_texture(
Raylib.load_texture_from_image(my_image),
0,
0,
Raylib::WHITE
)
def to_png(filename : String | Path, palette : ::WAD::Playpal::Palette)
#
Exports a flat to a png given a filename and a palette
my_wad = WAD.read("Path/To/Wad")
palette = my_wad.playpal.palettes[0]
my_flat = my_wad.flats["MyFlat"]
my_flat.to_png("Path/To/MyFlat.png", palette)