all repos — min @ 60f839a52b1850f134c3e4b33439d327d83d77ac

A small but practical concatenative programming language.

Started documenting gui module.
h3rald h3rald@h3rald.com
Mon, 11 Nov 2024 15:08:42 +0100
commit

60f839a52b1850f134c3e4b33439d327d83d77ac

parent

178ec3d0d7b1fbf97efaa4626cb214068a00b401

M minpkg/lib/min_gui.nimminpkg/lib/min_gui.nim

@@ -129,7 +129,7 @@ aud.objType = "audio"

AUDIO.add audio i.push aud - def.symbol("audio?") do (i: In): + def.symbol("samples") do (i: In): var vals = i.expect("dict:audio") i.push (i.audio(vals[0]).available).newVal
M next-release.mdnext-release.md

@@ -1,4 +1,5 @@

### Fixes and Improvements -* Implemented a simple `gui` module based on [Fenster](https://github.com/zserge/fenster) and [Fenstim](https://github.com/CardealRusso/fenstim). +* Implemented a simple `gui` module based on [Fenster](https://zserge.com/posts/fenster/) and [Fenstim](https://github.com/CardealRusso/fenstim) (Closes #70). +* Fixed compilation of dictionary literals (Closes #194).
M site/assets/styles/min-lang.csssite/assets/styles/min-lang.css

@@ -193,6 +193,11 @@ h3 {

font-size: 1.2rem; } +ul, +ol { + margin-left: 1rem; +} + .pitch { font-size: 1.2em; }
M site/contents/_defs_.mdsite/contents/_defs_.md

@@ -65,6 +65,8 @@ {{xentity => [dict:xml-entity](class:kwd)}}

{{xcdata => [dict:xml-cdata](class:kwd)}} {{xtext => [dict:xml-text](class:kwd)}} {{xnode => [xml-node](class:kwd)}} +{{window => [dict:window](class:kwd)}} +{{audio => [dict:audio](class:kwd)}} {{pcre => [Perl Compatible Regular Expression](https://www.pcre.org/)}}
M site/contents/reference-global.mdsite/contents/reference-global.md

@@ -756,7 +756,7 @@ > > Note

> > > > You must call `randomize` to initialize the random number generator, otherwise the same sequence of numbers will be returned.#} -{#op||randomize||{{none}}||{{null}|| +{#op||randomize||{{none}}||{{null}}|| Initializes the random number generator using a seed based on the current timestamp. #} {#op||range||{{q2}}||{{q2}}||
A site/contents/reference-gui.md

@@ -0,0 +1,77 @@

+----- +content-type: "page" +title: "gui Module" +----- +{@ _defs_.md || 0 @} + +{#op||audio||{{none}}||{{audio}}|| +... +#} + +{#op||clear||{{window}}||{{none}}|| +... +#} + +{#op||close||{{window}}||{{none}}|| +... +#} + +{#op||draw||{{window}} {{q}} {{i}}||{{none}}|| +... +#} + +{#op||height||{{window}}||{{i}}|| +... +#} + +{#op||keys||{{window}}||{{i}}|| +... +#} + +{#op||loop||{{window}} {{q}}||{{none}}|| +... +#} + +{#op||modkey||{{window}}||{{i}}|| +... +#} + +{#op||mouse||{{window}}||{{i}}|| +... +#} + +{#op||pixel||{{window}} {{q}}||{{none}}|| +... +#} + +{#op||play||{{audio}} {{q}}||{{none}}|| +... +#} + +{#op||samples||{{audio}}||{{i}}|| +... +#} + +{#op||sleep||{{window}}||{{i}}|| +... +#} + +{#op||stop||{{audio}}||{{none}}|| +... +#} + +{#op||time||{{window}}||{{i}}|| +... +#} + +{#op||width||{{window}}||{{i}}|| +... +#} + +{#op||window||{{d}}||{{window}}|| +Creates a new window by specifying a dictionary containing the following keys: + +* title +* width +* height +* fps (default: 60) #}
M site/contents/reference.mdsite/contents/reference.md

@@ -15,6 +15,8 @@ {#link-module||dict#}

: Defines operators for dictionaries, like `dict.get`, `dict.dup`, `dict.set`, etc. {#link-module||fs#} : Provides operators for reading and writing files, and accessing file information and properties. +{#link-module||gui#} +: Provides operators for creating simple graphical user interfaces by drawing pixels, managing mouse clicks, key presses, and simple audio. {#link-module||http#} : Provides operators to perform HTTP requests, download files and create basic HTTP servers. {#link-module||io#}

@@ -208,6 +210,24 @@ {{xnode}}

: A typealias to identify all XML dictionary types. dict:xml-element||dict:xml-text||dict:xml-comment||dict:xml-entity||dict:xml-cdata +{{window}} +: A dictionary representing a GUI window. + + { + "Audio Test" :title + 60 :fps + 320 :height + 320 :width + 0 :ref + ;window + } +{{audio}} +: A dictionary representing the system audio device. + + { + 0 :ref + ;audio + } ### Suffixes