[view] Adding objects to a face....
[1/9] from: Izkata:Comcast at: 25-Sep-2004 20:07
.... Is it possible?
Say I have:
>view A: layout [Item1: text "Hi!"]
Is there a way to use A to add {text "Bye!"} to it, as
if I had instead typed:
>view A: layout [Item1: text "Hi!" Item2: text "Bye!"]
??
I'm working on a game.. If it works, I'd probably need
that type of thing to add players that just appwalk onto
the screen, or to Summon mosters to the area.
-The hopefully grateful Izzy boy ;)
[2/9] from: carl:cybercraft at: 26-Sep-2004 15:06
On Saturday, 25-September-2004 at 20:07:50 Izzy boy wrote,
>.... Is it possible?
>Say I have:
<<quoted lines omitted: 3>>
>>view A: layout [Item1: text "Hi!" Item2: text "Bye!"]
>??
Not easily, I suspect.
>I'm working on a game.. If it works, I'd probably need
>that type of thing to add players that just appwalk onto
>the screen, or to Summon mosters to the area.
You might be better to use the Draw dialect, then your players can just be values in
a block so you can add, delete and manipulate them at will. An example...
REBOL []
players: [
pen 255.0.0
box 100x100 110x110
]
board: reduce ['draw players]
view layout [
b: box 300x300 white effect board
button "Add Player" 200 [
pos: random 290x290
append players reduce [
'pen random 255.255.255
'box pos pos + 10x10
]
show b
]
button "Move 1st Player" 200 [
move: 5x5 - random 10x10
players/4: players/4 + move
players/5: players/5 + move
show b
]
]
Read about the Draw dialect here...
http://www.rebol.com/docs/draw.html
Hope that gives you some ideas.
-- Carl Read
[3/9] from: SunandaDH::aol::com at: 26-Sep-2004 5:16
Izzy:
> Is there a way to use A to add {text "Bye!"} to it, as
> if I had instead typed:
In a word, make-face.
LO: layout/size [button "hi"] 500x500
unview/all
view/new LO
append LO/pane make-face 'button
LO/pane/2/text: "bye"
show LO/pane/2
show LO
Of course, it needs some work on positioning the new element right, among
other things. And you may need to reorder the Z-index (rendering is in order of
entries in LO/pane, so moving those around affects what items overlay others).
Sunanda
[4/9] from: nitsch-lists::netcologne::de at: 26-Sep-2004 14:37
On Sonntag, 26. September 2004 03:07, Izkata wrote:
> ... Is it possible?
> Say I have:
<<quoted lines omitted: 6>>
> that type of thing to add players that just appwalk onto
> the screen, or to Summon mosters to the area.
http://www.rebol.com/how-to/feel.html#sect5.2.
> -The hopefully grateful Izzy boy ;)
-Volker
[5/9] from: Izkata:Comcast at: 26-Sep-2004 18:15
----- Original Message -----
From: "Carl Read" <[carl--cybercraft--co--nz]>
To: <[rebolist--rebol--com]>
Sent: Saturday, September 25, 2004 10:06 PM
Subject: [REBOL] Re: [view] Adding objects to a face....
> You might be better to use the Draw dialect, then your players can just be
values in a block so you can add, delete and manipulate them at will. An
example...
I understand the extreme basics of 'draw, like making a box. X^P
Sounds better than what I had, I'll have to mess with it a little to see if
it works -
I have a bunch of images (players looking all 4 directions + both feet down
or either up)
to use, instead of drawing them completely over with this..
[6/9] from: Izkata:Comcast at: 26-Sep-2004 18:17
----- Original Message -----
From: <[SunandaDH--aol--com]>
To: <[rebolist--rebol--com]>
Sent: Sunday, September 26, 2004 4:16 AM
Subject: [REBOL] Re: [view] Adding objects to a face....
> In a word, make-face.
> LO: layout/size [button "hi"] 500x500
<<quoted lines omitted: 6>>
> Of course, it needs some work on positioning the new element right, among
> other things. And you may need to reorder the Z-index (rendering is in
order of
> entries in LO/pane, so moving those around affects what items overlay
others).
!
I think this may actually be closer to what I had in mind..
I'll test out Draw and this as well, although I think this
is the route I'll end up taking.
[7/9] from: Izkata:Comcast at: 26-Sep-2004 18:29
----- Original Message -----
From: "Volker Nitsch" <[nitsch-lists--netcologne--de]>
To: <[rebolist--rebol--com]>
Sent: Sunday, September 26, 2004 7:37 AM
Subject: [REBOL] Re: [view] Adding objects to a face....
> http://www.rebol.com/how-to/feel.html#sect5.2.
>
> > -The hopefully grateful Izzy boy ;)
>
> -Volker
Huh. Thanx for answering a future question of mine ;)
(How to make Monsters move - I hadn't figured out 'rate)
[8/9] from: Christophe::Coussement::mil::be at: 27-Sep-2004 9:11
Hi,
This is how I handle this problem in my scripts...
>> ? layout
USAGE:
LAYOUT specs /size pane-size /offset where /parent new /origin pos /styles list /keep
DESCRIPTION:
Return a face with a pane built from style description dialect.
LAYOUT is a function value.
ARGUMENTS:
specs -- Dialect block of styles, attributes, and layouts (Type: block)
REFINEMENTS:
/size
pane-size -- Size (wide and high) of pane face (Type: pair)
/offset
where -- Offset of pane face (Type: pair)
/parent
new -- Face style for pane (Type: object word block)
/origin
pos -- Set layout origin (Type: pair)
/styles
list -- Block of styles to use (Type: block)
/keep -- Keep style related data
'layout takes a block! as arg, so you can compose the block! _before_ submitting it to
the layoutization.
>> block-layout: [Item1: text "Hi!"]
== [Item1: text "Hi!"]
>> view A: layout block-layout
>> append block-layout [Item2: text "Bye!"]
== [Item1: text "Hi!" Item2: text "Bye!"]
>> view A: layout block-layout
With this approach, you're able to compose dynamically your layouts.
Hope this helps !
==christophe
[9/9] from: gabriele::colellachiara::com at: 27-Sep-2004 15:36
Hi Izkata,
On Sunday, September 26, 2004, 3:07:50 AM, you wrote:
I> ... Is it possible?
You should probably look at Cyphre's introduction to View (the one
he was supposed to do at the conference but was partly skipped
because of time constraints :).
Cyphre, maybe you could publish the text somewhere? Or if you want
to (since you had that prepared already) you could just record an
audio file with your presentation and we can put it online for
everyone. (Video is even better :)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted