Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 13 2016 03:24
    @PeterWAWood banned @Vexercizer
Toomas Vooglaid
@toomasv
@planetsizecpu @ldci Thanks! I am out now. Will try tomorrow.
Rudolf Meijer
@meijeru
@planetsizecpu Apart from ldci 's suggestions, here is one to make your function more idiomatic Red style: you don't need Ret local variable and the last two lines can be replaced by any [....]because a function by default returns the value of the last expression evaluated in its body .
It is true that if the any condition is not satisfied, the result is then none instead of false but for most purposes this is equivalent...
Christopher Ross-Gill
@rgchris

Couple of functions added to my SVG Tools, including the ability to transform a path from absolute to relative coordinates. I've also consolidated the SVG object, some of the sub-functions can now be isolated—including PATH-TO-BLOCK, and PATH-TO-SVG-PATH (two-way path/d encoding/decoding). Can apply ROUND/TO on the latter function to clean up some overly precise paths.

my-path: "M50,160L55,180 70,180 60,190L65,205L50,195L35,205L40,190L30,180L45,180Z"
svg/path-to-svg-path svg/to-relative-path svg/path-to-block my-path
== "M50,160l5,20l15,0l-10,10l5,15l-15,-10l-15,10l5,-15l-10,-10l15,0z"

SVG-TO-DRAW is now SVG/TO-DRAW. I hope to add the ability to scale coordinates in transition to allow more precision with Red's integer-based pairs.

Dave Andersen
@dander
@toomasv my 8 year old watched those drawing animations for about 10 minutes 😄
Toomas Vooglaid
@toomasv
:smile:
Jose Luis
@planetsizecpu
Thanks @meijeru I did not know this trick, I usually learn things with daily practice.
Rudolf Meijer
@meijeru
This sort of semantics is described in the spec document which I maintain. Its content will eventually be subsumed by the official documentation.
viayuve
@viayuve
finger crossed for DATAGRID/TABLE @greggirwin will wait for it, lots of my projects do need it.
ralfwenske
@ralfwenske

What am I doing wrong here?

Red []
modalview: layout [  title "A modal view" size  400x200
    h5 "A modal window." return
    tl: text-list 380x100 font-name "Courier" data ["one" "two" "three"] [choice: tl/selected OK-btn/enabled?: true]
    return
    OK-btn: button "OK" disabled [unview/only modalview]
    Cancel-btn: button "Cancel" [unview/only modalview]
] [modal]   

;view modalview    ; uncomment this and 'win' does NOT show? (OSX)

win: layout  [
    title "A view test"
    h1 "test window"
]
?? win/size         ; just to see that we come along here after modal view has been closed
view win

When the modal view has been shown the 'win' does not show up

Also could someone on OSX confirm that selected item in 'text-list' is barely readable?

Toomas Vooglaid
@toomasv
@ralfwenske Don't know if this helps but you forgot to give modalview the /flags refinement. On W10 it works with and without the flag.
ralfwenske
@ralfwenske
Thank you @toomasv I tried with /flags in both layout and view : doesn’t make a difference.
Jose Luis
@planetsizecpu
@ralfwenske just add a the end some last line like print "OK" it works for me, also text-list displays ok on w10
but was difficult to find, needed some tests :-) it seems last line wait for <enter> key
Jose Luis
@planetsizecpu
also if there is a blank line at the end, then it works correct
ralfwenske
@ralfwenske

@planetsizecpu Strange - I feel like there might still be some limitation with view:
Doing the following

Red []
win: layout [
    title "Win"
    h1 "test window"
    button "Close" [unview/only win]
]
win1: layout  [
    title "Win1"
    h1 "test window 1"
    button "Close" [unview/only win1]
]
win2: layout  [
    title "Win2"
    h1 "test window 2"
    button "Close" [unview/only win2]
]
view win 
view win1
view win2

print "Done"

win opens and waits until I close it (either way). Then both win1 and win2 open at once. Clicking on close on any of those two closes both.
When I comment out view win win1 opens. When I close it the program finishes normal but no sight of win2

ralfwenske
@ralfwenske
I now have observed in my original app that when I open a small view before the main view, the main view flashes and disappears. When I don’t open the small view everything works fine as expected.
(btw. modal was a destraction and probably doesn’t play a role in this)
Oldes Huhuman
@Oldes
@ralfwenske you probably want to use view/no-wait for the first 2 (help view is your friend)
But you are probably having other problem as I see now... but I must say that here (Windows) it is working as expected. First I see one window, when I close it there is just second and finally the third.
Jose Luis
@planetsizecpu
Just tested a bit my game (at work now hehe) with last automatic update available and runs as normal.
@Oldes that is the normal behavior I think, so as @ralfwenske says it is strange, don't evaluate the last line, just waits for enter key
Oldes Huhuman
@Oldes
It is strange if both win1 and win2 open at once. Sounds like a bug.
Jose Luis
@planetsizecpu
@ralfwenske @Oldes Seems a console related issue, if you write the code in a .red file it runs as normal, also the last line. But if you paste the code on console, then last line wait for enter key.
Nenad Rakocevic
@dockimbel
@ralfwenske Cannot reproduce your issue on Win10, win2 opens after win1 is closed, as expected. If you can reproduce it consistently on macOS, then open a ticket for it.
Oldes Huhuman
@Oldes
Is there simple way how to make an image from raw ARGB binary? I think that this is bad result:
>> i: make image! [2x1 #{01020304 05060708}]
== make image! [2x1 #{010203040506}]
Is it a good idea to have ARGB and RGBA codecs?
Hm... this works:
>> i: make image! 2x1 i/argb:  #{0102030405060708} i
== make image! [2x1 #{030201070605} #{
FBF7}]
Oldes Huhuman
@Oldes
Although it looks that the order is wrong:
>> i/1
== 3.2.1.251
The binary value is in BGRO or (BRGA?) format
zxq2233
@zxq2233
I am trying to make a simple notepad using red-lang.
Can I use the Windows Explorer window to open the file and get the path? Does the GUI control do it all?win-common-dlg-image2.png
Gregg Irwin
@greggirwin
Request-file is the function you want.
Use ? request-file to see details, and play in the console with it, to see how the refinements work. You can also do ? request to see the other requestors that are available.
zxq2233
@zxq2233
@greggirwin Thank you!
Rudolf Meijer
@meijeru
Here is an interesting example of Red's code = data property: with five LOC I add a new item to the console's menu
; get console face
cons: first head system/view/screens/1/pane

; add to console menu
append last cons/menu ["Check for updates" check-update]

; modify the body of the on-menu actor function
body: body-of :cons/actors/on-menu
insert third body [check-update [do %check-update.red]]

; rebuild the function from the spec and the modified body
cons/actors/on-menu: func spec-of :cons/actors/on-menu body
Toomas Vooglaid
@toomasv
@meijeru Beautiful! :+1:
Petr Krenzelok
@pekr
Really cool!
Gregg Irwin
@greggirwin
Very cool indeed.
Can you post the code for %check-updates.red as well?
Gregg Irwin
@greggirwin
Ah, I see your gist in the other room now. Thanks!
Jose Luis
@planetsizecpu
@meijeru Wow, useful!
Galen Ivanov
@GalenIvanov
Something I'm currently working on: Hamiltonian cycles generator
Galen Ivanov
@GalenIvanov
I need to improve the code, because the program crashes when I try bigger sizes. I don't know if this due to memory leak or recursion.
Hamilton_cycles.png
Boleslav Březovský
@rebolek
@GalenIvanov try recycle/off, it may be some GC bug.
Galen Ivanov
@GalenIvanov
@rebolek Thanks, I'll try it.
Gregg Irwin
@greggirwin
@GalenIvanov cool. Thanks for posting.
Galen Ivanov
@GalenIvanov
@greggirwin Thank you! It's just a WIP, I'll post the source of the finished projects on Github - I have ideas for 2 games based on this.
Galen Ivanov
@GalenIvanov
@rebolek A quick update: I decided to see if the program crashes when compiled. Surprisingly it doesn't crash. In the console it starts crashing with inputs around 16x16; the compiled one successfully generated a hamiltonian cycle on a grid of 40x40 points.
Boleslav Březovský
@rebolek
@GalenIvanov interesting, I'll check how my crashing stuff behaves when compiled because there's certainly some GC error in the interpreter.
Galen Ivanov
@GalenIvanov
@rebolek OK, thanks! I'll post my source when I'm ready - I don't rule out the possibility of more mistakes from my side.
By the way, success with 70x70 (it took maybe 15 minutes, but proves that my concept works) - I'll need much smaller grids, but was annoyed by the crashes.