kredki 0.1.0
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 +7 -0
- data/lib/kredki/core/application.rb +314 -0
- data/lib/kredki/core/color.rb +100 -0
- data/lib/kredki/core/event/block_event_reaction.rb +44 -0
- data/lib/kredki/core/event/composite_event_manager.rb +37 -0
- data/lib/kredki/core/event/event.rb +91 -0
- data/lib/kredki/core/event/event_manager.rb +60 -0
- data/lib/kredki/core/event/event_manager_jobs.rb +53 -0
- data/lib/kredki/core/event/event_reaction.rb +36 -0
- data/lib/kredki/core/event/family/drop_event.rb +40 -0
- data/lib/kredki/core/event/family/exit_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_enter_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_leave_event.rb +5 -0
- data/lib/kredki/core/event/family/hide_event.rb +5 -0
- data/lib/kredki/core/event/family/joystick_event.rb +102 -0
- data/lib/kredki/core/event/family/key_event.rb +40 -0
- data/lib/kredki/core/event/family/mouse_event.rb +190 -0
- data/lib/kredki/core/event/family/pastele_event.rb +11 -0
- data/lib/kredki/core/event/family/show_event.rb +5 -0
- data/lib/kredki/core/event/family/text_event.rb +23 -0
- data/lib/kredki/core/event/family/tick_event.rb +5 -0
- data/lib/kredki/core/event/family/update_complete_event.rb +5 -0
- data/lib/kredki/core/event/family/window_event.rb +108 -0
- data/lib/kredki/core/event/job_event_reaction.rb +44 -0
- data/lib/kredki/core/event/joystick_event_manager.rb +30 -0
- data/lib/kredki/core/event/keyboard_event_manager.rb +29 -0
- data/lib/kredki/core/event/method_event_reaction.rb +46 -0
- data/lib/kredki/core/event/mouse_event_manager.rb +27 -0
- data/lib/kredki/core/font.rb +53 -0
- data/lib/kredki/core/job/after_job.rb +59 -0
- data/lib/kredki/core/job/job.rb +108 -0
- data/lib/kredki/core/job/loop_job.rb +87 -0
- data/lib/kredki/core/job/play_animation_job.rb +44 -0
- data/lib/kredki/core/job/play_job.rb +41 -0
- data/lib/kredki/core/job/play_loop_animation_job.rb +98 -0
- data/lib/kredki/core/job/play_loop_job.rb +104 -0
- data/lib/kredki/core/job/side_job.rb +62 -0
- data/lib/kredki/core/kernel-path.rb +71 -0
- data/lib/kredki/core/kredki.rb +89 -0
- data/lib/kredki/core/linear_gradient.rb +43 -0
- data/lib/kredki/core/media/clipboard.rb +35 -0
- data/lib/kredki/core/media/joystick.rb +199 -0
- data/lib/kredki/core/media/keyboard.rb +84 -0
- data/lib/kredki/core/media/keyboard_modifiers_decoder.rb +154 -0
- data/lib/kredki/core/media/mouse.rb +197 -0
- data/lib/kredki/core/paint/animation.rb +247 -0
- data/lib/kredki/core/paint/area.rb +67 -0
- data/lib/kredki/core/paint/block_shape_area.rb +102 -0
- data/lib/kredki/core/paint/ellipse.rb +22 -0
- data/lib/kredki/core/paint/paint.rb +392 -0
- data/lib/kredki/core/paint/picture.rb +126 -0
- data/lib/kredki/core/paint/rectangle.rb +202 -0
- data/lib/kredki/core/paint/scene.rb +277 -0
- data/lib/kredki/core/paint/shape.rb +394 -0
- data/lib/kredki/core/paint/shape_area.rb +57 -0
- data/lib/kredki/core/paint/text.rb +222 -0
- data/lib/kredki/core/pastele/pastele-extern.rb +139 -0
- data/lib/kredki/core/pastele/pastele.rb +205 -0
- data/lib/kredki/core/radial_gradient.rb +45 -0
- data/lib/kredki/core/setup.rb +214 -0
- data/lib/kredki/core/window/pane.rb +178 -0
- data/lib/kredki/core/window/pane_event_manager.rb +44 -0
- data/lib/kredki/core/window/pane_events.rb +366 -0
- data/lib/kredki/core/window/window.rb +584 -0
- data/lib/kredki/core.rb +2 -0
- data/lib/kredki/hide.rb +9 -0
- data/lib/kredki/irb.rb +90 -0
- data/lib/kredki/module.rb +3 -0
- data/lib/kredki/pads/application.rb +13 -0
- data/lib/kredki/pads/button.rb +151 -0
- data/lib/kredki/pads/checkbox/checkbox.rb +68 -0
- data/lib/kredki/pads/checkbox/checkbox_button.rb +65 -0
- data/lib/kredki/pads/context/item.rb +65 -0
- data/lib/kredki/pads/context/item_group.rb +10 -0
- data/lib/kredki/pads/context/layer.rb +59 -0
- data/lib/kredki/pads/context/menu.rb +77 -0
- data/lib/kredki/pads/context/pad.rb +26 -0
- data/lib/kredki/pads/context/primary_layer.rb +51 -0
- data/lib/kredki/pads/context/secondary_layer.rb +60 -0
- data/lib/kredki/pads/item/item.rb +140 -0
- data/lib/kredki/pads/item/item_group.rb +44 -0
- data/lib/kredki/pads/item/item_x.rb +22 -0
- data/lib/kredki/pads/item/item_y.rb +31 -0
- data/lib/kredki/pads/label.rb +71 -0
- data/lib/kredki/pads/layer.rb +326 -0
- data/lib/kredki/pads/layout/align.rb +10 -0
- data/lib/kredki/pads/layout/layout.rb +88 -0
- data/lib/kredki/pads/layout/way.rb +99 -0
- data/lib/kredki/pads/layout/x_way.rb +119 -0
- data/lib/kredki/pads/layout/y_way.rb +120 -0
- data/lib/kredki/pads/list/item.rb +117 -0
- data/lib/kredki/pads/list/item_group.rb +36 -0
- data/lib/kredki/pads/list/pad.rb +74 -0
- data/lib/kredki/pads/list/tree/item.rb +138 -0
- data/lib/kredki/pads/list/tree/item_group.rb +86 -0
- data/lib/kredki/pads/list/tree/pad.rb +94 -0
- data/lib/kredki/pads/module.rb +11 -0
- data/lib/kredki/pads/note.rb +212 -0
- data/lib/kredki/pads/notes.rb +32 -0
- data/lib/kredki/pads/option/option.rb +121 -0
- data/lib/kredki/pads/option/option_item.rb +15 -0
- data/lib/kredki/pads/option/option_item_group.rb +16 -0
- data/lib/kredki/pads/option/option_layer.rb +81 -0
- data/lib/kredki/pads/pad/animation_pad.rb +106 -0
- data/lib/kredki/pads/pad/glyph_pad.rb +71 -0
- data/lib/kredki/pads/pad/pad.rb +1290 -0
- data/lib/kredki/pads/pad/pad_events.rb +358 -0
- data/lib/kredki/pads/pad/picture_pad.rb +89 -0
- data/lib/kredki/pads/pad/rectangle_pad.rb +181 -0
- data/lib/kredki/pads/pad/scroll_pad.rb +176 -0
- data/lib/kredki/pads/pad/shape_pad.rb +148 -0
- data/lib/kredki/pads/pad/space_pad.rb +33 -0
- data/lib/kredki/pads/pad/text_pad.rb +310 -0
- data/lib/kredki/pads/pane.rb +267 -0
- data/lib/kredki/pads/portal_layer.rb +94 -0
- data/lib/kredki/pads/radio/group.rb +45 -0
- data/lib/kredki/pads/radio/item.rb +69 -0
- data/lib/kredki/pads/radio/item_button.rb +143 -0
- data/lib/kredki/pads/service/event_queue.rb +79 -0
- data/lib/kredki/pads/service/service.rb +248 -0
- data/lib/kredki/pads/service/service_event_manager.rb +43 -0
- data/lib/kredki/pads/service/service_filter.rb +98 -0
- data/lib/kredki/pads/service/service_inherited.rb +48 -0
- data/lib/kredki/pads/setup.rb +36 -0
- data/lib/kredki/pads/slider/slider.rb +145 -0
- data/lib/kredki/pads/slider/slider_x.rb +41 -0
- data/lib/kredki/pads/slider/slider_y.rb +41 -0
- data/lib/kredki/pads/table/cell.rb +22 -0
- data/lib/kredki/pads/table/column.rb +63 -0
- data/lib/kredki/pads/table/column_layout.rb +88 -0
- data/lib/kredki/pads/table/pad.rb +116 -0
- data/lib/kredki/pads/table/row.rb +24 -0
- data/lib/kredki/pads/table/scroll_rows.rb +50 -0
- data/lib/kredki/pads/text/editable_text_verse.rb +77 -0
- data/lib/kredki/pads/text/editable_text_verses.rb +59 -0
- data/lib/kredki/pads/text/navigable_text_pad.rb +413 -0
- data/lib/kredki/pads/text/text_edition.rb +97 -0
- data/lib/kredki/pads/text/text_navigation.rb +109 -0
- data/lib/kredki/pads/toolbar/item.rb +62 -0
- data/lib/kredki/pads/toolbar/item_group.rb +22 -0
- data/lib/kredki/pads/toolbar/layer.rb +41 -0
- data/lib/kredki/pads/toolbar/pad.rb +51 -0
- data/lib/kredki/pads/toolbar/primary_layer.rb +64 -0
- data/lib/kredki/pads/window.rb +11 -0
- data/lib/kredki/script.rb +29 -0
- data/lib/kredki/setup.rb +2 -0
- data/lib/kredki/test.rb +35 -0
- data/lib/kredki.rb +10 -0
- data/lib/readme.md +31 -0
- data/stuff/config/config.rb +431 -0
- data/stuff/config/pads_config.rb +111 -0
- data/stuff/dll/SDL3.dll +0 -0
- data/stuff/dll/pastele.dll +0 -0
- data/stuff/dll/thorvg-1.dll +0 -0
- data/stuff/font/MartianMono-StdRg.ttf +0 -0
- data/stuff/font/MavenPro-Medium.ttf +0 -0
- data/stuff/font/MavenPro-Regular.ttf +0 -0
- data/stuff/glyph/alert-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/alert-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/archivebox-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-ccw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-cw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-rectangle-path-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-4-way-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-ccw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-cw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-from-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-right-arrow-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-to-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-trend-down-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-trend-up-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-turn-down-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-down-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-up-arrow-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/at-sign-svgrepo-com.svg +4 -0
- data/stuff/glyph/bag-svgrepo-com.svg +4 -0
- data/stuff/glyph/bell-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/bell-svgrepo-com.svg +5 -0
- data/stuff/glyph/book-open-svgrepo-com.svg +5 -0
- data/stuff/glyph/bookmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/box-svgrepo-com.svg +6 -0
- data/stuff/glyph/calendar-svgrepo-com.svg +5 -0
- data/stuff/glyph/camera-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cart-svgrepo-com.svg +6 -0
- data/stuff/glyph/chart-pie-svgrepo-com.svg +5 -0
- data/stuff/glyph/chartbar-2-svgrepo-com.svg +7 -0
- data/stuff/glyph/chartbar-svgrepo-com.svg +7 -0
- data/stuff/glyph/checkmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-double-svgrepo-com.svg +5 -0
- data/stuff/glyph/checkmark-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-left-chevron-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-up-chevron-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/clock-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-download-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-slash-svgrepo-com.svg +5 -0
- data/stuff/glyph/cloud-svgrepo-com.svg +4 -0
- data/stuff/glyph/columns-svgrepo-com.svg +5 -0
- data/stuff/glyph/command-svgrepo-com.svg +4 -0
- data/stuff/glyph/compass-svgrepo-com.svg +5 -0
- data/stuff/glyph/credit-card-svgrepo-com.svg +5 -0
- data/stuff/glyph/crop-svgrepo-com.svg +5 -0
- data/stuff/glyph/crown-svgrepo-com.svg +4 -0
- data/stuff/glyph/delete-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-desktop-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-mobile-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-tablet-svgrepo-com.svg +4 -0
- data/stuff/glyph/doc-svgrepo-com.svg +5 -0
- data/stuff/glyph/dot-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/dots-3-horizontal-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-3-vertical-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-6-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-6-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-9-svgrepo-com.svg +12 -0
- data/stuff/glyph/emoji-frown-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-meh-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-smile-svgrepo-com.svg +4 -0
- data/stuff/glyph/envelope-svgrepo-com.svg +5 -0
- data/stuff/glyph/external-link-svgrepo-com.svg +5 -0
- data/stuff/glyph/eye-slash-svgrepo-com.svg +15 -0
- data/stuff/glyph/eye-svgrepo-com.svg +4 -0
- data/stuff/glyph/filter-svgrepo-com.svg +4 -0
- data/stuff/glyph/flame-svgrepo-com.svg +4 -0
- data/stuff/glyph/floppy-disk-svgrepo-com.svg +4 -0
- data/stuff/glyph/folder-svgrepo-com.svg +4 -0
- data/stuff/glyph/fullscreen-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-svgrepo-com.svg +5 -0
- data/stuff/glyph/fullscreen-svgrepo-com.svg +5 -0
- data/stuff/glyph/gear-svgrepo-com.svg +4 -0
- data/stuff/glyph/giftbox-svgrepo-com.svg +6 -0
- data/stuff/glyph/half-star-svgrepo-com.svg +4 -0
- data/stuff/glyph/hashtag-svgrepo-com.svg +4 -0
- data/stuff/glyph/headphones-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-half-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-svgrepo-com.svg +4 -0
- data/stuff/glyph/house-svgrepo-com.svg +4 -0
- data/stuff/glyph/image-svgrepo-com.svg +4 -0
- data/stuff/glyph/info-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/key-svgrepo-com.svg +4 -0
- data/stuff/glyph/layers-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/layout-svgrepo-com.svg +6 -0
- data/stuff/glyph/line-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/link-alt-svgrepo-com.svg +5 -0
- data/stuff/glyph/link-svgrepo-com.svg +6 -0
- data/stuff/glyph/list-bullet-svgrepo-com.svg +9 -0
- data/stuff/glyph/location-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-open-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-svgrepo-com.svg +4 -0
- data/stuff/glyph/map-pin-svgrepo-com.svg +4 -0
- data/stuff/glyph/medal-svgrepo-com.svg +13 -0
- data/stuff/glyph/media-backward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-backward-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-play-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-play-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-2-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-svgrepo-com.svg +4 -0
- data/stuff/glyph/mic-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/mic-svgrepo-com.svg +5 -0
- data/stuff/glyph/minus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-svgrepo-com.svg +4 -0
- data/stuff/glyph/moon-svgrepo-com.svg +4 -0
- data/stuff/glyph/music-note-svgrepo-com.svg +4 -0
- data/stuff/glyph/nosign-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-clip-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-plane-svgrepo-com.svg +4 -0
- data/stuff/glyph/pen-tool-svgrepo-com.svg +4 -0
- data/stuff/glyph/pencil-svgrepo-com.svg +5 -0
- data/stuff/glyph/percent-svgrepo-com.svg +6 -0
- data/stuff/glyph/phone-incoming-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-missed-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-outgoing-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-slash-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-svgrepo-com.svg +4 -0
- data/stuff/glyph/power-svgrepo-com.svg +5 -0
- data/stuff/glyph/printer-svgrepo-com.svg +5 -0
- data/stuff/glyph/question-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/scissors-svgrepo-com.svg +5 -0
- data/stuff/glyph/search-svgrepo-com.svg +4 -0
- data/stuff/glyph/server-svgrepo-com.svg +5 -0
- data/stuff/glyph/shape-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-rhombus-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/share-svgrepo-com.svg +4 -0
- data/stuff/glyph/shield-slash-svgrepo-com.svg +13 -0
- data/stuff/glyph/shield-svgrepo-com.svg +4 -0
- data/stuff/glyph/shippingbox-svgrepo-com.svg +7 -0
- data/stuff/glyph/slider-3-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/slider-3-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/speaker-svgrepo-com.svg +4 -0
- data/stuff/glyph/speaker-wave-1-svgrepo-com.svg +5 -0
- data/stuff/glyph/speaker-wave-2-svgrepo-com.svg +6 -0
- data/stuff/glyph/speaker-xmark-svgrepo-com.svg +5 -0
- data/stuff/glyph/square-4-grid-svgrepo-com.svg +7 -0
- data/stuff/glyph/square-on-square-svgrepo-com.svg +5 -0
- data/stuff/glyph/star-svgrepo-com.svg +4 -0
- data/stuff/glyph/sun-svgrepo-com.svg +12 -0
- data/stuff/glyph/tag-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-align-center-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-justify-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-left-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-right-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-bold-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-heading-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-italic-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-underline-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/trash-svgrepo-com.svg +5 -0
- data/stuff/glyph/tray-svgrepo-com.svg +4 -0
- data/stuff/glyph/umbrela-svgrepo-com.svg +4 -0
- data/stuff/glyph/user-svgrepo-com.svg +5 -0
- data/stuff/glyph/users-svgrepo-com.svg +7 -0
- data/stuff/glyph/video-svgrepo-com.svg +12 -0
- data/stuff/glyph/waveform-ecg-svgrepo-com.svg +4 -0
- data/stuff/glyph/wi-fi-svgrepo-com.svg +7 -0
- data/stuff/glyph/xmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/zap-svgrepo-com.svg +4 -0
- data/stuff/glyph/zoom-in-svgrepo-com.svg +5 -0
- data/stuff/glyph/zoom-out-svgrepo-com.svg +5 -0
- data/stuff/readme.md +266 -0
- data/stuff/so/libSDL3.so +0 -0
- data/stuff/so/libpastele.so +0 -0
- data/stuff/so/libthorvg-1.so +0 -0
- metadata +427 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
## File generated from pastele/cabi.h
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
module Pastele
|
|
5
|
+
extern 'int thorvg_engine_init(int engine_method, int threads)'
|
|
6
|
+
extern 'int thorvg_engine_term(int engine_method)'
|
|
7
|
+
extern 'void sdl_init(int joystick_enabled)'
|
|
8
|
+
extern 'uint64_t sdl_get_ticks()'
|
|
9
|
+
extern 'void clipboard_set_text(char* text)'
|
|
10
|
+
extern 'char* clipboard_get_text( void)'
|
|
11
|
+
extern 'void clipboard_get_mime_types( void(*consumer)(char*))'
|
|
12
|
+
extern 'uint8_t keyboard_get_key_state(int keycode)'
|
|
13
|
+
extern 'uint16_t keyboard_get_mod_state( void)'
|
|
14
|
+
extern 'uint32_t mouse_get_button_state(int index)'
|
|
15
|
+
extern 'void mouse_get_cursor_position(Point* point)'
|
|
16
|
+
extern 'void mouse_set_capture(int set)'
|
|
17
|
+
extern 'void* mouse_create_system_cursor(int cursor)'
|
|
18
|
+
extern 'void mouse_set_cursor(SDL_Cursor* cursor)'
|
|
19
|
+
extern 'uint32_t joystick_open(int index)'
|
|
20
|
+
extern 'uint8_t joystick_get_button_state(int device_id, int button_index)'
|
|
21
|
+
extern 'int16_t joystick_get_axis_value(int device_id, int axis_index)'
|
|
22
|
+
extern 'void* application_new( void)'
|
|
23
|
+
extern 'void application_delete(pastele::Application* self)'
|
|
24
|
+
extern 'uint32_t application_insert_window(pastele::Application* self, pastele::Window* window)'
|
|
25
|
+
extern 'uint32_t application_erase_window(pastele::Application* self, pastele::Window* window)'
|
|
26
|
+
extern 'void application_set_event_handler(pastele::Application* self, int( *eventHandler)(int, SDL_Event*))'
|
|
27
|
+
extern 'void application_run(pastele::Application* self)'
|
|
28
|
+
extern 'void application_exit(pastele::Application* self)'
|
|
29
|
+
extern 'void* window_new_sw(int width, int height)'
|
|
30
|
+
extern 'void* window_new_gl(int width, int height)'
|
|
31
|
+
extern 'void window_delete(pastele::Window* self)'
|
|
32
|
+
extern 'void window_close(pastele::Window* self)'
|
|
33
|
+
extern 'void window_update_request(pastele::Window* self)'
|
|
34
|
+
extern 'void window_update(pastele::Window* self, int needResize)'
|
|
35
|
+
extern 'void window_show(pastele::Window* self)'
|
|
36
|
+
extern 'void window_hide(pastele::Window* self)'
|
|
37
|
+
extern 'void window_set_scene(pastele::Window* self, tvg::Scene* scene)'
|
|
38
|
+
extern 'void window_paint_to_update(pastele::Window* self, tvg::Paint* paint)'
|
|
39
|
+
extern 'void window_maximize(pastele::Window* self)'
|
|
40
|
+
extern 'void window_minimize(pastele::Window* self)'
|
|
41
|
+
extern 'void window_focus(pastele::Window* self)'
|
|
42
|
+
extern 'void window_restore(pastele::Window* self)'
|
|
43
|
+
extern 'void window_set_bordered(pastele::Window* self, int bordered)'
|
|
44
|
+
extern 'void window_set_fullscreen(pastele::Window* self, int fullscreen)'
|
|
45
|
+
extern 'void window_set_mouse_grab(pastele::Window* self, int grab)'
|
|
46
|
+
extern 'int window_get_mouse_grab(pastele::Window* self)'
|
|
47
|
+
extern 'void window_set_mouse_relative_mode(pastele::Window* self, int relative)'
|
|
48
|
+
extern 'int window_get_mouse_relative_mode(pastele::Window* self)'
|
|
49
|
+
extern 'void window_set_minimum_size(pastele::Window* self, int w, int h)'
|
|
50
|
+
extern 'void window_set_maximum_size(pastele::Window* self, int w, int h)'
|
|
51
|
+
extern 'void window_get_minimum_size(pastele::Window* self, IntPoint* point)'
|
|
52
|
+
extern 'void window_get_maximum_size(pastele::Window* self, IntPoint* point)'
|
|
53
|
+
extern 'void window_set_opacity(pastele::Window* self, float opacity)'
|
|
54
|
+
extern 'float window_get_opacity(pastele::Window* self)'
|
|
55
|
+
extern 'void window_set_position(pastele::Window* self, int x, int y)'
|
|
56
|
+
extern 'void window_set_resizable(pastele::Window* self, int resizable)'
|
|
57
|
+
extern 'void window_set_size(pastele::Window* self, int w, int h)'
|
|
58
|
+
extern 'void window_set_title(pastele::Window* self, char* title)'
|
|
59
|
+
extern 'const char* window_get_title(pastele::Window* self)'
|
|
60
|
+
extern 'void window_set_always_on_top(pastele::Window* self, int on_top)'
|
|
61
|
+
extern 'void window_get_size(pastele::Window* self, IntPoint* point)'
|
|
62
|
+
extern 'void window_get_position(pastele::Window* self, IntPoint* point)'
|
|
63
|
+
extern 'void window_set_text_input(pastele::Window* self, int input)'
|
|
64
|
+
extern 'int window_get_text_input(pastele::Window* self)'
|
|
65
|
+
extern 'int window_get_flags(pastele::Window* self)'
|
|
66
|
+
extern 'void window_surface_to_png(pastele::Window* self, const char* file)'
|
|
67
|
+
extern 'void window_get_display_bounds(pastele::Window* self, Bounds* bounds)'
|
|
68
|
+
extern 'void window_get_pixel_color(pastele::Window* self, int x, int y, IntPoint* rg, IntPoint* ba)'
|
|
69
|
+
extern 'void paint_delete(Paint* self)'
|
|
70
|
+
extern 'void paint_set_transform(Paint* self, float pivot_x, float pivot_y, float x, float y, float a, float zoom_x, float fy)'
|
|
71
|
+
extern 'void paint_set_opacity(Paint* self, uint8_t opacity)'
|
|
72
|
+
extern 'void paint_get_bounds(Paint* self, Bounds* bounds)'
|
|
73
|
+
extern 'void paint_set_clip(Paint* self, Shape* clipper)'
|
|
74
|
+
extern 'void paint_set_mask(Paint* self, Paint* target, int mask)'
|
|
75
|
+
extern 'void paint_set_blend_method(Paint* self, int method)'
|
|
76
|
+
extern 'void paint_accessor_traverse(Paint* self, int(*callback)(const tvg::Paint* paint, void* data))'
|
|
77
|
+
extern 'int paint_get_type(Paint* self)'
|
|
78
|
+
extern 'void* shape_new( void)'
|
|
79
|
+
extern 'void shape_delete(Shape* self)'
|
|
80
|
+
extern 'void shape_reset(Shape* self)'
|
|
81
|
+
extern 'void shape_move_to(Shape* self, float x, float y)'
|
|
82
|
+
extern 'void shape_line_to(Shape* self, float x, float y)'
|
|
83
|
+
extern 'void shape_cubic_to(Shape* self, float cx1, float cy1, float cx2, float cy2, float x, float y)'
|
|
84
|
+
extern 'void shape_close(Shape* self)'
|
|
85
|
+
extern 'void shape_append_rect(Shape* self, float x, float y, float w, float h)'
|
|
86
|
+
extern 'void shape_append_circle(Shape* self, float cx, float cy, float rx, float ry)'
|
|
87
|
+
extern 'void shape_append_round_rect(Shape* self, float x, float y, float w, float h, float corner_ss, float corner_se, float corner_es, float corner_ee)'
|
|
88
|
+
extern 'void shape_set_stroke_width(Shape* self, float width)'
|
|
89
|
+
extern 'void shape_set_stroke_color(Shape* self, uint8_t r, uint8_t g, uint8_t b, uint8_t a)'
|
|
90
|
+
extern 'void shape_set_stroke_linear_gradient(Shape* self, float x, float y, float ex, float ey, const uint8_t* colors, const float* offsets, uint32_t cnt, int spread)'
|
|
91
|
+
extern 'void shape_set_stroke_radial_gradient(Shape* self, float cx, float cy, float r, float fx, float fy, float fr, const uint8_t* colors, const float* offsets, uint32_t cnt, int spread)'
|
|
92
|
+
extern 'void shape_set_stroke_dash(Shape* self, const float* dashPattern, uint32_t cnt, float offset)'
|
|
93
|
+
extern 'void shape_set_stroke_cap(Shape* self, int cap)'
|
|
94
|
+
extern 'void shape_set_stroke_join(Shape* self, int join)'
|
|
95
|
+
extern 'void shape_set_stroke_miterlimit(Shape* self, float miterlimit)'
|
|
96
|
+
extern 'void shape_set_stroke_trim(Shape* self, float begin, float end, int simultaneous)'
|
|
97
|
+
extern 'void shape_set_fill_color(Shape* self, uint8_t r, uint8_t g, uint8_t b, uint8_t a)'
|
|
98
|
+
extern 'void shape_set_fill_rule(Shape* self, int rule)'
|
|
99
|
+
extern 'void shape_set_paint_order(Shape* self, int strokeFirst)'
|
|
100
|
+
extern 'void shape_set_fill(Shape* self, Fill* fill)'
|
|
101
|
+
extern 'void shape_set_fill_linear_gradient(Shape* self, float x, float y, float ex, float ey, const uint8_t* colors, const float* offsets, uint32_t cnt, int spread)'
|
|
102
|
+
extern 'void shape_set_fill_radial_gradient(Shape* self, float cx, float cy, float r, float fx, float fy, float fr, const uint8_t* colors, const float* offsets, uint32_t cnt, int spread)'
|
|
103
|
+
extern 'Picture* picture_new( void)'
|
|
104
|
+
extern 'int picture_load(Picture* self, const char* path)'
|
|
105
|
+
extern 'void picture_set_size(Picture* self, float w, float h)'
|
|
106
|
+
extern 'void picture_get_size(Picture* self, Point* size)'
|
|
107
|
+
extern 'void* picture_accessor_get(Picture* self, const char* id)'
|
|
108
|
+
extern 'void* scene_new( void)'
|
|
109
|
+
extern 'void scene_delete(Scene* self)'
|
|
110
|
+
extern 'void scene_add(Scene* self, Paint* paint, Paint* at)'
|
|
111
|
+
extern 'void scene_remove(Scene* self, Paint* paint)'
|
|
112
|
+
extern 'void scene_clear_effects(Scene* self)'
|
|
113
|
+
extern 'void scene_add_gaussian_blur(Scene* self, double sigma, int direction, int border, int quality)'
|
|
114
|
+
extern 'void scene_add_drop_shadow(Scene* self, int r, int g, int b, int a, double angle, double distance, double blurSigma, int quality)'
|
|
115
|
+
extern 'void scene_add_fill(Scene* self, int r, int g, int b, int a)'
|
|
116
|
+
extern 'void scene_add_tint(Scene* self, int br, int bg, int bb, int wr, int wg, int wb, double intensity)'
|
|
117
|
+
extern 'void scene_add_tritone(Scene* self, int sr, int sg, int sb, int mr, int mg, int mb, int hr, int hg, int hb, int blend)'
|
|
118
|
+
extern 'void* text_new( void)'
|
|
119
|
+
extern 'void text_delete(Text* self)'
|
|
120
|
+
extern 'void text_set_font(Text* self, const char* fontName)'
|
|
121
|
+
extern 'void text_set_size(Text* self, float size)'
|
|
122
|
+
extern 'void text_set_text(Text* self, const char* text)'
|
|
123
|
+
extern 'void text_set_fill_color(Text* self, uint8_t r, uint8_t g, uint8_t b)'
|
|
124
|
+
extern 'void text_set_fill_linear_gradient(Text* self, float x, float y, float ex, float ey, const uint8_t* colors, const float* offsets, uint32_t cnt, int spread)'
|
|
125
|
+
extern 'void text_set_fill_radial_gradient(Text* self, float cx, float cy, float r, float fx, float fy, float fr, const uint8_t* colors, const float* offsets, uint32_t cnt, int spread)'
|
|
126
|
+
extern 'void text_set_outline(Text* self, float width, uint8_t r, uint8_t g, uint8_t b)'
|
|
127
|
+
extern 'float text_get_text_width(Text* self, const char* text, int indexLimit)'
|
|
128
|
+
extern 'int text_nearest_character_index(Text* self, const char* text, float widthLimit)'
|
|
129
|
+
extern 'int font_load(const char* path)'
|
|
130
|
+
extern 'int font_unload(const char* path)'
|
|
131
|
+
extern 'Animation* animation_new( void)'
|
|
132
|
+
extern 'void animation_set_frame(Animation* self, float no)'
|
|
133
|
+
extern 'Paint* animation_get_picture(Animation* self)'
|
|
134
|
+
extern 'float animation_get_total_frames(Animation* self)'
|
|
135
|
+
extern 'float animation_get_duration(Animation* self)'
|
|
136
|
+
extern 'void animation_set_segment(Animation* self, float begin, float end)'
|
|
137
|
+
extern 'void animation_delete(Animation* self)'
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
require 'fiddle/import'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
module Pastele
|
|
5
|
+
extend Fiddle::Importer
|
|
6
|
+
if Kredki.unit_test_mode
|
|
7
|
+
class << self
|
|
8
|
+
alias_method :o_extern, :extern
|
|
9
|
+
|
|
10
|
+
def extern function
|
|
11
|
+
function = o_extern(function).name
|
|
12
|
+
class_eval <<~RUBY
|
|
13
|
+
class << self
|
|
14
|
+
alias_method :o_#{function}, :#{function}
|
|
15
|
+
def #{function} *a
|
|
16
|
+
calls << [:#{function}, *a]
|
|
17
|
+
o_#{function} *a
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
RUBY
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
attr_accessor :calls
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
self.calls = []
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
current_lib = nil
|
|
31
|
+
begin
|
|
32
|
+
dlload (current_lib = Kredki.sdl || raise("SDL shared library setup is missing"))
|
|
33
|
+
dlload (current_lib = Kredki.thorvg || raise("ThorVG shared library setup is missing"))
|
|
34
|
+
dlload (current_lib = Kredki.pastele || raise("Pastele shared library setup is missing"))
|
|
35
|
+
|
|
36
|
+
rescue LoadError
|
|
37
|
+
raise LoadError, "Could not load #{current_lib}"
|
|
38
|
+
rescue Fiddle::DLError
|
|
39
|
+
raise Fiddle::DLError, "Could not load #{current_lib}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
UserEvent = struct [
|
|
43
|
+
'uint32_t type',
|
|
44
|
+
'uint32_t reserved',
|
|
45
|
+
'uint64_t timestamp',
|
|
46
|
+
'uint32_t window_id',
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
KeyboardEvent = struct [
|
|
50
|
+
'uint32_t type',
|
|
51
|
+
'uint32_t reserved',
|
|
52
|
+
'uint64_t timestamp',
|
|
53
|
+
'uint32_t window_id',
|
|
54
|
+
'uint32_t keyboard_id',
|
|
55
|
+
'int scancode',
|
|
56
|
+
'int sym',
|
|
57
|
+
'uint16_t mod',
|
|
58
|
+
'uint16_t raw',
|
|
59
|
+
# 'bool down',
|
|
60
|
+
# 'bool repeat',
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
MouseMotionEvent = struct [
|
|
64
|
+
'uint32_t type',
|
|
65
|
+
'uint32_t reserved',
|
|
66
|
+
'uint64_t timestamp',
|
|
67
|
+
'uint32_t window_id',
|
|
68
|
+
'uint32_t which',
|
|
69
|
+
'uint32_t state',
|
|
70
|
+
'float x',
|
|
71
|
+
'float y',
|
|
72
|
+
'float xrel',
|
|
73
|
+
'float yrel',
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
MouseButtonEvent = struct [
|
|
77
|
+
'uint32_t type',
|
|
78
|
+
'uint32_t reserved',
|
|
79
|
+
'uint64_t timestamp',
|
|
80
|
+
'uint32_t window_id',
|
|
81
|
+
'uint32_t which',
|
|
82
|
+
'uint8_t button',
|
|
83
|
+
'uint8_t down', # bool
|
|
84
|
+
'uint8_t clicks',
|
|
85
|
+
'uint8_t padding1', #unused
|
|
86
|
+
'float x',
|
|
87
|
+
'float y',
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
MouseWheelEvent = struct [
|
|
91
|
+
'uint32_t type',
|
|
92
|
+
'uint32_t reserved',
|
|
93
|
+
'uint64_t timestamp',
|
|
94
|
+
'uint32_t window_id',
|
|
95
|
+
'uint32_t which',
|
|
96
|
+
'float x',
|
|
97
|
+
'float y',
|
|
98
|
+
'uint32_t direction',
|
|
99
|
+
'float mouse_x',
|
|
100
|
+
'float mouse_y',
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
WindowEvent = struct [
|
|
104
|
+
'uint32_t type',
|
|
105
|
+
'uint32_t reserved',
|
|
106
|
+
'uint64_t timestamp',
|
|
107
|
+
'uint32_t window_id',
|
|
108
|
+
'int32_t data1',
|
|
109
|
+
'int32_t data2',
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
DisplayEvent = struct [
|
|
113
|
+
'uint32_t type',
|
|
114
|
+
'uint32_t reserved',
|
|
115
|
+
'uint64_t timestamp',
|
|
116
|
+
'uint32_t display',
|
|
117
|
+
'int32_t data1',
|
|
118
|
+
'int32_t data2',
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
TextInputEvent = struct [
|
|
122
|
+
'uint32_t type',
|
|
123
|
+
'uint32_t reserved',
|
|
124
|
+
'uint64_t timestamp',
|
|
125
|
+
'uint32_t window_id',
|
|
126
|
+
'char* text'
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
DropEvent = struct [
|
|
130
|
+
'uint32_t type',
|
|
131
|
+
'uint32_t reserved',
|
|
132
|
+
'uint64_t timestamp',
|
|
133
|
+
'uint32_t window_id',
|
|
134
|
+
'float x',
|
|
135
|
+
'float y',
|
|
136
|
+
'char* source',
|
|
137
|
+
'char* data',
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
QuitEvent = struct [
|
|
141
|
+
'uint32_t type',
|
|
142
|
+
'uint32_t reserved',
|
|
143
|
+
'uint64_t timestamp',
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
JoyDeviceEvent = struct [
|
|
147
|
+
'uint32_t type',
|
|
148
|
+
'uint32_t reserved',
|
|
149
|
+
'uint64_t timestamp',
|
|
150
|
+
'uint32_t which',
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
JoyButtonEvent = struct [
|
|
154
|
+
'uint32_t type',
|
|
155
|
+
'uint32_t reserved',
|
|
156
|
+
'uint64_t timestamp',
|
|
157
|
+
'uint32_t which',
|
|
158
|
+
'uint8_t button',
|
|
159
|
+
'uint8_t down' # bool
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
JoyAxisEvent = struct [
|
|
163
|
+
'uint32_t type',
|
|
164
|
+
'uint32_t reserved',
|
|
165
|
+
'uint64_t timestamp',
|
|
166
|
+
'uint32_t which',
|
|
167
|
+
'uint8_t axis',
|
|
168
|
+
'uint8_t padding1', #unused
|
|
169
|
+
'uint8_t padding2', #unused
|
|
170
|
+
'uint8_t padding3', #unused
|
|
171
|
+
'int16_t value'
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
JoyHatEvent = struct [
|
|
175
|
+
'uint32_t type',
|
|
176
|
+
'uint32_t reserved',
|
|
177
|
+
'uint64_t timestamp',
|
|
178
|
+
'uint32_t which',
|
|
179
|
+
'uint8_t hat',
|
|
180
|
+
'uint8_t value',
|
|
181
|
+
'uint8_t padding1', #unused
|
|
182
|
+
'uint8_t padding2', #unused
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
Bounds = struct [
|
|
186
|
+
'float x',
|
|
187
|
+
'float y',
|
|
188
|
+
'float w',
|
|
189
|
+
'float h',
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
Point = struct [
|
|
193
|
+
'float x',
|
|
194
|
+
'float y'
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
IntPoint = struct [
|
|
198
|
+
'int x',
|
|
199
|
+
'int y',
|
|
200
|
+
]
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
require_relative 'pastele-extern'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
class RadialGradient
|
|
3
|
+
|
|
4
|
+
def initialize colors, cx, cy, r, fx = cx, fy = cy, fr = 0, offsets: nil, spread: nil
|
|
5
|
+
@fx = fx
|
|
6
|
+
@fy = fy
|
|
7
|
+
@fr = fr
|
|
8
|
+
@cx = cx
|
|
9
|
+
@cy = cy
|
|
10
|
+
@r = r
|
|
11
|
+
@colors = colors
|
|
12
|
+
@offsets = offsets
|
|
13
|
+
@spread = spread
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.[](...)
|
|
17
|
+
self.new(...)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# :section: LEVEL 2
|
|
21
|
+
|
|
22
|
+
def inspect
|
|
23
|
+
"#{self.class}:#{object_id}"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def ffi
|
|
27
|
+
rgbas = @colors.map{|color| Kredki.color(color).to_rgba }.flatten
|
|
28
|
+
offsets = @offsets || (0...@colors.size).map{|it| it.to_f / (@colors.size - 1) }
|
|
29
|
+
spread = case @spread
|
|
30
|
+
when :pad, nil, 0 then 0
|
|
31
|
+
when :reflect, 1 then 1
|
|
32
|
+
when :repeat, 2 then 2
|
|
33
|
+
else raise_is @spread
|
|
34
|
+
end
|
|
35
|
+
[
|
|
36
|
+
@cx, @cy, @r, @fx, @fy, @fr,
|
|
37
|
+
Fiddle::Pointer[rgbas.pack "C*"],
|
|
38
|
+
Fiddle::Pointer[offsets.pack "f*"],
|
|
39
|
+
@colors.size,
|
|
40
|
+
spread
|
|
41
|
+
]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end#RadialGradient
|
|
45
|
+
end#Kredki
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
require_relative 'kernel-path'
|
|
2
|
+
require_relative 'media/clipboard'
|
|
3
|
+
require_relative 'media/keyboard_modifiers_decoder'
|
|
4
|
+
require_relative 'media/keyboard'
|
|
5
|
+
require_relative 'media/mouse'
|
|
6
|
+
require_relative 'media/joystick'
|
|
7
|
+
require_relative 'color'
|
|
8
|
+
require_relative 'font'
|
|
9
|
+
require_relative 'linear_gradient'
|
|
10
|
+
require_relative 'radial_gradient'
|
|
11
|
+
|
|
12
|
+
module Kredki
|
|
13
|
+
Not = :not
|
|
14
|
+
|
|
15
|
+
class << self
|
|
16
|
+
|
|
17
|
+
# Kredki root directory.
|
|
18
|
+
def dir
|
|
19
|
+
File.expand_path "../../../..", __FILE__
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Run the app or get the app if it is already running.
|
|
23
|
+
def app opened = nil, *a, **ka, &block
|
|
24
|
+
if !@init
|
|
25
|
+
Pastele.thorvg_engine_init 2, 4
|
|
26
|
+
Pastele.sdl_init joystick ? 1 : 0
|
|
27
|
+
@init = true
|
|
28
|
+
end
|
|
29
|
+
@app = @app_class.new if !@app
|
|
30
|
+
if opened || block
|
|
31
|
+
@app.open opened, *a, **ka, &block
|
|
32
|
+
return @app.run
|
|
33
|
+
end
|
|
34
|
+
@app
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def app= app_class
|
|
38
|
+
@app_class = app_class
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Milliseconds since SDL was initialized.
|
|
42
|
+
def ms
|
|
43
|
+
Pastele.sdl_get_ticks * 0.000001
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Set clipboard model.
|
|
47
|
+
def clipboard! clipboard = nil
|
|
48
|
+
@clipboard = clipboard || Clipboard.new
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get clipboard model.
|
|
52
|
+
def clipboard
|
|
53
|
+
@clipboard
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Set keyboard model.
|
|
57
|
+
def keyboard! keyboard = nil, **ka, &b
|
|
58
|
+
@keyboard = keyboard || Keyboard.new
|
|
59
|
+
@keyboard.set **ka, &b
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Get keyboard model.
|
|
63
|
+
def keyboard
|
|
64
|
+
@keyboard
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Set mouse model.
|
|
68
|
+
def mouse! mouse = nil, **ka, &b
|
|
69
|
+
@mouse = mouse || Mouse.new
|
|
70
|
+
@mouse.set **ka, &b
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Get mouse model.
|
|
74
|
+
def mouse
|
|
75
|
+
@mouse
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Set joystick model.
|
|
79
|
+
def joystick! key = nil, joystick = nil, **ka, &b
|
|
80
|
+
(@joysticks[key] = joystick || Joystick.new).set **ka, &b
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Get joystick model.
|
|
84
|
+
def joystick key = nil
|
|
85
|
+
@joysticks[key] or raise "Joystick #{key.inspect} not registered"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Set font.
|
|
89
|
+
def font! key, path
|
|
90
|
+
@fonts[key] = Font.new path
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Get font.
|
|
94
|
+
def font param = nil
|
|
95
|
+
case param
|
|
96
|
+
when nil
|
|
97
|
+
@fonts.each_value&.first or raise "No fonts loaded"
|
|
98
|
+
when Font
|
|
99
|
+
param
|
|
100
|
+
when :random
|
|
101
|
+
@fonts.values.sample or raise "No fonts loaded"
|
|
102
|
+
when String
|
|
103
|
+
@fonts.each_value.find{|it| it.name == param || it.path == param } or raise "Unknown font #{param.inspect}"
|
|
104
|
+
else
|
|
105
|
+
@fonts.itself[param] or raise "Unknown font #{param.inspect}"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Set color.
|
|
110
|
+
def color! id, *a
|
|
111
|
+
@colors[id] = Color.parse *a
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Get color.
|
|
115
|
+
def color param = nil
|
|
116
|
+
case param
|
|
117
|
+
when nil
|
|
118
|
+
@colors.each_value.first || Color.new(255, 255, 255)
|
|
119
|
+
when Color
|
|
120
|
+
param
|
|
121
|
+
when :random
|
|
122
|
+
Color.new rand(255), rand(255), rand(255)
|
|
123
|
+
when Array
|
|
124
|
+
if param.size == 2
|
|
125
|
+
color(param[0]).clarify param[1]
|
|
126
|
+
else
|
|
127
|
+
Color.new *param
|
|
128
|
+
end
|
|
129
|
+
else
|
|
130
|
+
@colors[param] or raise "Unknown color #{param}"
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Get fill.
|
|
135
|
+
def fill param
|
|
136
|
+
case param
|
|
137
|
+
when LinearGradient, RadialGradient
|
|
138
|
+
param
|
|
139
|
+
else
|
|
140
|
+
color param
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# Set glyph.
|
|
146
|
+
def glyph! key, path
|
|
147
|
+
@glyphs[key] = path
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Get glyph.
|
|
151
|
+
def glyph param = nil
|
|
152
|
+
case param
|
|
153
|
+
when :random
|
|
154
|
+
@glyphs.values.sample or raise "No glyphs loaded"
|
|
155
|
+
when String
|
|
156
|
+
param
|
|
157
|
+
else
|
|
158
|
+
@glyphs[param] or raise "Unknown glyph #{param.inspect}"
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Get relative scroll value
|
|
163
|
+
def relative_scroll x, y
|
|
164
|
+
mouse = self.mouse
|
|
165
|
+
keyboard = self.keyboard
|
|
166
|
+
|
|
167
|
+
jump = keyboard.alt? ? mouse.scroll_speed_alt : mouse.scroll_speed
|
|
168
|
+
keyboard.shift? ? [y * jump, x * jump] : [x * jump, y * jump]
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# :section: LEVEL 2
|
|
172
|
+
|
|
173
|
+
def clear_app
|
|
174
|
+
@app = nil
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
attr_accessor :joysticks
|
|
178
|
+
attr_accessor :opened_joysticks
|
|
179
|
+
attr_accessor :fonts
|
|
180
|
+
attr_accessor :colors
|
|
181
|
+
attr_accessor :glyphs
|
|
182
|
+
|
|
183
|
+
attr_accessor :sdl
|
|
184
|
+
attr_accessor :thorvg
|
|
185
|
+
attr_accessor :pastele
|
|
186
|
+
|
|
187
|
+
attr_accessor :engine
|
|
188
|
+
attr_accessor :config
|
|
189
|
+
attr_accessor :unit_test_mode
|
|
190
|
+
|
|
191
|
+
attr_accessor :text_size
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
self.colors = {}
|
|
195
|
+
self.fonts = {}
|
|
196
|
+
self.glyphs = {}
|
|
197
|
+
self.joysticks = {}
|
|
198
|
+
self.opened_joysticks = {}
|
|
199
|
+
|
|
200
|
+
case RUBY_PLATFORM
|
|
201
|
+
when /cygwin|mswin|mingw|bccwin|wince|emx/
|
|
202
|
+
self.sdl = "#{dir}/stuff/dll/SDL3.dll"
|
|
203
|
+
self.thorvg = "#{dir}/stuff/dll/thorvg-1.dll"
|
|
204
|
+
self.pastele = "#{dir}/stuff/dll/pastele.dll"
|
|
205
|
+
when /linux/
|
|
206
|
+
self.sdl = "#{dir}/stuff/so/libSDL3.so"
|
|
207
|
+
self.thorvg = "#{dir}/stuff/so/libthorvg-1.so"
|
|
208
|
+
self.pastele = "#{dir}/stuff/so/libpastele.so"
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
self.engine = :sw
|
|
212
|
+
self.config = "#{dir}/stuff/config/config.rb"
|
|
213
|
+
self.text_size = 20
|
|
214
|
+
end
|