kaka.farm

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit af7b5238d60f2fb1df3223e30f1a37eaea29e46f
parent 73a9c8858bebff1a11bcfd9176253ca0e1d29644
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Fri, 14 Jan 2022 02:01:11 +0200

Add godot pixel manipilation notes and the terminal programming notes.

Diffstat:
Acontent/pages/pixel-manipulations-in-godot.md | 5+++++
Acontent/pages/terminal-programming.markdown | 27+++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/content/pages/pixel-manipulations-in-godot.md b/content/pages/pixel-manipulations-in-godot.md @@ -0,0 +1,5 @@ +# Per pixel manipulation in Godotengine. + +* [Image class](https://docs.godotengine.org/en/stable/classes/class_image.html) +* [Can I create an image and draw to it in Godot?](https://godotengine.org/qa/78068/can-i-create-an-image-and-draw-to-it-in-godot?show=78068#q78068) + * [this is the minimal code that you need to draw pixels to screen using an image](https://gist.github.com/kasthor/da23d1ed802a1eab7ac354305608f40f) diff --git a/content/pages/terminal-programming.markdown b/content/pages/terminal-programming.markdown @@ -0,0 +1,27 @@ +title: Notes on terminal programming. + +# Notes on terminal programming. + +If you want get keys pressed immediately, not only after pressing enter, amongst other nice terminal programs features, you have to talk with the "termios driver", according to this talk, at 09:06. + +- `stty -onlcr` - will disable the "translate newline to carriage return newline" (from man's STTY(1)), so its negation is just move cursor one row down, without changing column. +- `stty -echo` - disable STTY(1) "echo input characters" or the "Where did my keyboard go?!" mode. +- `stty -icanon` - disable the "line editor" (Brandon Rhodes). + STTY(1): "enable special characters: erase, kill, werase, rprnt" +- `stty raw` - too? + +`Animations In The TERMINAL [Animating With ASCII]`: <https://youtu.be/K_6peGEsq0U?t=9m6s> + +You can read stty state with `stty -g` at the start of the program and then use that as the argument of stty to return to the previous state. +While using it to read the state within a program, stty complained about something like "not a typewriter". Need to figure that one out. Right now there is no other way but to use something like termion, the "gay space communism" (sheesh...) project ([I wish I were kidding...](https://gitlab.redox-os.org/redox-os/termion/-/blob/master/examples/commie.rs)). + +Oops! According to `#rust:matrix.org` I can do this: + +``` +std::process::Command::new("stty") + .arg("-g") + .stdin(std::process::Stdio::inherit()) + .output() +``` + +What exactly is inherited stdin? the same stdin as the father process?