Expanding celestia_print...
Expanding celestia_print...
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?
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?
A whack in the face with a fish can solve a whole manner of problems.
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:
Add the follwing after the code found in CelestiaCore::showText in celestiacore.cpp:
Add the following to celestiacore.h:
In CelestiaCore::renderOverlay() find the following line:
and replace it with this line:
That's it. You will now have not only the current message, but also a history of the two previos messages.
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.
A whack in the face with a fish can solve a whole manner of problems.
Re: Expanding celestia_print...
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
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
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
- t00fri
- Developer
- Posts: 8772
- Joined: 29.03.2002
- Age: 22
- With us: 22 years 7 months
- Location: Hamburg, Germany
hank wrote:I'm not sure that this feature is very well documented.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
- 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
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...
A whack in the face with a fish can solve a whole manner of problems.
- t00fri
- Developer
- Posts: 8772
- Joined: 29.03.2002
- Age: 22
- With us: 22 years 7 months
- Location: Hamburg, Germany
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:
Not that I know:DT wrote:I remember, you were left scratching your head with this one too... Wink
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.
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.
A whack in the face with a fish can solve a whole manner of problems.
I don't know if DT can be a good developer who can improve codes in Celestia, why not ?
Motherboard: Intel D975XBX2
Processor: Intel Core2 E6700 @ 3Ghz
Ram: Corsair 2 x 1GB DDR2 PC6400
Video Card: Nvidia GeForce 8800 GTX 768MB GDDR3 384 bits PCI-Express 16x
HDD: Western Digital Raptor 150GB 10000 rpm
OS: Windows Vista Business 32 bits
Processor: Intel Core2 E6700 @ 3Ghz
Ram: Corsair 2 x 1GB DDR2 PC6400
Video Card: Nvidia GeForce 8800 GTX 768MB GDDR3 384 bits PCI-Express 16x
HDD: Western Digital Raptor 150GB 10000 rpm
OS: Windows Vista Business 32 bits
-
- Posts: 34
- Joined: 29.03.2006
- With us: 18 years 7 months
- Location: Romania, Bucharest
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?
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?
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.
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.
Selden
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.
A whack in the face with a fish can solve a whole manner of problems.
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
- t00fri
- Developer
- Posts: 8772
- Joined: 29.03.2002
- Age: 22
- With us: 22 years 7 months
- Location: Hamburg, Germany
hank wrote:Some protection is provided by informal community standards of ethical behavior.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.
- Hank
Well said, Hank!
Bye Fridger