module RaylibAdditions::WAD

Overview

Reads and stores the data of a WAD file.

Direct including types

Defined in:

raylib.cr

Instance Method Summary

Instance Method Detail

def export_texture(texture_name : String, filename : String | Path, palette : ::WAD::Playpal::Palette) #

Exports a texture to a png given a texture_name, a filename, and a palette

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

palette = my_wad.playpal.palettes[0]

my_wad.export_texture("MyTexture", "Path/To/MyGraphic.png", palette)

def get_texture(name : String, palette : ::WAD::Playpal::Palette) : Raylib::Image #

Gets a texture as a Raylib Image given the texture name and a palette

Takes the name of a texture from TextureX and a palette and converts the texture to a Raylib Image and draws that image:

require "wa-cr/raylib"
palette = my_wad.playpal.palettes[0]
my_image = my_wad.get_texture("STARTAN3", palette)
Raylib.draw_texture(
  Raylib.load_texture_from_image(my_image),
  0,
  0,
  Raylib::WHITE
)