Announcement

Collapse
No announcement yet.

Creating a Mouse Cursor in the HUD

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

    #16
    Can you show me your exact code?

    Comment


      #17
      Code:
      /**
       * Shows Interaction options to the User; One can define upto six selectable options for the Interaction
       */
      class GFxUI_Keycode extends GFxMoviePlayer;
      
      var GFxObject MyContainer;
      
      var int MouseX;
      var int MouseY;
      
      function bool Start(optional bool StartPaused=false)
      {
              super.Start();
      	// Start at the first frame
      	Advance(0.f);  
      	// Flush PlayerInput and stop the Pawn
      	PlayerOwner.PlayerInput.ResetInput();
      	PlayerOwner.Pawn.ZeroMovementVariables();
      	`log("Start the keycode movie, hell yeah");
      	return true;
      }
      
      // This is called from Flash.
      function ReceiveMouseCoords( float x, float y )
      {
      	MouseX = x;
      	MouseY = y;
      }
      function RightCode()
      {
               `log("###### ExternalInterface Call Received #####");
          TriggerRemoteKismetEvent('MyEvent');
      }
      
      //function to trigger a remote kismet event
      function TriggerRemoteKismetEvent( name EventName )
      {
          local array<SequenceObject> AllSeqEvents;
          local Sequence GameSeq;
          local MyPlayerController PC;
          local int i;
          PC = MyPlayerController(PlayerOwner);
          GameSeq = PC.WorldInfo.GetGameSequence();
          if (GameSeq != None)
          {
              // find any Level Reset events that exist
              GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);
      
              // activate them
              for (i = 0; i < AllSeqEvents.Length; i++)
              {
      	    if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
      	    SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(PC.WorldInfo, None);
      	}
          }
      }
      function IgnoreMouse(bool toggle)
      {
          self.bIgnoreMouseInput = toggle;
      }
      DefaultProperties
      {
      //	bGammaCorrection=false // Remove this line for UDK June version onwards
              bIgnoreMouseInput = false;
      	MovieInfo=SwfMovie'GFx_Interaction.keycode'
      }
      UnrealScript.
      Code:
      var number:String = "";
      var index:Number = 0;
      /* when a key is pressed, execute this function. */
      runfunction();
      function runfunction()
      {
      	if(myCursor._disabled==false)
      	{
      	//ShowCursor(MyBool);
      	trace(myCursor._disabled);
      	B1.onRelease = function()
      	{
      		number = number + "1";
      		keycode.text = number;
      	}
      	B2.onRelease = function()
      	{
      		number = number + "2";
      		keycode.text = number;
      	}
      	B3.onRelease = function()
      	{
      		number = number + "3";
      		keycode.text = number;
      	}
      	B4.onRelease = function()
      	{
      		number = number + "4";
      		keycode.text = number;
      	}
      	B5.onRelease = function()
      	{
      		number = number + "5";
      		keycode.text = number;
      	}
      	B6.onRelease = function()
      	{
      		number = number + "6";
      		keycode.text = number;
      	}
      	B7.onRelease = function()
      	{
      		number = number + "7";
      		keycode.text = number;
      	}
      	B8.onRelease = function()
      	{
      		number = number + "8";
      		keycode.text = number;
      	}
      	B9.onRelease = function()
      	{	
      		number = number + "9";
      		keycode.text = number;
      	}
      	B0.onRelease = function()
      	{	
      		number = number + "0";
      		keycode.text = number;
      	}
      	BCE.onRelease = function()
      	{
      		number = number.substr(0,number.length-1);
      		keycode.text = number;
      	}
      	ButtonPush.onRelease = function()
      	{
      		if(number != "1337151337")
      		{
      			number = "";
      			keycode.text = number;
      		}
      		else
      		{
      			import flash.external.ExternalInterface;
      		    ExternalInterface.call("RightCode");
      		}
      	}
      }
      }
      ActionScript, main part.
      Code:
      import gfx.controls.Cursor;
      import flash.external.ExternalInterface;
      
      var myCursor = new Cursor("cursorMC");  
      myCursor.enable();
      function ShowCursor(MyBool:Boolean)
      {
      	if(MyBool==true)
      	{
      		myCursor.enable();
      		ExternalInterface.call("IgnoreMouse", true);
      	}
      	else
      	{
      		myCursor.disable();
      		ExternalInterface.call("IgnoreMouse", true);
      	}
      }
      ActionScript, cursor layer.
      And mousecursor class

      Comment


        #18
        What version of UDK are you using?

        Comment


          #19
          May 2010 version.

          Comment


            #20
            The code looks fine. I have no idea why bIgnoreMouseInput is giving you an error. Maybe it wasn't implemented in May 2010 UDK? I"m working in February 2011. I'll have to do some research on the May version.

            Comment


              #21
              I'd be grateful. I'm not sure if I'll be able to convert everything to newer UDK version.

              Comment


                #22
                Give me a little time, and I'll get back to you. Hopefully today. I'm downloading May 2010 now.

                Comment


                  #23
                  Ok, in May, bCaptureInput is not available; however, you can use SetFocus(bool, bool)

                  http://files.arbi.trari.us/Doc/gfxui...tml#_SetFocus-

                  So, to tell your movie to capture or not capture input, try this:

                  Code:
                  function IgnoreMouse(bool toggle)
                  {
                      SetFocus(toggle, toggle);
                      bNoMouse = toggle;
                  }
                  And - be sure to use the FilterButtonInput() function I gave you above as well.

                  Comment


                    #24
                    I've got an 'Object keycode has no handler for GFxAction_Invoke_0', even though everything is correct.
                    I'm not sure why, but I'm still failing at making it work. ;P I guess I need to rework it from the ground.

                    Comment


                      #25
                      I've got mouse cursor set up the way you did it in first post. I've got an actionscript ShowCursor function, that shoots an external interface of ignoremouse, set the way you said here before. I've got that FilterButtonInput in place, too. In Kismet, I call ShowCursor function when the movie is loaded, and when trigger is touched. Yet, it still doesn't work - after game start the cursor appears in top right corner and wouldn't move.
                      I was wondering... Is there a way of disabling mouse capturing in every scaleform movie inside a level, if it's not in focus?

                      Comment


                        #26
                        Well, I've given you everything I know to give. You're going to have to go over your code and Flash file and look for errors.

                        Comment


                          #27
                          I see. Well, nevertheless, thank you for your cooperation, you were incredibly helpful ;]

                          Comment


                            #28
                            If your mouse cursor isn't moving then you need to double check that you aren't disabling it somewhere (such as with bIgnoreMouseInput = true). Also check to make sure you put the mouse cursor ActionScript that makes it move in the right place.

                            Comment


                              #29
                              Is there a way to trace something from actionscript to udk in log? Because I'm getting an error with :'obj keycode has no handler for GFxAction_Invoke_0', and I have no idea why the hell not ;P

                              Comment


                                #30
                                Open UDKEngine.ini
                                Find the line: Suppress=DevGFxUI
                                Comment it out by adding a semi-colon in front of it.

                                Comment

                                Working...
                                X