Skip to content

Minimal example of working with tmx/tsx files? #520

Answered by orende
orende asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, I finally figured it out. No idea if this is the most performant solution, but it works for me.

build.rs

use std::env;
use std::fs::File;
use std::io::{BufWriter, Write};
use std::path::Path;

use quote::quote;

// Work-around to allow console output from build script.
macro_rules! p {
    ($($tokens: tt)*) => {
        println!("cargo:warning={}", format!($($tokens)*))
    }
}

fn main() {
    p!("Running build script");
    
    // This env var is set to the target folder by default
    let out_dir = env::var("OUT_DIR").expect("OUT_DIR environment variable must be specified");
    p!("Out dir is: {}", out_dir);

    // Specify the name of your tile map file here (tmx file).
    let

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by orende
Comment options

You must be logged in to vote
1 reply
@orende
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants