Page 1 of 1
Expanding celestia_print...
Posted: 30.08.2007, 10:24
by DT
I have been looking at the print feature that can be accessed from scripts. It has limited functionality, in that it can only print a single line at a time. I am attempting to add a history, so that the last three or four messages printed are kept on screen.
The process begins in celx.cpp at this function:
static int celestia_print(lua_State* l)
This then passes the parameters to a struct:
void CelestiaCore::showText(string s,
int horig, int vorig,
int hoff, int voff,
double duration)
As far as I can tell this is then processed by RenderOverlay() in celestiacore.cpp.
Have I missed anything?
Does anyone know if a history has previously been implemented, or is it something I would need to write from scratch?
Posted: 30.08.2007, 16:37
by DT
I implemented a two line history buffer. Its pretty straight-forward. If anyone decides to use this, you will need to move the text on some scripts to a different position on the screen. This will allow it to be read a little better.
Add the follwing before the code found in CelestiaCore::showText in celestiacore.cpp:
Code: Select all
//Begin Text Message History Block - Add by DT
if (messageText2 != "")
{
messageText3 = messageText2;
}
if (messageText != "")
{
messageText2 = messageText;
}
//End Text Message History Block - Add by DT
Add the follwing after the code found in CelestiaCore::showText in celestiacore.cpp:
Code: Select all
//Begin Text Message History Block - Add by DT
if(messageText3 != "")
{
messageFinal = messageText3 + "\n" + messageText2 + "\n" + messageText;
}
else if(messageText2 != "")
{
messageFinal = messageText2 + "\n" + messageText;
}
else
{
messageFinal = messageText;
}
//End Text Message History Block - Add by DT
Add the following to celestiacore.h:
Code: Select all
//Begin Text Message History Block - Add by DT
std::string messageText2;
std::string messageText3;
std::string messageFinal;
//End Text Message History Block - Add by DT
In CelestiaCore::renderOverlay() find the following line:
Code: Select all
*overlay << _(messageText.c_str());
and replace it with this line:
Code: Select all
*overlay << _(messageFinal.c_str()); //History Mod - Altered by DT
That's it. You will now have not only the current message, but also a history of the two previos messages.
Re: Expanding celestia_print...
Posted: 30.08.2007, 20:01
by hank
DT wrote:I have been looking at the print feature that can be accessed from scripts. It has limited functionality, in that it can only print a single line at a time. I am attempting to add a history, so that the last three or four messages printed are kept on screen.
What is your purpose for this?
- Hank
Posted: 31.08.2007, 06:15
by DT
What is your purpose for this?
Right now, it is for debug messages. A small history allows me to see the chain of events that lead to particular problems.
Posted: 31.08.2007, 16:12
by hank
DT wrote:What is your purpose for this?
Right now, it is for debug messages. A small history allows me to see the chain of events that lead to particular problems.
You might try using the Celestia log for this. You can turn the display of the log layer on and off using the tilde (~) key. Up to ten lines are displayed, and you can scroll back and forward using the up/down arrow and page up/down keys. In .celx scripts you can write messages to the log with the celestia:log() method.
- Hank
Posted: 31.08.2007, 16:56
by t00fri
DT wrote:What is your purpose for this?
Right now, it is for debug messages. A small history allows me to see the chain of events that lead to particular problems.
How about learning first what Celestia already offers?
Bye Fridger
Posted: 31.08.2007, 17:18
by hank
t00fri wrote:DT wrote:What is your purpose for this?
Right now, it is for debug messages. A small history allows me to see the chain of events that lead to particular problems.
How about learning first what Celestia already offers?
Bye Fridger
I'm not sure that this feature is very well documented.
- Hank
Posted: 31.08.2007, 17:43
by t00fri
hank wrote:t00fri wrote:DT wrote:What is your purpose for this?
Right now, it is for debug messages. A small history allows me to see the chain of events that lead to particular problems.
How about learning first what Celestia already offers?
Bye Fridger
I'm not sure that this feature is very well documented.
- Hank
Hank,
I have specially pointed this feature out to DT when he was struggling with his "Missing Textures" mistake (using the wrong libjpg):
t00fri wrote:I suggest you hit the ~ key after startup. So you can check what textures are loaded at a given moment. The filenames are displayed on the canvas.
cf
http://www.celestiaproject.net/forum/viewtopic ... 23&start=6
Quite generally, I would appreciate if he would switch to a somewhat "lower gear..."
. You and me know that Celestia is sufficiently complex such as to warrant
a few quiet days of learning before rewriting Celestia's code IN PUBLIC ...
Bye Fridger
Posted: 31.08.2007, 19:24
by DT
You might try using the Celestia log for this. You can turn the display of the log layer on and off using the tilde (~) key. Up to ten lines are displayed, and you can scroll back and forward using the up/down arrow and page up/down keys. In .celx scripts you can write messages to the log with the celestia:log() method.
I had a look at this feature. It had too much other information included in it and I wanted specific information only. I also wanted the ability to keep a history for certain scripts.
How about learning first what Celestia already offers?
I know exactly what it offers. Its not exactly a highly complex program...
I have specially pointed this feature out to DT when he was struggling with his "Missing Textures" mistake (using the wrong libjpg):
The documentation is not great and as far as I remember, you were left scratching your head with this one too...
Quite generally, I would appreciate if he would switch to a somewhat "lower gear..." . You and me know that Celestia is sufficiently complex such as to warrant a few quiet days of learning before rewriting Celestia's code IN PUBLIC ...
As I said before, its not that complex. There are only 240 files in the program. I've worked on SOAs that have in excess of 10,000 files and combine multiple platforms. This is a walk in the park...a part-time hobby program.
I think you have a highly inflated sense of the complexity of Celestia, as well as having lost sight of the fact of what it means to be Open Source.
You really need to learn how to let go...
Posted: 31.08.2007, 20:09
by t00fri
DT wrote:
As I said before, its[Celestia is] not that complex. There are only 240 files in the program. I've worked on SOAs that have in excess of 10,000 files and combine multiple platforms. This is a walk in the park...a part-time hobby program.
I think you have a highly inflated sense of the complexity of Celestia, as well as having lost sight of the fact of what it means to be Open Source.
My God. Given the fact that you were documenting your own many mistakes in this forum during the
simple task of just compiling this
walk in the park...part-time hobby program., I have no words
Bye Fridger
PS:
DT wrote:I remember, you were left scratching your head with this one too... Wink
Not that I know:
t00fri wrote:I would also try to analyze what the difference are between the Earth texture set and the others (.JPG format vs .PNG format!!). Probably you forgot to add the JPG library.
Posted: 31.08.2007, 20:28
by DT
My God. Given the fact that you were documenting your own many mistakes in this forum during the simple task of just compiling this walk in the park...part-time hobby program., I have no words
Many mistakes??? I added a single lib that was not required.
You never spotted that either.
Also, I am the first to build this under Vista using the VS2005 IDE. There is no documentation for it. I had to write it. There was no clear information on aspects such as defining CELX, etc. Perhaps if you guys documented or properly commented your code, there wouldn't be such problems.
I could teach you how to code properly...
I would also try to analyze what the difference are between the Earth texture set and the others (.JPG format vs .PNG format!!). Probably you forgot to add the JPG library.
One of your many mistakes...that lib had been added, it was the addition of another lib that caused the problem.
Posted: 31.08.2007, 21:23
by Fightspit
I don't know if DT can be a good developer who can improve codes in Celestia, why not ?
Posted: 01.09.2007, 00:58
by Fenerit
Surely it's "in Orbit..."
Posted: 01.09.2007, 06:35
by SkyScraper
My english is limited so please be patient
I thought Celestia needs more developers who can offer their free time for improving this software instead all i see is newcomers being harassed.
I understand all of you have done a great deal so far but you should let other at least try to expand or even improve Celestia's capabilities.
After all the program is based on comunity work isent it?
Posted: 01.09.2007, 11:14
by selden
SkyScraper,
People are quite welcome to make copies of Celestia and change them in any way they want, so long as they don't call them Celestia and that they abide by the GNU Public License, v2 or later.
Development of the official version of Celestia is carefully controlled. Only the members of the official development team can update its files on SourceForge. Chris Laurel is Celestia's original author and lead developer. He has the final say in what is included.
Posted: 01.09.2007, 15:08
by DT
People are quite welcome to make copies of Celestia and change them in any way they want, so long as they don't call them Celestia and that they abide by the GNU Public License, v2 or later.
Actually, there is no protection for the name 'Celestia'. Its not something that is covered in the GPL v2 and it is not a trademark.
Posted: 01.09.2007, 18:02
by hank
DT wrote:People are quite welcome to make copies of Celestia and change them in any way they want, so long as they don't call them Celestia and that they abide by the GNU Public License, v2 or later.
Actually, there is no protection for the name 'Celestia'. Its not something that is covered in the GPL v2 and it is not a trademark.
Some protection is provided by informal community standards of ethical behavior.
- Hank
Posted: 01.09.2007, 18:12
by t00fri
hank wrote:DT wrote:People are quite welcome to make copies of Celestia and change them in any way they want, so long as they don't call them Celestia and that they abide by the GNU Public License, v2 or later.
Actually, there is no protection for the name 'Celestia'. Its not something that is covered in the GPL v2 and it is not a trademark.
Some protection is provided by informal community standards of ethical behavior.
- Hank
Well said, Hank!
Bye Fridger
Posted: 02.09.2007, 18:17
by Boux