This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'ffi' | |
module X11 | |
extend FFI::Library | |
ffi_lib 'X11' | |
attach_function :open_display, :XOpenDisplay, [:pointer], :pointer | |
attach_function :query_tree, :XQueryTree, | |
[:pointer, :int, :pointer, :pointer, :pointer, :pointer], :int | |
attach_function :get_window_attributes, :XGetWindowAttributes, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# % ruby scrot.rb /tmp/screenshot.png | |
# scrot.rb uses xlib + imlib via ffi to capture screenshots. | |
require 'ffi' | |
module X11 | |
extend FFI::Library | |
ffi_lib 'X11' | |
attach_function :XOpenDisplay, [:string], :pointer | |
attach_function :XFlush, [:pointer], :pointer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
module FFI | |
typedef :pointer, :Display | |
typedef :ulong, :XID | |
typedef :XID, :Window | |
typedef :int, :Status | |
typedef :ulong, :Atom | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Game | |
attr_gtk | |
def tick | |
defaults | |
render | |
input | |
calc | |
end |
OlderNewer