ext/nuklear/nkrb_context.c in nuklear-0.1.0 vs ext/nuklear/nkrb_context.c in nuklear-0.1.1
- old
+ new
@@ -218,17 +218,23 @@
rb_need_block();
rb_funcall_with_block(ui, rb_intern("instance_eval"), 0, NULL, rb_block_proc());
return ui;
}
+static VALUE nkrb_context_is_any_item_active(VALUE self) {
+ struct nk_context *ctx = nkrb_context_get(self);
+ return nk_item_is_any_active(ctx) ? Qtrue : Qfalse;
+}
+
void nkrb_context_init(void) {
cNuklearContext = rb_define_class_under(mNuklear, "Context", rb_cObject);
rb_define_alloc_func(cNuklearContext, nkrb_context_alloc);
rb_define_method(cNuklearContext, "user_data=", nkrb_context_set_user_data, 1);
rb_define_method(cNuklearContext, "user_data", nkrb_context_get_user_data, 0);
rb_define_method(cNuklearContext, "initialize", nkrb_context_initialize, 1);
rb_define_method(cNuklearContext, "tick", nkrb_context_tick, 0);
rb_define_method(cNuklearContext, "ui", nkrb_context_ui, 0);
+ rb_define_method(cNuklearContext, "any_item_active?", nkrb_context_is_any_item_active, 0);
cNuklearContextEventSink = rb_define_class_under(cNuklearContext, "EventSink", rb_cObject);
rb_define_method(cNuklearContextEventSink, "initialize", rb_nkrb_event_sink_initialize, 1);
rb_define_method(cNuklearContextEventSink, "motion", nkrb_event_sink_motion, 4);
rb_define_method(cNuklearContextEventSink, "key", nkrb_event_sink_key, 2);