Expanding celestia_print...

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
DT
Posts: 49
Joined: 27.08.2007
With us: 17 years 2 months
Location: In Orbit...

Expanding celestia_print...

Post #1by DT » 30.08.2007, 10:24

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?
A whack in the face with a fish can solve a whole manner of problems.

Topic author
DT
Posts: 49
Joined: 27.08.2007
With us: 17 years 2 months
Location: In Orbit...

Post #2by DT » 30.08.2007, 16:37

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.
A whack in the face with a fish can solve a whole manner of problems.

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Re: Expanding celestia_print...

Post #3by hank » 30.08.2007, 20:01

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

Topic author
DT
Posts: 49
Joined: 27.08.2007
With us: 17 years 2 months
Location: In Orbit...

Post #4by DT » 31.08.2007, 06:15

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.
A whack in the face with a fish can solve a whole manner of problems.

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Post #5by hank » 31.08.2007, 16:12

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

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #6by t00fri » 31.08.2007, 16:56

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
Image

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Post #7by hank » 31.08.2007, 17:18

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

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #8by t00fri » 31.08.2007, 17:43

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
Image

Topic author
DT
Posts: 49
Joined: 27.08.2007
With us: 17 years 2 months
Location: In Orbit...

Post #9by DT » 31.08.2007, 19:24

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... :P
A whack in the face with a fish can solve a whole manner of problems.

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #10by t00fri » 31.08.2007, 20:09

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.
Image

Topic author
DT
Posts: 49
Joined: 27.08.2007
With us: 17 years 2 months
Location: In Orbit...

Post #11by DT » 31.08.2007, 20:28

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. :wink:

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...:lol:


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. :wink:
A whack in the face with a fish can solve a whole manner of problems.

Fightspit
Posts: 510
Joined: 15.05.2005
With us: 19 years 6 months

Post #12by Fightspit » 31.08.2007, 21:23

I don't know if DT can be a good developer who can improve codes in Celestia, why not ? :wink:
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

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Post #13by Fenerit » 01.09.2007, 00:58

Surely it's "in Orbit..." 8)
Never at rest.
Massimo

SkyScraper
Posts: 34
Joined: 29.03.2006
With us: 18 years 7 months
Location: Romania, Bucharest

Post #14by SkyScraper » 01.09.2007, 06:35

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?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #15by selden » 01.09.2007, 11:14

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.
Selden

Topic author
DT
Posts: 49
Joined: 27.08.2007
With us: 17 years 2 months
Location: In Orbit...

Post #16by DT » 01.09.2007, 15:08

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.

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Post #17by hank » 01.09.2007, 18:02

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

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #18by t00fri » 01.09.2007, 18:12

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
Image

Boux
Posts: 435
Joined: 25.08.2004
With us: 20 years 2 months
Location: Brittany, close to the Ocean

Post #19by Boux » 02.09.2007, 18:17

Image
Intel core i7 3770 Ivy Bridge @ 4.4 GHz -16 GB ram - 128 GB SSD cache - AMD Radeon 7970 3 GB o'clocked - Windows 7 64 Ultimate / Linux Kubuntu


Return to “Development”