From 4b6c0e31385f5f27a151088c0a2b614495c4e589 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 14 Oct 2021 12:47:50 -0400 Subject: initial commit, including theme --- content/posts/2005-03-04-profanity.html | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 content/posts/2005-03-04-profanity.html (limited to 'content/posts/2005-03-04-profanity.html') diff --git a/content/posts/2005-03-04-profanity.html b/content/posts/2005-03-04-profanity.html new file mode 100644 index 0000000..98c1074 --- /dev/null +++ b/content/posts/2005-03-04-profanity.html @@ -0,0 +1,74 @@ +--- +date: "2005-03-04T01:38:28Z" +title: Profanity! +--- + +

+The last week or so I've been working on Profanity, a Ruby windowing library for Curses. It's features include relative window geometry, a include an HTML-like markup for styled text, and proper terminal resizes support. I've whipped up a couple of example movies to demonstrate the geometry engine and styled text: +

+ + + +

+By the way, if you're having trouble with these movies, try them in MPlayer (I'm usually an Xine guy myself, but it seems to mangle these too). In the interest of staving of the torch- and pitchfork-wielding mob of people who can't get either movie to play, here are a few still shots from each (click the thumbnails for the full image): +

+ +

+profanity 20050228-00 +profanity 20050228-01 +profanity 20050228-02 +profanity 20050228-03 + +profanity 20050301-00 +profanity 20050301-01 +profanity 20050301-02 +

+ +

+Finally, here is a simple example from CVS) which demonstrates what Profanity code looks like: +

+ +
+
+
+require 'profanity'
+
+# create a basic window class
+class HelloWorldWindow < Profanity::Window
+  # contents of this window
+  LINES = [
+    "<center>Welcome to <u>Profanity</u>!</center>",
+    '<center>Press <b>Q</b> or <b>ESC</b> to quit.</center>',
+  ]
+
+  # override Window#draw_contents for our own devious purposes
+  def draw_contents
+    clear
+    puts LINES
+  end
+end
+
+# create the profanity window manager
+wm = Profanity::WindowManager.new
+
+# create geometry, and fix height to 4 lines
+geom = Profanity::Geometry.new(0.5, 0.5, 0.7, 0.0)
+geom.height_absolute = 4
+
+# set gravity to center of the screen
+geom.gravity.x = geom.gravity.y = 0.5
+
+# create our window, show and refresh it
+win = HelloWorldWindow.new(wm, geom, 'Hello World')
+win.show; win.refresh
+
+# run until the user presses q, ctrl-c, or escape
+wm.run { |key| break if [?q, 27, Curses::KEY_CTRL_C].include?(key) }
+
+
+
+ -- cgit v1.2.3