31 lines
671 B
C
31 lines
671 B
C
#include <ruby.h>
|
|
#include <curses.h>
|
|
|
|
static int Screen_Width = -1;
|
|
static int Screen_Height = -1;
|
|
|
|
VALUE Rb_screen_width(void)
|
|
{
|
|
return INT2FIX(Screen_Width);
|
|
}
|
|
|
|
VALUE Rb_screen_height(void)
|
|
{
|
|
return INT2FIX(Screen_Height);
|
|
}
|
|
|
|
void Init_svi(void)
|
|
{
|
|
/* Determine screen dimensions. */
|
|
initscr();
|
|
getmaxyx(stdscr, Screen_Height, Screen_Width);
|
|
endwin();
|
|
|
|
VALUE svi_module = rb_define_module("Svi");
|
|
VALUE c_module = rb_define_module_under(svi_module, "C");
|
|
rb_define_module_function(c_module, "screen_width",
|
|
Rb_screen_width, 0);
|
|
rb_define_module_function(c_module, "screen_height",
|
|
Rb_screen_height, 0);
|
|
}
|