/TextUR

A terminal-based editor for text based textures / images.

Primary LanguageTeXMIT LicenseMIT

TextUR

GitHub License Static Badge

build ubuntu build macos build windows

Top Languages GitHub repo size Commit Activity Last Commit Contributors

Text-based texture UI and Rasterizer.

TextUR is a terminal-based editor for text-based textures or images. This is a tool for generating textures to be used with DungGine.

image

Command Line Arguments

  • Load existing texture : ./textel -f <filename>.
  • Create new texture or overwrite existing texture : ./textel -f <filename> -s <num_rows> <num_cols>.
  • Trace over another texture : ./textel -f <main_texture_filename> -t <trace_texture_filename>.
  • Convert texture made up of bright textels from the textel presets in TextUR to a corresponding dark texture which then can be used for rendering shadows in e.g. DungGine. The program exits when conversion is completed : ./textel -f <source_texture_filename> -c <target_texture_filename>.

Keys

  • WASD (lower case) or arrow keys : navigates the cursor or selects a textel preset in the textel menu. When in the textel menu, left and right (or A and D) scrolls from material to material for quicker navigation among the different textel presets.
  • SHIFT + WASD (upper case) keys : scrolls the texture page-wise.
  • Space : enter selected textel preset under cursor.
  • Z : undo.
  • SHIFT + Z : redo.
  • C : clear textel under cursor.
  • V : toggle drawing of vertical coordinates.
  • H : toggle drawing of horizontal coordinates.
  • SHIFT + V : toggle drawing of vertical guide line from the horizontal coordinate axis.
  • SHIFT + H : toggle drawing of horizontal guide line from the vertical coordinate axis.
  • - : toggle hide/show textel presets menu.
  • X : export (save) work to current file.
  • B : brush-stroke. Forms a circle, filled with the currently selected textel preset.
  • SHIFT + B : big brush-stroke.
  • R : randomized brush-stroke. Same as the B key, but fills the circle with textels according to a normal random distribution. You can re-generate until you get the desired result.
  • SHIFT + R : randomized big brush-stroke. Same as the SHIFT + B key, but fills the circle with textels according to a normal random distribution. You can re-generate until you get the desired result.
  • F: fill screen. Fills the texture with the currently selected textel preset where the bounding box of the screen is currently located over the texture.
  • P : pick a textel from under the cursor and hilite the corresponding preset in the menu.
  • L : show location of cursor.
  • G : goto new cursor location. Press backspace to clear the last digit, press tab to toggle between R and C coordinate fields and press enter to confirm. Pressing G again toggles the input box.
  • T : toggle show/hide of tracing texture.
  • I : toggle inverted textels (i.e. toggle between dark and bright textel presets).
  • M : toggle show/hide of material id:s.
  • Q : quit.

Custom Textel Presets

Add a file named custom_textel_presets. The file format looks like this:

'<normal-char>', <normal-fg-color>, <normal-bg-color>, <normal-material>
'<shadow-char>', <shadow-fg-color>, <shadow-bg-color>, <shadow-material>
<textel-preset-name>
'<normal-char>', <normal-fg-color>, <normal-bg-color>, <normal-material>
'<shadow-char>', <shadow-fg-color>, <shadow-bg-color>, <shadow-material>
<textel-preset-name>
...etc...

So e.g.

'%', Magenta, Cyan, 28
'%', DarkMagenta, DarkCyan, 28
Magic Stone

produces the following textel preset at the end of the list:

image

Look in the source code for which material number that is appropriate to use for your custom presets.

Screenshots

image image image image image image image image image

Bright mode textels (normal mode):

image

Dark mode textels (shadow mode):

image

Dark mode texture (shadow texture):

image

Unsaved changes indicator:

image

Confirmation screen for attempting to quit while there are unsaved changes:

image

Custom textel "Magic Stone":

image
  • Small brush stroke using B key (upper left corner).
  • Big brush stroke using SHIFT + B key (lower left corner).
  • Small randomized brush stroke using R key (upper right corner).
  • Big randomized brush stroke using SHIFT + R key (lower right corner).
image

Build & Run Instructions

There are two options on dealing with repo dependencies:

Repo Dependencies Option 1

Run the following command from <my_source_code_dir>.

./TextUR/fetch-dependencies ./TextUR/dependencies

This will make sure you are running the latest stable versions that work with TextUR.

This script was created by Thibaut Buchert.

Repo Dependencies Option 2

You need the following header-only libraries that I've made:

Make sure the folder structure looks like this:

<my_source_code_dir>/lib/Core/                   ; Core repo workspace/checkout goes here.
<my_source_code_dir>/lib/Termin8or/              ; Termin8or repo workspace/checkout goes here.
<my_source_code_dir>TextUR/                      ; TextUR repo workspace/checkout goes here.

These repos are not guaranteed to all the time work with the latest version of TextUR. If you want the more stable aproach then look at Option 1 instead.

Windows

Then just open <my_source_code_dir>/TextUR/TextUR/TextUR.sln and build and run. That's it!

You can also build it by going to <my_source_code_dir>/TextUR/TextUR/ and build with build.bat. Then you run by typing x64\Release\textur followed by the appropriate command line arguments.

MacOS

Goto <my_source_code_dir>/TextUR/TextUR/ and build with ./build.sh.

Then run by typing ./bin/textur and apply the appropriate command line arguments (see beginning of README.md).

Linux (Ubuntu)

Goto <my_source_code_dir>/TextUR/TextUR/ and build with ./build.sh.

Then run by typing ./bin/textur and apply the appropriate command line arguments (see beginning of README.md).