Discussion:
[CsMain] Crystalspace coexisting with SDL displays
(too old to reply)
Miguel Guzmán
2002-01-29 08:21:02 UTC
Permalink
Hello,

This mail is a request for some information on a more architectural
level. We want to use crystalspace with SDL components, and we'd like to
know in a general way what we should do.

Background: this is for a Worldforge client. YUP client is now
merging with Dime client, and both development teams have joined to make
an unified client for worldforge, which will have 2D iso and 3D
capabilities. 2D iso can't be done with Crystalspace because the iso
engine doesn't accept heightmaps as the terrain layer, so the new client
(named also "Dime" atm) is using a custom iso display.

Also the team is going to make a GUI library for the client, also
with SDL. The GUI, 2D gameview and 3D gameview will be separate modules
and will be activable as needed (this also implies that CS will be run
as an external library, and only if requested, i.e. it will not control
the main loop and all, so it becomes a bit trickier to use).

We'd like to get a little advice on how should we handle this. We've
seen two main approaches, but we're open to any suggestion:

- Crystalspace outputs to an SDL window (thus using the custom GUI),
but I think this is not possible atm (correct me if I'm wrong), and
perhaps by outputting first to SDL it may lose some hardware
acceleration features.

- Crystalspace runs in a separate window and either the GUI commands
are translated to AWS, or the GUI is imported to Crystalspace. This has
the problem that we have to write differents GUI interface for the 2D
and 3D gameviews.

What do you think on this subject? Any advice is appreciated. Thank
you very much,

Regards,

Miguel
Christopher Nelson
2002-01-29 13:40:14 UTC
Permalink
] Also the team is going to make a GUI library for the
] client, also with SDL. The GUI, 2D gameview and 3D gameview
] will be separate modules and will be activable as needed
] (this also implies that CS will be run as an external
] library, and only if requested, i.e. it will not control the
] main loop and all, so it becomes a bit trickier to use).

I'm not entirely sure why you'd want to write your own GUI, unless
it's just for the heck of it. AWS is fairly stable, and all components
are completely skinnable, meaning that you can make any of them look
exactly how you want. If there are features that AWS doesn't support,
why not add them into AWS? It would save you a lot of time and hassle
re-inventing the wheel. AWS supports drawing to quite a number of
different canvas types, including procedural textures, and it knows how
to be friendly with the engine display in an optimal way.

-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Miguel Guzmán
2002-01-29 14:24:02 UTC
Permalink
Hello,

Christopher, I played a little bit with AWS before, and I happen to like your
windowing system :) . The concern is that there will be a 2D GUI done, and it would be
nice to have the same (player-viewed) GUI in both 2D (SDL) and 3D (Crystalspace)
gameviews. I also see that it can be done by applying the same skin to both gameviews
(for appearance) but for behaviour that would imply keeping two separate windowing
systems, or making some interface for one of them to behave like the other (accepting
and returning the same events). I think this is the way we'll have to go, because it
seems we'll need to keep both windowing systems separated.

Anyway I'll ask you some questions about AWS soon :).

Thanks & bye,

Miguel
Post by Christopher Nelson
] Also the team is going to make a GUI library for the
] client, also with SDL. The GUI, 2D gameview and 3D gameview
] will be separate modules and will be activable as needed
] (this also implies that CS will be run as an external
] library, and only if requested, i.e. it will not control the
] main loop and all, so it becomes a bit trickier to use).
I'm not entirely sure why you'd want to write your own GUI, unless
it's just for the heck of it. AWS is fairly stable, and all components
are completely skinnable, meaning that you can make any of them look
exactly how you want. If there are features that AWS doesn't support,
why not add them into AWS? It would save you a lot of time and hassle
re-inventing the wheel. AWS supports drawing to quite a number of
different canvas types, including procedural textures, and it knows how
to be friendly with the engine display in an optimal way.
-={C}=-
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
_______________________________________________
Crystal-main mailing list
https://lists.sourceforge.net/lists/listinfo/crystal-main
Stephen Meier
2002-02-01 08:06:04 UTC
Permalink
I have been playing around with using AWS in an application. I reached
the point today where I wanted to use a list box. Fill it with simple
rows of text, Click on a single row (it should then be highlighted). Get
the signal back telling me the selected data has changed.

After a little struggling I got my rows into a listbox but then a quick
test showed no highlighting and no selection change signal. Hmm.... so I
poked around in the source and came to the conclussion that some of the
things I need havn't been implemented yet.

So my question is...

If some one else is actively working on completing the list box then I
well put this aside for a little while. If this is a lower priority to
whom ever the developer is then I will put some time in flushing out the
list box. I don't want to step on anyones toes I just need a more
complete list box.

So if the lead developer of AWS or whomever is doing the listbox would
drop me a line
I could figure out my plan... Of course any changes I make I would be
happy to give back as patches.

If you think you might want to use my patches then give me some guidence
on your plans for the behavior of this widget and any coding standards
you would like used.

Steve Meier
Jorrit Tyberghein
2002-02-01 08:14:07 UTC
Permalink
Post by Stephen Meier
After a little struggling I got my rows into a listbox but then a quick
test showed no highlighting and no selection change signal. Hmm.... so I
poked around in the source and came to the conclussion that some of the
things I need havn't been implemented yet.
Just to double check: are you using latest CVS version of CS?

Greetings,


--
==============================================================================
***@uz.kuleuven.ac.be, University Hospitals KU Leuven BELGIUM

"He's in love," said Gaspode. "It's very tricky."
"Yeah, I know how it is," said the cat sympathetically. "People throwing
old boots and things at you."
-- (Terry Pratchett, Moving Pictures)
==============================================================================
Peter Amstutz
2002-01-29 16:08:04 UTC
Permalink
Just a comment on AWS - the fact that there is no automatic layout manager
makes designing the GUI a pain in the ass, not to mention the fact that it
means the components don't resize when their container does. The present
set of AWS widgets is also quite limited, for example there is no
multiline text entry/output box.

That said, alpha-transparent textured windows DOES look pretty darn cool
;-)

Something I've been considering is to use GTK GUI components (possibly
"swallowing" the normal CS window as a just another panel) but I don't
know how easy getting the two event/application loops to interact will be.
Has anyone tried anything like this?
Post by Christopher Nelson
] Also the team is going to make a GUI library for the
] client, also with SDL. The GUI, 2D gameview and 3D gameview
] will be separate modules and will be activable as needed
] (this also implies that CS will be run as an external
] library, and only if requested, i.e. it will not control the
] main loop and all, so it becomes a bit trickier to use).
I'm not entirely sure why you'd want to write your own GUI, unless
it's just for the heck of it. AWS is fairly stable, and all components
are completely skinnable, meaning that you can make any of them look
exactly how you want. If there are features that AWS doesn't support,
why not add them into AWS? It would save you a lot of time and hassle
re-inventing the wheel. AWS supports drawing to quite a number of
different canvas types, including procedural textures, and it knows how
to be friendly with the engine display in an optimal way.
------------------ Peter Amstutz --------------------
---------------- ***@cs.umass.edu ---------------
------- http://www-unix.oit.umass.edu/~tetron -------
-----------------------------------------------------
Eric Sunshine
2002-02-07 18:23:03 UTC
Permalink
Post by Peter Amstutz
Something I've been considering is to use GTK GUI components (possibly
"swallowing" the normal CS window as a just another panel) but I don't
know how easy getting the two event/application loops to interact will be.
Has anyone tried anything like this?
This should be very simple to do these days. This type of arrangement was
one of the major goals of the recent re-design of cssys which I conceived and
which Jorrit and I carried out.

CS no longer requires a custom application loop. To drive a CS application,
you must now perform these two actions on a periodic basis:

iVirtualClock::Advance();
iEventQueue::Process();

That's it. As long as you call those functions periodically, CS will "run".

What this means in practical terms is that you should arrange for your GTK
application to invoke these two functions on a regular basis. You can do
this in whatever fashion is suitable for GTK, whether it is via a timer, or a
hook into the GTK run loop which gets called on each iteration, or some
other mechanism.

Note that the typical CS application uses csDefaultRunLoop(), which the
"default" run loop offered by CS. This run loop is essentially equivalent to
the following code, though its actual implementation varies from platform to
platform.

bool csDefaultRunLoop(...)
{
while (continue_running)
{
virtual_clock->Advance();
event_queue->Process();
}
return true;
}

Since your application will already have an application loop provided by
GTK, you should _not_ invoke csDefaultRunLoop().

-- ES
Christopher Nelson
2002-01-29 16:31:03 UTC
Permalink
] Just a comment on AWS - the fact that there is no automatic
] layout manager makes designing the GUI a pain in the ass, not
] to mention the fact that it means the components don't resize
] when their container does.

Hey! I've got an idea! Why don't you implement an automatic layout
manager? :-) Personally, I'm not fond of automatic layout managers.
They never put stuff where I want them, so I didn't bother to make one.
They're actually quite simple, since it all amounts to just sticking
items in a grid and finding a place for them to go. csRect contains
collision routines, so it's not that big of a deal, really. It would be
trivial to add another key to the code that says something like
"LayoutManager" for the window, and something like "Layout" for the
component. Then the window manager would know that it needs to find a
good place for it to go. In that case, the frame for the component
should be specified as a zero-offset from the parent, like (0,0)-(width,
height).

The automatic resize would be nice for some items in some situations.
Especially the BeOS style FOLLOW_LEFT, FOLLOW_RIGHT, FOLLOW_TOP,
FOLLOW_BOTTOM syntax.

] The present set of AWS widgets is
] also quite limited, for example there is no multiline text
] entry/output box.

I'm not sure why you consider the current component set limited. The
only major standard components that it does not have are (1) tabbed
pages (2) multi-line text control (3) drop-down menus. If plan on
making (2), eventually doing (3), and possibly doing (1). In any case,
that's why open source is such a great thing. Rather than grousing
about how limited the component set is, go make one. :-) It's not hard,
and there a number of working examples. Also, I don't mind helping or
responding to questions.

-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Jorrit Tyberghein
2002-01-29 17:34:02 UTC
Permalink
Post by Christopher Nelson
The automatic resize would be nice for some items in some situations.
Especially the BeOS style FOLLOW_LEFT, FOLLOW_RIGHT, FOLLOW_TOP,
FOLLOW_BOTTOM syntax.
Automatic resize is not only nice but in my opinion it is
essential. I make a lot of GUI's in Java for my work and one
of the requirements is that they should be resizable (given
other screen resolutions or other font sizes and user preferences).

In Java/Swing I often use the very powerful GridBagLayout.
I believe CSWS has something similar. I really think this is something
that AWS is going to need some time in the future as it is essential
for good GUI design IMHO.

Greetings,
Jorrit Tyberghein
2002-01-29 17:45:02 UTC
Permalink
Post by Miguel Guzmán
Hello,
This mail is a request for some information on a more architectural
level. We want to use crystalspace with SDL components, and we'd like to
know in a general way what we should do.
Background: this is for a Worldforge client. YUP client is now
merging with Dime client, and both development teams have joined to make
an unified client for worldforge, which will have 2D iso and 3D
capabilities. 2D iso can't be done with Crystalspace because the iso
engine doesn't accept heightmaps as the terrain layer, so the new client
(named also "Dime" atm) is using a custom iso display.
Why not extend iso engine instead of using a custom iso display?
Post by Miguel Guzmán
Also the team is going to make a GUI library for the client, also
with SDL. The GUI, 2D gameview and 3D gameview will be separate modules
and will be activable as needed (this also implies that CS will be run
as an external library, and only if requested, i.e. it will not control
the main loop and all, so it becomes a bit trickier to use).
We'd like to get a little advice on how should we handle this. We've
- Crystalspace outputs to an SDL window (thus using the custom GUI),
but I think this is not possible atm (correct me if I'm wrong), and
perhaps by outputting first to SDL it may lose some hardware
acceleration features.
SDL can also do OpenGL so getting hardware acceleration with SDL should
be possible. But our current SDL canvas does not support this.

I think that in order to do what you want above you would have to write
a new SDL-based canvas that can work on an already open SDL window.
This is not very hard to write.

Greetings,
Miguel Guzmán
2002-01-31 07:39:05 UTC
Permalink
Hello,

I want to thak the people that has answered my questions about CS and SDL.

Based on what you've explained, we're going to take the following approach: we'll
be doing 3 crystalspace components to handle the GameView (rendering), the GUI
(widgets) and the Input, and those will be replacing the equivallent SDL components of
Dime when Crystalspace is being used.

I have noted down the possibility of writing a SDL canvas for OpenGL accelerated
CS (in order to use a custom SDL widget library which works outside CS too), but I
don't think I'll be able to write it until I have more expertise with Crystalspace and
SDL, so first iteration will be CS only for 3D, SDL only for 2D iso.

I'll try and get this list informed on progresses and screenies.

Regards,

Miguel

(for more info, this is Dime URL)
http://www.worldforge.org/dev/eng/clients/dime
Post by Miguel Guzmán
Hello,
This mail is a request for some information on a more architectural
level. We want to use crystalspace with SDL components, and we'd like to
know in a general way what we should do.
Peter Amstutz
2002-01-30 00:59:02 UTC
Permalink
Post by Christopher Nelson
Hey! I've got an idea! Why don't you implement an automatic layout
manager? :-) Personally, I'm not fond of automatic layout managers.
I might. Having to place everything manually means lots of tweaking the
.def file, running the application, going "oops!" moving a component over
five pixels, rerunning the application, tweaking the size of someting,
rerunning the app, ad nauseum. Not to mention the fact that if you change
the size of the enclosing frame you have to resize/reposition everything
inside it. It would be one thing if there were an interactive framework
for making a GUI which then spit out a .def file, but there isn't.
Post by Christopher Nelson
They never put stuff where I want them, so I didn't bother to make one.
They're actually quite simple, since it all amounts to just sticking
items in a grid and finding a place for them to go. csRect contains
collision routines, so it's not that big of a deal, really. It would be
trivial to add another key to the code that says something like
"LayoutManager" for the window, and something like "Layout" for the
component. Then the window manager would know that it needs to find a
good place for it to go. In that case, the frame for the component
should be specified as a zero-offset from the parent, like (0,0)-(width,
height).
As Jorrit mentioned, the GridBag layout policy that Java's AWT and Swing
uses is probably the best I've seen for both flexibility and ability to
handle resizez relatively intellegently. The idea is that you set up a
grid with the lines at arbitrary fractional positions (eg 10% of the
component width, 75% component height, etc) and then specify that
components take up one or more of those grid cells. The result is that
components can be easily aligned while still resizing nicely. The main
side effect that you do see that resizing a window to be very large can
sometimes produce undesirable effects like making widgets that should be
relatively small become too large, because the proportional size (say 10%)
changes if the window is 100 or 1000 pixels tall/wide. I'm sure there are
ways to deal with that particular problem, though.
Post by Christopher Nelson
The automatic resize would be nice for some items in some situations.
Especially the BeOS style FOLLOW_LEFT, FOLLOW_RIGHT, FOLLOW_TOP,
FOLLOW_BOTTOM syntax.
I'm not familiar with this, but it sounds like the weighted(?) layout
policy in Java where a component tends to stick to one particular side of
the window, or be in the center. To be honest I've always found that
layout fairly frustrating to use :-p
Post by Christopher Nelson
I'm not sure why you consider the current component set limited. The
only major standard components that it does not have are (1) tabbed
pages (2) multi-line text control (3) drop-down menus. If plan on
making (2), eventually doing (3), and possibly doing (1). In any case,
that's why open source is such a great thing. Rather than grousing
about how limited the component set is, go make one. :-) It's not hard,
and there a number of working examples. Also, I don't mind helping or
responding to questions.
I'm not complaining some much as just stating how it (presently) is. Well,
in 0.92 anyway. If you've made major improvements to the CVS version I
apologize :-) However, a multi-line text control is extremely important.
In addition, a lot of the existing components are lacking in the various
interface tweaks that we've all become accustomed to, such as
highlighting/cutting/pasting, being able to move the point in the
single-line text entry by clicking or using arrow keys, and being able to
change focus with tab. I also haven't been able to figure out how to
detect "return" being pressed in the single-line entry, which is rather
useful for detecting that user has finished entering a command (right now
they have to click a seperate button.)

I'm not flaming anyone, just poining out that AWS isn't quite there yet in
terms of having the basic features expected of a modern GUI toolkit. I
may work on some of these features myself if I have time...

------------------ Peter Amstutz --------------------
---------------- ***@cs.umass.edu ---------------
------- http://www-unix.oit.umass.edu/~tetron -------
-----------------------------------------------------
Norman Krämer
2002-01-30 04:25:03 UTC
Permalink
just wanted to add that csws already has grid, box, flow and absolute layout
managers i once ported from somewhere. it should be reasonably easy to
rewrite it for aws. On the other hand a rewrite from scratch wouldnt be bad
either.

norman
Mike Handverger
2002-01-30 12:32:17 UTC
Permalink
Post by Peter Amstutz
I might. Having to place everything manually means lots of tweaking the
.def file, running the application, going "oops!" moving a component over
five pixels, rerunning the application, tweaking the size of someting,
rerunning the app, ad nauseum. Not to mention the fact that if you change
the size of the enclosing frame you have to resize/reposition everything
inside it. It would be one thing if there were an interactive framework
for making a GUI which then spit out a .def file, but there isn't.
It doesn't solve the automatic layout issues, but I wrote a converter from
QT files to AWS files a little while back. It lets you design your GUI in
something like QT designer.. It's a very simple thing, and not very fault
tolerant. You still need to manually add in any connections to sinks
afterwards, but it gets the job done.

You can find source code and instructions at:

http://www.mv3d.com/qt2aws/

Hope that helps,

Mike
Christopher Nelson
2002-02-01 14:48:18 UTC
Permalink
] Stephen Meier wrote:
]
] > After a little struggling I got my rows into a listbox but then a
] > quick test showed no highlighting and no selection change signal.
] > Hmm.... so I poked around in the source and came to the conclussion
] > that some of the things I need havn't been implemented yet.
] >
]
] Just to double check: are you using latest CVS version of CS?


The items to which you refer have been fixed for some time. Another
individual was having problems with this, precisely because those parts
had not yet been activated. However, they have now, and the lastest
version of CVS reflects that. I realize that inserting items into the
listbox is a little awkward if you are not using all of the
functionality, however if you can think of a simpler way to do it, let
me know and I'll stick it in there. BTW, I am the main AWS developer,
so any questions or comments about the code may be directed to me.

-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Stephen Meier
2002-02-01 17:32:29 UTC
Permalink
Post by Christopher Nelson
]
] > After a little struggling I got my rows into a listbox but then a
] > quick test showed no highlighting and no selection change signal.
] > Hmm.... so I poked around in the source and came to the conclussion
] > that some of the things I need havn't been implemented yet.
] >
]
] Just to double check: are you using latest CVS version of CS?
The items to which you refer have been fixed for some time. Another
individual was having problems with this, precisely because those parts
had not yet been activated. However, they have now, and the lastest
version of CVS reflects that. I realize that inserting items into the
listbox is a little awkward if you are not using all of the
functionality, however if you can think of a simpler way to do it, let
me know and I'll stick it in there. BTW, I am the main AWS developer,
so any questions or comments about the code may be directed to me.
-={C}=-
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
_______________________________________________
Crystal-main mailing list
https://lists.sourceforge.net/lists/listinfo/crystal-main
Christopher,

Maybe I am missing something so I well take you through what I understand.

in

bool
awsListBox::OnMouseDown(int /*button*/,int x,int y)

you have implemented list box selection. And I haven't looked yet but I
assume the selected item can be identified from outside the awsListBox
class and then the value retrieved.

However, what I don't see implemented in Jan 31, 2002 code is
highlighting the selection which I would presume would occur in the method

bool
awsListBox::DrawItemsRecursively

and I don't see the signal signalSelected being broadcast.

These are my minimum requirements.

(Actually to continue my work I modified the CS 0.92 awslistbx.cpp file
to do both of these and it works great for me)

Let me repeat to you what I told Jorrit:

The reason I am making an effort with AWS over CSWS or GTK or TK is that
AWS has the potential to be really cool. Doing an interface in real 3d
graphics man! [:)]

Also I have at Jorritt's prompting tried my code under the CS - 0.93 Jan
31, 2002 version and my app crashes around showing a window that has an
uninitialized listbox within it. This works fine in CS 0.92. I well
probably spend some more time poking at it to see if I can find the
issue before I ask for help.

Thanks for what you have done and provided,

Steve Meier
Christopher Nelson
2002-02-01 17:51:05 UTC
Permalink
] in
]
] bool
] awsListBox::OnMouseDown(int /*button*/,int x,int y)
]
] you have implemented list box selection. And I haven't looked
] yet but I
] assume the selected item can be identified from outside the
] awsListBox
] class and then the value retrieved.
]
] However, what I don't see implemented in Jan 31, 2002 code is
] highlighting the selection which I would presume would occur
] in the method
] bool
] awsListBox::DrawItemsRecursively

In line 1,135 of awslistbx.cpp starting in column 3, the listbox has
implemented highlighting code. This code has been present for a very
long time. In fact, I'm not sure that it has ever been missing. When I
first wrote the code you couldn't change the highlight, but the first
line was highlighted nonetheless. I'm unsure what version of the
software you're using that this doesn't appear.

]
] and I don't see the signal signalSelected being broadcast.

This was, in fact, overlooked. I thought that it had been added in,
but apparently if it was, then it never made it to a commit. Thanks for
pointing this out. This will be committed immediately.


] Also I have at Jorritt's prompting tried my code under the CS
] - 0.93 Jan
] 31, 2002 version and my app crashes around showing a window
] that has an
] uninitialized listbox within it. This works fine in CS 0.92. I well
] probably spend some more time poking at it to see if I can find the
] issue before I ask for help.

Hmmm. It shouldn't do that. If you could provide me a traceback of
where it's at when it crashes, that would be good. If you do narrow
down the error, let me know where it is and I'll patch it up.

-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Stephen Meier
2002-02-01 19:01:12 UTC
Permalink
Post by Christopher Nelson
] in
]
] bool
] awsListBox::OnMouseDown(int /*button*/,int x,int y)
]
] you have implemented list box selection. And I haven't looked
] yet but I
] assume the selected item can be identified from outside the
] awsListBox
] class and then the value retrieved.
]
] However, what I don't see implemented in Jan 31, 2002 code is
] highlighting the selection which I would presume would occur
] in the method
] bool
] awsListBox::DrawItemsRecursively
In line 1,135 of awslistbx.cpp starting in column 3, the listbox has
implemented highlighting code. This code has been present for a very
long time. In fact, I'm not sure that it has ever been missing. When I
first wrote the code you couldn't change the highlight, but the first
line was highlighted nonetheless. I'm unsure what version of the
software you're using that this doesn't appear.
Yes I see. I think we have a conceptiaul problem.

My list box usage so far is very simple. I have a list of strings. One
string per row. One column.

When I click on a row I expect that Row to become Highlighted. So what I
am expecting dosn't happen.

I am not sure what you are highlighting? But in CS 0.92 I don't see
anything being highlighted.
Certainly not the string in the row I just clicked on.

I do see your using as the color hi_alpha_level but I don't know what
should be set in my def file? Not
much documentation other then the code.



I assume what you are trying to do is paint over the selected thing.
This might work so what should be
in my def file to control this?



In my solution I modified:

bool
awsListBox::DrawItemsRecursively

around line 741 in awslistbx.cpp by the way I extended the def file to
include second highlight color so
I have control of both for and back ground

} // end if there's an image

int ForGroundColor;
int BackGroundColor;

if (row->cols[i].text)
{
if(row == sel) {
ForGroundColor =
WindowManager()->GetPrefMgr()->GetColor(AC_HIGHLIGHT);
BackGroundColor =
WindowManager()->GetPrefMgr()->GetColor(AC_HIGHLIGHT2);
} else {
ForGroundColor = WindowManager()->GetPrefMgr()->GetColor(AC_TEXTFORE);
BackGroundColor =
WindowManager()->GetPrefMgr()->GetColor(AC_TEXTBACK);
}

cout << "Forground: " << ForGroundColor << " Back ground: " <<
BackGroundColor << endl;

// Draw the text
g2d->Write(WindowManager()->GetPrefMgr()->GetDefaultFont(),
x+tx+iws,
y+ty,
ForGroundColor,
BackGroundColor, //-1,
tmp.GetData());
} // end if text is good

// Draw state if there is some


Thanks,

Steve Meier
Stephen Meier
2002-02-01 20:12:04 UTC
Permalink
This actually works quite well. It should be set to whatever you want
it set to. I believe that zero is totally opaque and 255 is totally
transparent, but it might be vice versa. Look in the default definition
file that comes with awstest. All the variables that need to be set are
set in there, and they have reasonable values. The problem with the
code that you suggest is that it assumes that your column will only have
text, or at least that only the text needs highlighted. A row may
contain text, images, and state. It may have all or any of those, os
changing the color or the text is not a good solution. The highlight
method that I currently use works well with all of those, and it is
tiled across whatever height and width a row may have had. Run awstest
on your system and see if the highlight works there, please. Then I'll
know where to proceed.
-={C}=-
from my home directory

[***@Dirac aws]# /opt/CS/awstest
Beginning test of AWS as a plugin...
Loading engine...
Loading AWS...
Crystal Space X windows driver
(Using SHM extension plugin)
Using 16 bit TrueColor visual
Using windowed mode 640x480 (internal rendering at 640x480).
Using truecolor mode with 2 bytes per pixel and 5:6:5 RGB mode.
The Alternate Window System Test Harness.
Creating world!...
Preparing textures (no dithering)...
Creating texture mipmaps...
Lightmap data is not up to date (reason: no 'precalc_info' found).
Recalculation of lightmaps forced.
Pseudo-radiosity system disabled.
Maximum number of visits per sector = 2.
Initializing lighting (1 meshes).
Shining lights (3 lights).
Time taken: 0.0000 seconds.
Caching lighting (1 meshes).
Updating VFS....
DONE!
--------------------------------------
loading definitions file /this/data/temp/awstest.def...
couldn't load definition file!
aws-debug: Creating splash window...
Segmentation fault (core dumped)



lets try that again from the /opt/CS directory where I built it


[***@Dirac CS]# ./awstest
Beginning test of AWS as a plugin...
Loading engine...
Loading AWS...
Crystal Space X windows driver
(Using SHM extension plugin)
Using 16 bit TrueColor visual
Using windowed mode 640x480 (internal rendering at 640x480).
Using truecolor mode with 2 bytes per pixel and 5:6:5 RGB mode.
The Alternate Window System Test Harness.
Creating world!...
Preparing textures (no dithering)...
Creating texture mipmaps...
Lightmap data is not up to date (reason: no 'precalc_info' found).
Recalculation of lightmaps forced.
Pseudo-radiosity system disabled.
Maximum number of visits per sector = 2.
Initializing lighting (1 meshes).
Shining lights (3 lights).
Time taken: 0.0000 seconds.
Caching lighting (1 meshes).
Updating VFS....
DONE!
--------------------------------------
loading definitions file /this/data/temp/awstest.def...
load successful (3 windows, 2 skins loaded.)
aws-debug: setting up global AWS palette...
aws-debug: finished palette setup.
aws-debug: Creating splash window...
awstest: Filling list box.
Init done.
Engine is using back2front mode.
awstest: Logging in as Steve with password: Yeahah (not really.)


Yes there the hightlight looks very acceptable


Now about the awstest crashing when I ran it from a different cwd then where
I build CS. And yes I have installed it into /usr/local/crystal and set
crystal=/usr/local/crystal


I think it crashed in the above case because the cs virtual filesystem
wasn't mounted
I do this in my app just before I try to load the def file.

in

You might try something like this in awstest.cpp then you can run
awstest from any directory at least
for linux.

awsTest::Initialize(int argc, const char* const argv[], const char
*iConfigName, awsTestSink *MainSink)

//--------------------------------------------------------------
// Mount the directory that the preference file is found. Change
// the working directory to point to it and then load preferences

// this would be beter if it used some shell variable such as crystal

if (!myVFS->Mount("/home", "/home/Username_deleted/code/CS/viewer/")) {
cout << "couldn't mount vfs" << endl;
exit(-1);
}

myVFS->ChDir("/home/Username_deleted");

if (!aws->GetPrefMgr()->Load("/home/temp/awstest.def"))
Report(CS_REPORTER_SEVERITY_ERROR, "couldn't load definition file!");

//---------------------------------------------------------------

By the way AWS in CS 0.93 looks much nicer then it did in AWS 0.92

Now to see if I can get my code to run under CS 0.93 without crashing!

Steve M.
Christopher Nelson
2002-02-01 20:33:03 UTC
Permalink
] I think it crashed in the above case because the cs virtual
] filesystem
] wasn't mounted
] I do this in my app just before I try to load the def file.

VFS needs to be mounted first. It's not a reccomended CS practice to
try all over the place, because that would get really complicated. If
your application knows where to get stuff, great, but for the test app
that wouldn't work. Also because awstest runs on a number of different
platforms, so hardcoding stuff like that wouldn't even work on the Mac
or Windows. Portable solutions are necessary. The most portable, and
simplest is just to mount VFS first. :-)


] By the way AWS in CS 0.93 looks much nicer then it did in AWS 0.92
]
] Now to see if I can get my code to run under CS 0.93 without crashing!

Thank you. Several persons made improvements to the code, so it's nice
it was noticed. You ought to try completely rebuilding everything
befreo you get it to work with 0.93, simply because several interface
changes were made. That is most likely the cause of the crash.'


-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Miguel Guzmán
2002-02-04 09:42:03 UTC
Permalink
I am a bit lost with this VFS issue. I am building a gameview from simple1, and tried
to add AWS GUI to it. I renamed awstest.cfg to tweak it later (but didn't change any
values), also imported the aws sink class.

I had to use "/this/mytest.def" to access the def file for my application (which
runs in an external directory to CS), and it loads. The problem is that the def can't
find the textures, neither with the original pathnames ("/aws/any.png" and
"/lib/standard/any.png") nor relative to the actual directory
("/this/mytextures/any.png") nor even if I place the textures in the actual directory
("/this/any.png") nor using standard pathname (in case VFS wasn't functioning) like
"./any.png". Can anyone tell me what I'm doing wrong?

When I start my app it doesn't find the first three textures (minimize, close,
etc), and then crashes with segfault. I already initialized the texture pallete as
said in the awstest code because of some platform issues that could make the app crash
if not initialized properly, and right now I'm a bit lost and I don't know what to try
next.

Thanks in advance,

Miguel
Post by Christopher Nelson
] I think it crashed in the above case because the cs virtual
] filesystem
] wasn't mounted
] I do this in my app just before I try to load the def file.
VFS needs to be mounted first. It's not a reccomended CS practice to
try all over the place, because that would get really complicated. If
your application knows where to get stuff, great, but for the test app
that wouldn't work. Also because awstest runs on a number of different
platforms, so hardcoding stuff like that wouldn't even work on the Mac
or Windows. Portable solutions are necessary. The most portable, and
simplest is just to mount VFS first. :-)
] By the way AWS in CS 0.93 looks much nicer then it did in AWS 0.92
]
] Now to see if I can get my code to run under CS 0.93 without crashing!
Thank you. Several persons made improvements to the code, so it's nice
it was noticed. You ought to try completely rebuilding everything
befreo you get it to work with 0.93, simply because several interface
changes were made. That is most likely the cause of the crash.'
-={C}=-
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
_______________________________________________
Crystal-main mailing list
https://lists.sourceforge.net/lists/listinfo/crystal-main
Christopher Nelson
2002-02-04 14:31:07 UTC
Permalink
] I am a bit lost with this VFS issue. I am building a gameview
] from simple1, and tried to add AWS GUI to it. I renamed
] awstest.cfg to tweak it later (but didn't change any values),

VFS not only needs to be mounted, but if you have your own .zip
libraries you need to mount those as well. If your directory structure
is different from that of the CS dist., then you need to edit the
vfs.cfg file to move stuff around. Also, AWS has a zip library that
comes with all the default control images. If you are using the default
def file, the texture stuff and the def file need to be in orthogonal
locations from the original. (Meaning that the def file expects the
data file to be in /aws which is mounted on /this/data/awsdef.zip You
need to keep the paths similar, or else edit the def file.

-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Miguel Guzmán
2002-02-04 18:17:05 UTC
Permalink
Thanks, Crhistopher, I'll try this later when I get home and I'll tell you
how's it going,

But this brings to me another question, after reading the CS VFS docs.
If Crystalspace 3D engine and renderer are used within an external
framework, does the external fw have to use CS VFS? If not, how can it be
avoided?

If that framework uses a custom virtual file system (as Dime does), can
they be compatible? If so (supposing I can do the same mappings) have I to
write the vfs.cfg each time the former is changed, or is there any way to
simplify this?

Thanks in advance,

Miguel (Aglanor)
Post by Christopher Nelson
] I am a bit lost with this VFS issue. I am building a gameview
] from simple1, and tried to add AWS GUI to it. I renamed
] awstest.cfg to tweak it later (but didn't change any values),
VFS not only needs to be mounted, but if you have your own .zip
libraries you need to mount those as well. If your directory structure
is different from that of the CS dist., then you need to edit the
vfs.cfg file to move stuff around. Also, AWS has a zip library that
comes with all the default control images. If you are using the default
def file, the texture stuff and the def file need to be in orthogonal
locations from the original. (Meaning that the def file expects the
data file to be in /aws which is mounted on /this/data/awsdef.zip You
need to keep the paths similar, or else edit the def file.
-={C}=-
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Jorrit Tyberghein
2002-02-04 18:24:03 UTC
Permalink
Post by Miguel Guzmán
Thanks, Crhistopher, I'll try this later when I get home and I'll tell you
how's it going,
But this brings to me another question, after reading the CS VFS docs.
If Crystalspace 3D engine and renderer are used within an external
framework, does the external fw have to use CS VFS? If not, how can it be
avoided?
If that framework uses a custom virtual file system (as Dime does), can
they be compatible? If so (supposing I can do the same mappings) have I to
write the vfs.cfg each time the former is changed, or is there any way to
simplify this?
Note that you can manually Mount() new VFS directories at runtime.
So modifying vfs.cfg is not needed. Also you can convert a VFS path
to a real filesystem path easily by calling GetRealPath(). We are also
planning on adding a function to convert a real path to VFS. At this moment
you have to do this by using Mount() to mount the real path to a VFS location.

Greetings,
Christopher Nelson
2002-02-04 18:29:12 UTC
Permalink
]
] Thanks, Crhistopher, I'll try this later when I get home and
] I'll tell you how's it going,
]
] But this brings to me another question, after reading the
] CS VFS docs. If Crystalspace 3D engine and renderer are used
] within an external framework, does the external fw have to
] use CS VFS? If not, how can it be avoided?
]
] If that framework uses a custom virtual file system (as
] Dime does), can they be compatible? If so (supposing I can do
] the same mappings) have I to write the vfs.cfg each time the
] former is changed, or is there any way to simplify this?

I think that anything that uses file access in CS uses VFS. One
exception being the MemoryMappedIO plugin. However, I think that that
is probably one of the very few exceptions. I would say that you'll
have to do some mapping somehow, or modify your version of VFS. That's
not an easy problem.


-={C}=-

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
Peter Amstutz
2002-02-09 18:57:02 UTC
Permalink
Post by Eric Sunshine
This should be very simple to do these days. This type of arrangement
was one of the major goals of the recent re-design of cssys which I
conceived and which Jorrit and I carried out.
CS no longer requires a custom application loop. To drive a CS application,
iVirtualClock::Advance();
iEventQueue::Process();
That's it. As long as you call those functions periodically, CS will "run".
Great! Is this a recent (CVS only) change or is this true for v0.92?
Post by Eric Sunshine
bool csDefaultRunLoop(...)
{
while (continue_running)
{
virtual_clock->Advance();
event_queue->Process();
}
return true;
}
Since your application will already have an application loop provided by
GTK, you should _not_ invoke csDefaultRunLoop().
I actually did look at this code at one point and noticed how simple it
was, but I wasn't sure if most targets used the default run loop or if
most targets used their own run loop. It sounds like most targets work
with the default run loop, which should make it much easier to integrate
the CS event loop with the event loops of other libraries (GUI,
networking, etc).

------------------ Peter Amstutz --------------------
---------------- ***@cs.umass.edu ---------------
------- http://www-unix.oit.umass.edu/~tetron -------
-----------------------------------------------------
Jorrit Tyberghein
2002-02-10 16:25:01 UTC
Permalink
Post by Peter Amstutz
Great! Is this a recent (CVS only) change or is this true for v0.92?
This is true for 0.92.
Post by Peter Amstutz
I actually did look at this code at one point and noticed how simple it
was, but I wasn't sure if most targets used the default run loop or if
most targets used their own run loop. It sounds like most targets work
with the default run loop, which should make it much easier to integrate
the CS event loop with the event loops of other libraries (GUI,
networking, etc).
That was one of the big reasons for doing this system redesign.

Greetings,
Reed Hedges
2002-02-11 02:53:01 UTC
Permalink
Post by Peter Amstutz
Post by Eric Sunshine
iVirtualClock::Advance();
iEventQueue::Process();
That's it. As long as you call those functions periodically, CS will
"run".
...
Post by Peter Amstutz
Post by Eric Sunshine
Since your application will already have an application loop provided
by
GTK, you should _not_ invoke csDefaultRunLoop().
most targets used their own run loop. It sounds like most targets work
with the default run loop, which should make it much easier to integrate
the CS event loop with the event loops of other libraries (GUI,
On Mac OSX at least, just calling those two functions doesn't make the
app usable... the system mouse, keyboard, windowing stuff needs to
be done.
A possible feature is to stick your own function in the loop, either by
calling some function with a pointer to your custom loop function, or
by redefining a default (empty) function.
I couldn't find anything like that in the manual. What do you think?

r

--

Reed Hedges
***@zerohour.net
http://zerohour.net/~reed

Virtual Object System -- Internet Virtual Reality:
http://www.interreality.org

The owls are not what they seem.
Eric Sunshine
2002-02-11 06:36:03 UTC
Permalink
Post by Reed Hedges
On Mac OSX at least, just calling those two functions doesn't make the
app usable... the system mouse, keyboard, windowing stuff needs to
be done.
I think that you have misunderstood. Calling iVirtualClock::Advance() and
iEventQueue::Process() "run" the CS _engine_. They have nothing at all to do
with performing the functions of a platform's native run-loop.

The functions to which you are referring are handled by some platform native
mechanism. For example, on MacOS/X using Cocoa, NSApplication's -run method
is responsible for performing these functions. Other examples are
BApplication on BeOS, CApplication with MSVC, TApplication with Borland's
VCL, and GTK's own run-loop (to which the original poster alluded).

The point was that in the cases where your application already employs a
native run-loop, such as those mentioned above, you can "run" the CS engine
by arranging to have iVirtualClock::Advance() and iEventQueue::Process()
called on a periodic basis.

Applications which do not have their own native run-loop can take advantage
of CS's csDefaultRunLoop() function, which is a portable alternative to using
a platform-specific run-loop. Behind the scenes, csDefaultRunLoop() is
implemented in whatever fashion is necessary to manage mouse, keyboard, and
window related events on the target platform. As a concrete example, on
MacOS/X, csDefaultRunLoop() invokes NSApplication's -run method and arranges
to have the AppKit's run-loop call iVirtualClock::Advance() and
iEventQueue::Process() on a periodic basis.

-- ES
Reed Hedges
2002-02-11 20:16:03 UTC
Permalink
Post by Eric Sunshine
Post by Reed Hedges
On Mac OSX at least, just calling those two functions doesn't make the
app usable... the system mouse, keyboard, windowing stuff needs to
be done.
I think that you have misunderstood. Calling iVirtualClock::Advance()
and
iEventQueue::Process() "run" the CS _engine_. They have nothing at all
to do
with performing the functions of a platform's native run-loop.
Right, exactly-- to write a complete replacement for
csDefaultRunLoop(), one
would need to either perform the environment-specific steps manually (the
original topic of this thread), or call some CS function which does it
(if such
a thing exists -- i looked through some of the header files and diddn't
find anything
like that).
Post by Eric Sunshine
Applications which do not have their own native run-loop can take
advantage
of CS's csDefaultRunLoop() function, which is a portable alternative to
using
a platform-specific run-loop. Behind the scenes, csDefaultRunLoop() is
implemented in whatever fashion is necessary to manage mouse, keyboard,
and
window related events on the target platform.
To preserve this portability, it would be cool to be able to insert your
own stuff
into the default run loop, or alternatively, use the event system and
recieve some kind of "idle"
event which is sent every loop in which no other event has occured. (is
this a good
idea? -- I am ignorant about the internals of CS)

My specific problem that i'm trying to fix is that when the window is
not active on Mac,
no events are sent and so our application is effectively completely hung
until the user
brings the window to the front again.... but this is not an issue on
other platforms.

So, the ideal situation is identical behavior on all platforms. This is
of course not possible,
but there should be ways to approach it.

reed

--

Reed Hedges
***@zerohour.net
http://zerohour.net/~reed

Virtual Object System -- Internet Virtual Reality:
http://www.interreality.org

The owls are not what they seem.
Stephen W. Evans
2002-02-11 22:09:02 UTC
Permalink
Post by Reed Hedges
My specific problem that i'm trying to fix is that when the window
is not active on Mac,
no events are sent and so our application is effectively completely
hung until the user
brings the window to the front again.... but this is not an issue on
other platforms.
Er, I am a Mac programmer though my experiance with CS is yet limited but
from what I can tell CS is an ELEMENT of your own applictions main event
loop called via an updater.... e.g. (am not goin to bother to get the
syntax exectly right)

// tinymain.c
#include "main.h"
#include "whateverothercrapyouwant.h"

static int done = 0;

main()
{
OSEvent * myEvent;

InitializeGame();
while(!done)
{
if OSEventAvail(myEvent) {
/// handle the event however, take key presses, do Apple Events,
/// keypresses and mouseklicks for your game
}
UpdateGameEngine(); // go do all the crap for your game
}
KillAll();
}

would be essentially your main loop with all the platform independent game
stuff including the updaters for CS inside UpdateGameEngine... Of course
you are still going to have platform specific issues within your primitives
for things that CS doesn't already have platform specific primitives for,
e.g. sound and things like that.

This way you can do your platform specific things in respose to OS specific
events and run all your core game elements in a single global list of updaters
arranged however you might want. Nice an linear is easier to manage of course
but between your intializer and HOW you call things you can use MP threading
as well (something I will probably be doing as multiple CPU machines become
more common and because I think its just rather cool).

Dunno know if that helps or not or if I just totally misunderstood your
question. Maybe you are using a different event handler for every open
window ala PowerPlant, but even PowerPlant makes sure events eventually
get to the SubCommander than handles them, even if it is part of a Window.

That is one bit of advice RE games.... Try to stick to ONE main loop and
use a state engine to control it, multiple "main" loops can cause massive
problems in debugging. The ONE exeception I might see is writing a mini
loop to act as an event filter for things like model dialogs that might
suspend execution of your program when you don't want them too (very important
for games were blocking is strictly a nono).
--
Stephen W. Evans
PBTH Services
Grapevine, TX 76051

***@pbth.com
Eric Sunshine
2002-02-13 04:16:04 UTC
Permalink
Post by Eric Sunshine
I think that you have misunderstood. Calling iVirtualClock::Advance()
and iEventQueue::Process() "run" the CS _engine_. They have nothing
at all to do with performing the functions of a platform's native run-loop.
Right, exactly-- to write a complete replacement for csDefaultRunLoop(),
one would need to either perform the environment-specific steps manually
(the original topic of this thread), or call some CS function which does it
This seems to be getting a bit off topic. The original poster was asking
how to "run" the CS engine from an application which already had its own
run-loop. He was not asking how to write a replacement run-loop. This is an
important distinction.

In general, two types of applications will employ CS. (1) An application
which already has its own run-loop provided by the platform or development
tools. In this case, CS should be "run" subservient to the pre-existing
run-loop. (2) An application which is completely CS-centric, in which case
it may use the portable csDefaultRunLoop() implementation which provides a
run-loop tailored to work with any platform supported by CS.

Actually writing a replacement CS run-loop is not a trivial task; is almost
always unwarranted; and is certainly not recommended. If a shortcoming is
discovered with the behavior of the existing csDefaultRunLoop()
implementations, then it would probably be best to address that problem
globally by repairing the defect in the CS-supplied run-loop implementations,
rather than writing a replacement.
To preserve this portability, it would be cool to be able to insert your
own stuff into the default run loop, or alternatively, use the event
system and recieve some kind of "idle" event which is sent every
loop in which no other event has occured. (is this a good
idea? -- I am ignorant about the internals of CS)
The standard mechanism for "plugging" your own "stuff" into the CS event
loop is to register as a listener of one or more event types. If you are
particularly interested in having your code invoked for each iteration of the
run-loop, you can register as a listener of one of the standard
cscmdPreProcess, cscmdProcess, cscmdPostProcess, or cscmdFinalProcess
messages.

Note that in CS applications, there is rarely the notion of true "idle"
events (where no other events have occurred), since CS applications are
usually actively "running" (that is, rendering new scenes, updating internal
state, etc.), all of which is accomplished via synthesized events.
My specific problem that i'm trying to fix is that when the window is
not active on Mac, no events are sent and so our application is
effectively completely hung until the user
brings the window to the front again.... but this is not an issue on
other platforms.
That's a specific (and usually desirable) behavior of the implementation of
csDefaultRunLoop() for MacOS/X. Matt Reda and I have discussed the issue and
have arrived at a reasonable solution which will allow you to configure the
behavior of the run-loop (i.e. tell it whether or not it should pause while
the application is in the background).
So, the ideal situation is identical behavior on all platforms. This is
of course not possible,
but there should be ways to approach it.
The solution that Matt and I discussed can be added to the
csDefaultRunLoop() implementations for all platforms to achieve behavioral
unification.

-- ES

Reed Hedges
2002-02-11 23:28:06 UTC
Permalink
when the window is not active on Mac,
no events are sent and so our application is effectively completely hung
er, Crystal Space events, to be more specific. the thing we need to
always do
is network related, not GUI related at all.


r
Loading...