You thought it will look clunky? Nope. It looks exactly like OOP UI, just without the limitations of OOP. In database everything can inherit everything.
Name:
Anonymous2023-03-17 22:59
implementation of the button widget (it resizes to match the text and font) //yeah, georgia.ttf is boring, but it works cls button.wgt(XY!XY WH!WH) text onClick!0 XY!0,0 WH!120,25 pressed!0 over!0 font!georgia adapt!1 adaptText!0 adaptFont!0 @draw FB = X,Y,W,H $rect FH H //font height if $pressed: Y += 1 if $adapt and $font <> $adaptFont and $text <> adaptText: $adaptText = $text $adaptFont = $font NW 2 + | get_font($font).width FH $text if W-2 < NW: W = NW $wh = W,H BC if $over: RGB_DIM else RGB_GRAY OC if $over: RGB_AGATE else RGB_DIM FB.rectangle BC 1 X Y W H FB.rectangle OC 0 X Y W H FB.rectangle OC 0 X+1 Y+1 W-2 H-2 FB.text X Y+FH*3/4 + 1 FH $text color!RGB_WHITE font!$font center!W,H
@input E = case E [mice over State XY]: $over = State case E [mice left 1 XY]: $pressed = 1 case E [mice left 0 XY]: $pressed = 0 if $over: if $onClick: ($onClick)() //$wgt_.input E
and here is the implementation of a class like macro for ECS //Classifier //lowercase arg/keyword directly inits the field, while upcase //keyword/arg are only for the constructor cls Name @Fs = ProvideSelector Name(0:['!' &Name]) Parent \id ParentArgs: Name(:['()' ['.' &Name &Parent] @&ParentArgs];['.' &Name &Parent]) Pfx "[Name]_" //part prefix case Fs [`@` &Pfx],@R: Fs = R //cls Name@UserPfx @Fs Body: AFs: //auto initialized fields case Fs [@FsP [`=` &AFs &Body]]: Fs = FsP case Fs [@FsP &Body<[`|` @_]]: Fs = FsP AFs = AFs{['!' ['@' ['.' PN N]]] V =: N V PN //normalize them ;['!' ['@' PN]] V =: _ V PN ;['!' N] V =: N V "[Pfx][N]" ; N =: N No "[Pfx][N]"} if ProvideSelector: push [_ 1 Name] AFs push [_ Name cls] AFs FNs: //field names PFNs: //prefixed field names KVs: //keyworded args default value As: //arguments FAs: //field arguments till Fs.end: KV No //keyword value case Fs [[`!` _] [`!` _]@_]+[[`!` _]]: Fs =: Fs.head No @Fs.tail case Fs [[`!` F] D @R]: KV =: D Fs =: F @R push KV KVs AN /Fs A AN.title push A As if AN.is_keyword: push AN FNs push A FAs //allow user to provide custom ECS field names PAN "[Pfx][AN]" Fs(:[`@` &PAN],@&Fs) push PAN PFNs FNs,FAs,As,KVs,PFNs [FNs FAs As KVs PFNs]{f} KAs [As KVs].zip{A,[D] =: ['!' A] D; A,_=:A}.j //args with keywords ParentRig [] if Parent<>id: PR form: ($\Me).$("rig_[Parent]") $@ParentArgs push PR ParentRig Hdr form: `|` $@ParentRig $@([PFNs FAs].zip{PFN,A = form: $rig PFN,A}) $@(AFs{N,V,PN = form: $rig PN,V}) Type form: type Name.Parent $@(KAs): id!(newId_) = $@Hdr Body Rig form: id.$("rig_[Name]") $@(KAs) = $@Hdr Body $\Me AsText form: Name.ser = "${[\Name] [($\Me).ub.t.as_text.drop^2]" //`cls`-types don't have the `__` method //Instead they explicitly define accessors for the used fields. FAs: for FN,PFN [@[FNs PFNs].zip @AFs.skip(?0><_){?0,?2}]: FG form: Name.FN = id($id).(`\` PFN) push FG FAs FSN "=[FN]" FS form: Name.FSN ~V = id($id).(`\` PFN) = ~V push FS FAs AsType form: id.$("[Name]_") = _data Name $id SetCvt form: No.set_cls_cvt_ Name: ~Id => _data Name ~Id push AsType FAs push SetCvt FAs form @(`|` Type Rig AsText $@FAs)
Name:
Anonymous2023-03-18 6:47
hey dikita sadkov that's yoshi from lord of the rings I think you will find it most educational also fidonet is looking strong this time of the year I hope you will go and fetch its bone