
BTRONのウィンドウを扱うmrbgemの開発用
| Revision | e9c2d165b34c85a2fc902ea811434c937a9161f5 (tree) |
|---|---|
| Time | 2017-06-14 01:45:11 |
| Author | ornse01 <ornse01@user...> |
| Commiter | ornse01 |
add open/close system call
| @@ -1,12 +1,20 @@ | ||
| 1 | 1 | #include "mruby.h" |
| 2 | + | |
| 2 | 3 | #include <bstdio.h> |
| 4 | +#include <btron/btron.h> | |
| 5 | +#include <btron/hmi.h> | |
| 3 | 6 | |
| 4 | 7 | static mrb_value |
| 5 | 8 | mrb_opn_wnd(mrb_state *mrb, mrb_value self) |
| 6 | 9 | { |
| 10 | + PAT bgpat = {{0, 16, 16, 0x10FFFFFF, 0x10FFFFFF, FILL100}}; | |
| 11 | + RECT r = {{0, 0, 100, 100}}; | |
| 12 | + WID wid = wopn_wnd(WA_NORMAL, 0, &r, NULL, 0, NULL, &bgpat, NULL); | |
| 13 | + | |
| 7 | 14 | struct RClass* wid_class = mrb_class_get(mrb, "WID"); |
| 8 | 15 | mrb_value wid_value = mrb_obj_value(wid_class); |
| 9 | - mrb_value real_value = mrb_fixnum_value(25); | |
| 16 | + mrb_value real_value = mrb_fixnum_value(wid); | |
| 17 | + | |
| 10 | 18 | return mrb_funcall(mrb, wid_value, "new", 1, real_value); |
| 11 | 19 | } |
| 12 | 20 |
| @@ -14,13 +22,16 @@ static mrb_value | ||
| 14 | 22 | mrb_cls_wnd(mrb_state *mrb, mrb_value self) |
| 15 | 23 | { |
| 16 | 24 | mrb_value s2, id_value; |
| 17 | - mrb_int real_value; | |
| 25 | + mrb_int wid; | |
| 18 | 26 | |
| 19 | 27 | mrb_get_args(mrb, "o", &s2); |
| 20 | 28 | |
| 21 | 29 | id_value = mrb_funcall(mrb, s2, "id", 0); |
| 22 | - real_value = mrb_fixnum(id_value); | |
| 23 | - printf("fixnum: %d\n", real_value); | |
| 30 | + wid = mrb_fixnum(id_value); | |
| 31 | + | |
| 32 | + wcls_wnd(wid, CLR); | |
| 33 | + printf("fixnum: %d\n", wid); | |
| 34 | + | |
| 24 | 35 | return self; |
| 25 | 36 | } |
| 26 | 37 |