Sha256: f3a5d3058188cb2bf61323aa4415059e219639ab8820d3bfe252b058cd22e7d9

Contents?: true

Size: 607 Bytes

Versions: 4

Compression:

Stored size: 607 Bytes

Contents

#include "nkrb.h"

VALUE nkrb_ui_color_picker(VALUE self, VALUE rcontext, VALUE rcolor, VALUE rtype) {
  struct nk_context *ctx = nkrb_context_get(rcontext);
  enum nk_color_format type = (SYM2ID(rtype) == rb_intern("rgb")) ? NK_RGB : NK_RGBA;
  struct nk_style_item *style = nkrb_style_item(rcolor);
  struct nk_color color;
  ASSIGN_STYLE_AS_COLOR(color, style);

  if (nk_color_pick(ctx, &color, type)) {
    style->data.color = color;
    return rcolor;
  }

  return Qnil;
}

void nkrb_ui_color_picker_init(void) {
  rb_define_method(mNuklearUIContainer, "ui_color_picker", nkrb_ui_color_picker, 3);
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nuklear-0.1.3 ext/nuklear/nkrb_ui_color_picker.c
nuklear-0.1.2 ext/nuklear/nkrb_ui_color_picker.c
nuklear-0.1.1 ext/nuklear/nkrb_ui_color_picker.c
nuklear-0.1.0 ext/nuklear/nkrb_ui_color_picker.c