This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

xpm-nes, embedding X11 xpm files in NES software

xpm-nes, embedding X11 xpm files in NES software
by on (#128107)
Hi, there's a NES demo for making xpm available in NES programs. Basically an xpm file is for coming into a program so you can convert its data in a buffer of characters, a structure has been made for that.

This is an example of such a file :
/* XPM */
static char * tilegrass2_16x16_xpm[] = {
"16 16 8 1",
" c None",
". c #406030",
"+ c #688038",
"@ c #2B471D",
"# c #80A820",
"$ c #E0F830",
"% c #C0B060",
"& c #908040",
".+.@.+.+@.+.@.+.",
".+#.+#.+@.+##.+.",
"..##+.#+.+.#+.+#",
"+..#@.+#.#.#$%.+",
".+.+#@.#.+.#%&..",
".@.$$@.+#.@+.@+.",
"+@@$%..+#.@@.@+.",
"++.@@+@..@.@@...",
"...#.+.@.+..@.#+",
"+..+#.@@@..#+.++",
"+++++.+++.++.+.@",
".+..+#++.##+.+.@",
"..@..+.#.@$%..#+",
"+#.@@@++.@%&@.+.",
".+.+..+..@+@.++.",
"..@.+.+.@+.+...@"};

Now my program just gives you something which can be made to a choice of NES image binary formats, you only have to convert from a character array as I said, pygame works this way also.

Source code is at https://sf.net/projects/xpmnes

If your NES incbins are full you can use my program for embedding xpm files just in plain C.

HTH.