Need more info on canvas functions

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
PKodon
Militia Lieutenant
Militia Lieutenant
Posts: 125
Joined: Sat Apr 18, 2009 6:03 pm
Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"

Sun Jan 17, 2010 2:09 am

Hi,

I'm trying to do some things with the new canvas functions in a couple of mods (for one, see http://xelerus.de/index.php?s=mod&id=650 ) and, though I've looked through the code for Vanilla Transcendence in 1.0rc4, I have little clue as to what some of the optional parameters do.

(cnvDrawImage x y imageDesc [screen] [ID])
(cnvDrawRect x y width height color [screen] [ID])
(cnvDrawText x y text font color alignment [screen] [ID])

For instance, what do the [screen] and [ID] parameters do, and how do I use them?

Also, I can figure out the origin for cnvDrawImage and cnvDrawRect, but, at least for centered text using cnvDrawText, if the text were supposed to be near the top of the dock screen panel, it would need negative coordinates, and currently takes a lot of experimentation to get it placed.

Anyone have any notes on these commands? I'd appreciate some input.

PK

george moromisato
Developer
Developer
Posts: 2936
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Sun Jan 17, 2010 2:50 am

As you said, both screen and ID are optional. You don't need them if your call is inside of a <Canvas> element.

In the future, you could use screen and ID to draw to a <Canvas> element from a different event (e.g., <Initialize>) but I haven't tried that, so don't know if it will work yet.

User avatar
PKodon
Militia Lieutenant
Militia Lieutenant
Posts: 125
Joined: Sat Apr 18, 2009 6:03 pm
Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"

Sun Jan 17, 2010 3:13 am

So, do I understand this correctly, George, you don't know how it works, or if it works, either?

PK

User avatar
PKodon
Militia Lieutenant
Militia Lieutenant
Posts: 125
Joined: Sat Apr 18, 2009 6:03 pm
Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"

Sun Jan 17, 2010 3:55 am

Oh yeah, and that still doesn't tell me how to calculate the position of that text.
george moromisato wrote:As you said, both screen and ID are optional. You don't need them if your call is inside of a <Canvas> element.

In the future, you could use screen and ID to draw to a <Canvas> element from a different event (e.g., <Initialize>) but I haven't tried that, so don't know if it will work yet.

Post Reply