add C.screen_width and C.screen_height methods
This commit is contained in:
parent
66517921ab
commit
ee08d9d13e
@ -1,5 +1,30 @@
|
||||
#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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user