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
Quân
@quan-nh
how to detect the combination of keys, e.g. ctrl + o ?
bitbegin
@bitbegin
view [area on-key [if event/key = #"^O"[print "detected"]]]
Quân
@quan-nh
can we bind the on-key event to the container (window) instead of face?
Toomas Vooglaid
@toomasv

On Windows event/ctrl? is detected when area has focus.
You can also do

view [area focus on-key [probe event/ctrl?]]

To check combinations:

view [area focus on-key [if all [event/key = #"^O" event/ctrl?] [print "detected"]]]

To detect events on window:

system/view/capturing?: yes
view [size 300x300 on-detect [if event/type = 'key [probe event/ctrl?]] area]
Quân
@quan-nh
thanks! can we detect the window key (Command on MacOS)? or just Ctrl, Shift
Toomas Vooglaid
@toomasv
I am out now, can’t check. But why don’t you try?
Toomas Vooglaid
@toomasv
@quan-nh Here's what I see on Windows on pressing window key:
view [size 300x300 on-down [face/selected: none] on-detect [if event/type = 'key [probe event/key]] area]
left-command
Quân
@quan-nh
nothing is detected when press Command key on MacOS :(
Toomas Vooglaid
@toomasv
:worried:
R cqls
@rcqls
@toomasv I have to check what is on-detect but it is not yet implemented on Red/GTK too. In such case on red/GTK I use on-key. However Cmd is not recognized yet for on-key.
Toomas Vooglaid
@toomasv
@rcqls See here (11.4)
R cqls
@rcqls
@toomasv Thanks!
Toomas Vooglaid
@toomasv
:+1:
R cqls
@rcqls
@toomasv I guess it is not so easy to implement… at least for Red/GTK. I need to think about it more carefully by reading the gtk doc with this in mind. Thanks again for pointing this feature.
Toomas Vooglaid
@toomasv
Glad to be of help!
R cqls
@rcqls
This mechanism is implemented insidecapture-events in pure red. Example tests/events-flow.red works for clicking on-down but an adaptation for on-key seems to work on macOS except for special key. Also area is a widget special for this task. As usual you give me @toomasv an opportunity to learn some specific feature that Ialready read in the doc but I did not guess how it was useful in the red/GTK implementation.
Gregg Irwin
@greggirwin
In R2, VID let you specify simple hot-keys for faces, using char! values. We want an improved model in Red, which has to account for menu accelerators, and labels associated with fields, that set focus on the field, which ties into having a tab order, which... nothing is simple.
Quân
@quan-nh
do we have vertical scrollbar with rich-text face, I can't find it on document :(
Gregg Irwin
@greggirwin
Not at this time @quan-nh.
@toomasv might have a gist or example for putting one in a panel, with a separate scroller.
Toomas Vooglaid
@toomasv
@quan-nh One example of scroller with rich-text is here. See other examples too.
Quân
@quan-nh
can we have similar behavior with area scrollbar? e.g. my rich-textis large, so I only display part of it, then when I scroll down, I can see another part?
Toomas Vooglaid
@toomasv
Yes, you can do it. You have to determine scroller's max-size and page-size, also your line-heights.
Quân
@quan-nh
yep, let me try, thanks @toomasv
R cqls
@rcqls
BTW, another sophiticated example is gui-console.red. I know that since I am fighting with it unsuccessfully on the Red/GTK side!
Toomas Vooglaid
@toomasv

@quan-nh Here is an example with fixed text:

view [
    panel 320x100 white [
        origin 4x4 space 0x0 rt: rich-text 300 "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?" 
        pad 0x-4 scroller 16x100 [
            rt/offset/y: 0 - to-integer max 0 min rt/size/y - face/size/y face/data / face/steps * lh
        ] on-created [
            face/steps: 1.0 / (1.0 * rt/size/y / (lh: rich-text/line-height? rt 1)) face/selected: h / lh
]]]

This uses VID scroller, which seems not to be documented yet. And, to be honest , I'm not quite sure what exactly goes on here, but it works. (I know this is not good recommendation)

The other option is to use embedded scroller, but there are some caveats:
1) It seems to be unfinished, so it is not documented either.
2) When you embed it directly in rich-text, then it will cover part of your text.
3) If you embed it in panel, which contains also the rich-text, then it is errant -- even if you embed only vertical scrollbar, it still generates events as-if it were horizontal.
4) And even if you use horizontal-scrollbar event-names to adjust rich-text vertically (which works), trace still wouldn't work.

So, I suggest to use something like the above solution. It doesn't allow dynamic addition/navigation/deletion of the text though, which would need special implementation.

Toomas Vooglaid
@toomasv
Ah, sorry, the last h / lh should rather be 1.0 * face/size/y / rt/size/y. h / lh was left there from earlier experimentation.
Gregg Irwin
@greggirwin
A recent link in red/welcome led me to this. Quite interesting read on pre-rasterizing fonts for higher speed text rendering.
Quân
@quan-nh
@toomasv seem scroller face is not available on MacOS, I got this error *** Script Error: VIEW - invalid face type: scroller, with macOS red-16aug19-e47ade4e
Toomas Vooglaid
@toomasv
Have to wait then.
Jose Luis
@planetsizecpu

Today I have uploaded the latest improvements in the game, now the boy can take the gold bag
or the pickax while traveling in the kart, as in the original arcade game; before he had to release
them for jump on.
During the tests I detected a very well hidden fault while traveling in the kart, if a guard
were hit then sometimes you could not jump out, this has been corrected.

I intend to start with sound testing after the summer, we will see how it fits with the game rate
porting and experiments done by @toomasv would help a lot, so thx!

cavetest110.gif
GiuseppeChillemi
@GiuseppeChillemi
I feel so 1980....
Jose Luis
@planetsizecpu
me too, that's why I made the game, love 80s haha, if you look closely, the boy holds the goldbag with his teeth while hanging on the handle :-)
GiuseppeChillemi
@GiuseppeChillemi
Oh, now I see it !
Toomas Vooglaid
@toomasv
Very nice, @planetsizecpu ! :+1:
Jose Luis
@planetsizecpu
You're welcome
Gregg Irwin
@greggirwin
:^)
Jose Luis
@planetsizecpu
cavetest111.gif
Just now I added capability to carry gold from other floors, that help is ever welcome!
François Jouen
@ldci
Hi, you can play with ffmpeg from Red: https://github.com/ldci/ffmpeg
Respectech
@Respectech
@ldci Do you have some examples of ffmpeg from Red? I'd LOVE to see that!
François Jouen
@ldci
@Respectech : you'll find some examples in /video directory. Just compile the code. More to come in a few days.
Respectech
@Respectech
Nice!
Jose Luis
@planetsizecpu
Great job @ldci, is there limitation on videos size? I have a 96MB .mp4 and movies.exe turns on black player screen but not play or seems to hang.
François Jouen
@ldci
@planetsizecpu if you don’t need sound add -an option in command-Line
Jose Luis
@planetsizecpu
@ldci Just to test I did it, also renamed the file to mpg, but nothing changed, here is what I get. Maybe the file format is not compatible.
movies1.gif
François Jouen
@ldci
@planetsizecpu : first of all check you Ffmpeg install under windows (I don't use Windows), and then just try ro read your movie with ffplay -I your movie from the shell.
François Jouen
@ldci
@Respectech just ffplay tour movie :)