libui 0.2.1-aarch64-linux → 0.3.0.pre-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46dd8a324e8f00193d0a24d23bcece4de9fc6526392e3506b3ec81543ff96bd5
4
- data.tar.gz: ac3ab3100f882d00d4e67f052ac1047495ae4e448eb4c63fdfd1069bf0ebda93
3
+ metadata.gz: c574d66c9aed94a75cc4f6be9736d5dd7690a6cf2f782c0a4ef5f0da7e3665e7
4
+ data.tar.gz: fe67f24b496f5b5db00202e54a1414496a6f2997d9bbad250b686cb15a000b0b
5
5
  SHA512:
6
- metadata.gz: 89ca6535da0b6cc404ceb8cc840bdb938ea6e688f4e68f2d63c33279af5ce9cf42e8f6d53dbfaed5463731dbc59e52d76a3e5e9faa8043de8c2874d2e2731004
7
- data.tar.gz: c8df2b43a9563013247315255faaf11a0c2b5ff6b4cbaf3fcc1b7fca416783cae781371eb7a8ef2751113ee2c51e38d8fe707749c2a1e768386150296de75007
6
+ metadata.gz: 4440a926c29fc84608e413e9a4bc1ce12cd399c948f0b514af7f201e2b94586c83b4155a088dd4cba4307522a1969b28c98eec5a68700a630c1f70bf0a274cf0
7
+ data.tar.gz: 6781e13639949e951110884515fb88f0f3124e8a1744b8e737c38c9bf2d6bf5fde2daec0ceaf87456ef8014669882bb8f729d5185fca8a274aa1c89db6a90a45
data/README.md CHANGED
@@ -1,18 +1,14 @@
1
1
  # LibUI
2
2
 
3
3
  [![test](https://github.com/kojix2/LibUI/actions/workflows/test.yml/badge.svg)](https://github.com/kojix2/LibUI/actions/workflows/test.yml)
4
- [![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
4
+ [![Gem Version](https://img.shields.io/badge/dynamic/json?label=gem%20version&query=%24%5B0%5D.number&url=https%3A%2F%2Frubygems.org%2Fapi%2Fv1%2Fversions%2Flibui.json&color=brightgreen)](https://rubygems.org/gems/libui/versions)
5
5
  <a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
6
6
  [![Pre-build](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml/badge.svg?branch=pre-build)](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml)
7
7
  [![Lines of Code](https://img.shields.io/endpoint?url=https%3A%2F%2Ftokei.kojix2.net%2Fbadge%2Fgithub%2Fkojix2%2FLibUI%2Flines)](https://tokei.kojix2.net/github/kojix2/LibUI)
8
8
 
9
9
  LibUI is a Ruby wrapper for libui family.
10
10
 
11
- :rocket: [libui-ng](https://github.com/libui-ng/libui-ng) - A cross-platform portable GUI library
12
-
13
- :wrench: [libui-dev](https://github.com/petabyt/libui-dev) - Native UI library for C - with some extras
14
-
15
- :radio_button: [libui](https://github.com/andlabs/libui) - Original version by andlabs.
11
+ :rocket: [libui-ng](https://github.com/kojix2/libui-ng) - A cross-platform portable GUI library
16
12
 
17
13
  ## Installation
18
14
 
@@ -86,7 +82,6 @@ LibUI is not object-oriented because it is a thin Ruby wrapper (binding) for the
86
82
  To build actual applications, it is recommended to use a DSL for LibUI, as they enable writing object-oriented code the Ruby way (instead of procedural code the C way):
87
83
 
88
84
  - [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
89
- - [libui_paradise](https://rubygems.org/gems/libui_paradise)
90
85
 
91
86
  ### Working with fiddle pointers
92
87
 
data/lib/libui/ffi.rb CHANGED
@@ -3,7 +3,6 @@ require_relative 'fiddle_patch'
3
3
  require_relative 'error'
4
4
 
5
5
  module LibUI
6
-
7
6
  module FFI
8
7
  extend Fiddle::Importer
9
8
  extend FiddlePatch
@@ -419,6 +418,7 @@ module LibUI
419
418
  try_extern 'void uiDrawClip(uiDrawContext *c, uiDrawPath *path)'
420
419
  try_extern 'void uiDrawSave(uiDrawContext *c)'
421
420
  try_extern 'void uiDrawRestore(uiDrawContext *c)'
421
+ try_extern 'void uiDrawImage(uiDrawContext *c, uiImage *img, double x, double y, double width, double height)'
422
422
 
423
423
  # uiAttribute
424
424
  try_extern 'void uiFreeAttribute(uiAttribute *a)'
@@ -582,6 +582,14 @@ module LibUI
582
582
  try_extern 'void uiFreeImage(uiImage *i)'
583
583
  try_extern 'void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int byteStride)'
584
584
 
585
+ # uiImageView
586
+ try_extern 'uiImageView *uiNewImageView(void)'
587
+ try_extern 'void uiImageViewSetImage(uiImageView *iv, const uiImage *image)'
588
+
589
+ typealias 'uiImageViewContentMode', 'int'
590
+
591
+ try_extern 'void uiImageViewSetContentMode(uiImageView *iv, uiImageViewContentMode mode)'
592
+
585
593
  # uiTable
586
594
  try_extern 'void uiFreeTableValue(uiTableValue *v)'
587
595
 
@@ -11,9 +11,9 @@ module LibUI
11
11
  def parse_signature(signature, tymap = nil)
12
12
  tymap ||= {}
13
13
  ctype, func, args = case compact(signature)
14
- when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
14
+ when /^(?:[\w*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
15
15
  [TYPE_VOIDP, Regexp.last_match(1), Regexp.last_match(2)]
16
- when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
16
+ when /^([\w*\s]+[*\s])(\w+)\((.*?)\);?$/
17
17
  [parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
18
18
  else
19
19
  raise("can't parse the function prototype: #{signature}")
@@ -22,12 +22,12 @@ module LibUI
22
22
  callback_argument_types = {} # Added
23
23
  argtype = split_arguments(args).collect.with_index do |arg, idx| # Added with_index
24
24
  # Check if it is a function pointer or not
25
- if arg =~ /\(\*.*\)\(.*\)/ # Added
25
+ if arg =~ /\(\*.*\)\(.*\)/ # Added
26
26
  # From the arguments, create a notation that looks like a function declaration
27
27
  # int(*f)(int *, void *) -> int f(int *, void *)
28
- func_arg = arg.sub('(*', ' ').sub(')', '') # Added
28
+ func_arg = arg.sub('(*', ' ').sub(')', '') # Added
29
29
  # Use Fiddle's parse_signature method again.
30
- callback_argument_types[idx] = parse_signature(func_arg) # Added
30
+ callback_argument_types[idx] = parse_signature(func_arg) # Added
31
31
  end
32
32
  parse_ctype(arg, tymap)
33
33
  end
@@ -41,8 +41,8 @@ module LibUI
41
41
  func = import_function(symname, ctype, argtype, opt[:call_type])
42
42
 
43
43
  # callback_argument_types
44
- func.instance_variable_set(:@callback_argument_types,
45
- callback_argument_types) # Added
44
+ func.instance_variable_set(:@callback_argument_types,
45
+ callback_argument_types) # Added
46
46
  # attr_reader
47
47
  def func.callback_argument_types
48
48
  @callback_argument_types
@@ -68,9 +68,9 @@ module LibUI
68
68
  @func_map[name] = func
69
69
  # define_method(name){|*args,&block| f.call(*args,&block)}
70
70
  begin
71
- /^(.+?):(\d+)/ =~ caller.first
72
- file = Regexp.last_match(1)
73
- line = Regexp.last_match(2).to_i
71
+ location = caller_locations(1, 1).first
72
+ file = location.path
73
+ line = location.lineno
74
74
  rescue StandardError
75
75
  file, line = __FILE__, __LINE__ + 3
76
76
  end
data/lib/libui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LibUI
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0.pre'
3
3
  end
data/lib/libui.rb CHANGED
@@ -351,6 +351,10 @@ module LibUI
351
351
  AtTrailing = 2
352
352
  AtBottom = 3
353
353
 
354
+ # ImageViewContentMode
355
+ ImageViewContentCenter = 0
356
+ ImageViewContentFit = 1
357
+
354
358
  # TableValueType
355
359
  TableValueTypeString = 0
356
360
  TableValueTypeImage = 1
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0.pre
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - kojix2