Announcement

Collapse
No announcement yet.

Questions about canvas, functions etc.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Questions about canvas, functions etc.

    I'm trying to familiarize myself with the Canvas functions. I figured the best way to do this is through a simple trigger function. However, I don't see how to get ahold of the Canvas object in the first place. I tried this code below:

    Code:
    class CanvasTrigger extends Trigger;
    
    var Canvas c;
    
    function writeToScreen ()
    {
    
      c.CurX = 100.00;
      c.CurY = 100.00;
      c.DrawText("We don't care what people say");
    }
    
    function Trigger (Actor Other, pawn EventInstigator) {
     writeToScreen();
     log("Look at me, I'm triggered!");
    }
    Which gave me a run-time error, which I kind of expected. (The trigger's properties were set so that it would call its Trigger function when activated).

    As I understand it there's no way to initialize a Canvas object like you might in Java. So is the only way to use a Canvas object is to have it called via some Event in UnrealScript? If so, what events can do this? All I've seen are Interactions.

    Another issue: How come many of the code examples I see pass a parameter that says "Canvas Canvas" or "Canvas canvas"? Shouldn't that cause an error in the compilation?

    Finally, in this link:

    http://wiki.beyondunreal.com/wiki/Keypress_Interactions

    How often is PostRender() called? I don't understand the relationship between Interactions and the Interaction master. How does an Interaction master route input to the appropriate Interactions? The wiki on this seems a little difficult to understand to me.

    #2
    The easiest way to familiarize yourself with the Canvas functions would be to create an Interaction using a Mutator:

    http://wiki.beyondunreal.com/wiki/Cr...From_A_Mutator

    Then you can use the PostRender function of the Interaction to mess around with the Canvas.

    Note that Interactions are an Object class and cannot be triggered. If you want to use normal Actor functions, you'll have to set up a quick custom GameType with a custom HUD, where you can use the Canvas.

    I'd have some kind of timed bool in there using Tick() though, even if the function you wrote had worked, it would only have displayed the text for a split second until it rendered the canvas again.

    Comment


      #3
      Re: Questions about canvas, functions etc.

      Nightwish fan meets LOST fan?

      Originally posted by Nemo4ever
      So is the only way to use a Canvas object is to have it called via some Event in UnrealScript? If so, what events can do this?
      Most important one I know of is DrawHUD(). You should be able to do almost all of your canvas drawing in there.

      Originally posted by Nemo4ever
      How come many of the code examples I see pass a parameter that says "Canvas Canvas" or "Canvas canvas"? Shouldn't that cause an error in the compilation?
      Apparently not. ...although I've really only seen this widely used for canvas. The compiler seems to be case-insensitive, by the way.

      Comment


        #4
        Some actors (weapons, pawns, inventory) get the option of drawing to the hud, so just spawn a tempoary itme in the playes inventory...


        Also when you declare canvas canvas, your declaring a variable of type canvas (which is the object name), so you can use the name of that object as the variable name (like you can declare pawn pawn, or actor actor) only built in variables like float int etc cause errors

        Comment


          #5
          Its only useful to draw to the canvas when its "draw time" anyway, or something else would come behind and overwrite it, right? No use in that, lol.

          Plus, all canvas use comes from the HUD (I think even interactions get it from there, but it might be native where that happens). My point is, you cant really draw from some actor that isnt related to the HUD in some way. Weapons have a hook in the HUD for their RenderOverlays() function, and a few other classes get it through the inventory linked list, but otherwise its just HUD and interaction.

          Comment

          Working...
          X