Announcement

Collapse
No announcement yet.

Weird swf resolution problem on changing resolution using setres console command

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

    Weird swf resolution problem on changing resolution using setres console command

    First off , my monitor's (system's) default res is 1280x720 and the scaleform swf's stage size is 1280x720 . I am testing a change resolution setting option in which i change the res to 1024x768 or 800x600. The swf has 4 rectangles at 4 corners. With this code fragment below , the 4 rectangles align themselves properly at the 4 corners when changing resolution. But the mouse cursor movement is bottom limited in 1024x768, goes further right and in 800x600 it goes beyond right and bottom.

    Code:
    function bool Start(optional bool StartPaused = false){
        Super.Start();
        
        // Initialize all objects in the movie
        Advance(0);
        
        SetAlignment(Align_TopLeft);
        SetViewScaleMode(SM_ExactFit);
    
    
        return true;
    }
    
    //called from actionscript when player changes resolution through menu
    function SaveSettings(string strResolution)
    {
        local array<string> Resolution;
        
        Resolution = SplitString( strResolution, "x");
        
        ConsoleCommand("SETRES " $ strResolution $ "f");
        Close(false);
        Start(false);
        
        SetViewport(0, 0, int(Resolution[0]), int(Resolution[1]));
    }
    
    
    AS3
    
    stage.addEventListener(MouseEvent.MOUSE_MOVE, UpdateCursorPosition);
    
    private function UpdateCursorPosition(oEvent:MouseEvent)
            {
                
                m_mcCursor.x = oEvent.stageX;
                m_mcCursor.y = oEvent.stageY;
                
                
            }

    also when i change SetViewScaleMode to noscale, the swf doesn't expand in 1024x768 but does in 800x600.
    What am i missing?

    #2
    How are you implementing a mouse cursor? Is it part of this movie? A different movie? Hardware mouse cursor?

    Comment


      #3
      Originally posted by Matt Doyle View Post
      How are you implementing a mouse cursor? Is it part of this movie? A different movie? Hardware mouse cursor?
      Part of the same settings menu movie. Seems like the swf's stage didn't realize that the res had changed.

      Also what i questioned earlier seems to be alright--"also when i change SetViewScaleMode to noscale, the swf doesn't expand in 1024x768 but does in 800x600.What am i missing?"
      The thing was that i thought that 1024x768 was a lesser res than 1280x720 so the swf should have expanded but it was less in height (more width was fine). Then later i realized that 768>720 so it seems to be fine.

      Also i want a mode in which movieclips scale up or down as per res but i would like all text not to scale but change their fonts accordingly. Does scaleform have some built in feature for that.

      Comment


        #4
        I see. As far as I know, Scaleform is functioning properly in this area. Setting the view to noScale means that the SWF remains the same size and aspect ratio (AR) as its original created document dimensions as set in the Flash IDE, regardless of any resolution changes in UDK; scaling will not occur but clipping will occur at game resolutions smaller than the Flash document size. In other words, if you set your res to something smaller than the original SWF (say 800x600, when the SWF is 1280x720), then the movie will appear to get larger, thus clipping objects, but in reality the movie has not changed size at all - only the game client screen has.

        Be sure to read this post for more details: http://forums.epicgames.com/threads/...nd-SetViewport

        Your best bet for the mode you want is to use noScale, but to position your UI elements manually when the viewport is resized.

        Comment


          #5
          Yeah.
          I already read that post.
          But the mouse cursor going outside the screen or being limited inside still persists. The code for changing the mouse cursor position is written in a listener on the flash's stage.
          Whenever i change the resolution flash does not understand that res has been changed and still moves the mouse in 1280x720screen. How do i solve this? I tried changing the cursor position through PlayerInput inside unrealscript but later realized that the swf has input focus(so silly of me).

          Also if i use noscale then i have to position all elements, resize them and change text font sizes manually. That's quite a lot of work. Isn't there anything automatic, maybe in CLIK components. I was thinking about using exact fit and somehow specify the textfields to not scale (if there is a way) and change their font-sizes.

          Also i couldn't get the current game resolution from anywhere inside unrealscript.

          Comment


            #6
            For setting the mouse position, try following this post: http://forums.epicgames.com/threads/...e-Mouse-Cursor

            It's not exactly what you're looking for, but its a step in the right direction.

            There's no automatic adjustment that I can think of. You could look into the CLIK layout framework for automatically anchoring UI elements to certain positions on screen. (D:\UDK\UDK-2012-07\Development\Flash\AS3\CLIK\scaleform\clik\layou t). The only way to keep textfields from scaling is to use noScale mode that I know of.

            Unfortunately, I don't know how to get the current game resolution. I know how to set it though - setres 800x600

            Comment


              #7
              Thanks for the reply

              Originally posted by Matt Doyle View Post
              For setting the mouse position, try following this post: http://forums.epicgames.com/threads/...e-Mouse-Cursor
              As far as i know that will also break if u change the res at runtime using setres. You should probably check that to understand what's my problem(the problem is when the user moves the mouse- it's not like its in the wrong position when u change res(even if it is i can fix that)). I have got a dummy menu system with almost everything working. It's the only thing that's bugging me. I have worked on large successful projects in AS3 and a bit in AS2 for about 2 years but i'm new to scaleform and unrealscript.

              Originally posted by Matt Doyle View Post
              There's no automatic adjustment that I can think of. You could look into the CLIK layout framework for automatically anchoring UI elements to certain positions on screen. (D:\UDK\UDK-2012-07\Development\Flash\AS3\CLIK\scaleform\clik\layou t). The only way to keep textfields from scaling is to use noScale mode that I know of.
              I will see that later when i have time.

              Originally posted by Matt Doyle View Post
              Unfortunately, I don't know how to get the current game resolution. I know how to set it though - setres 800x600
              Oh man ,looks like i need to find a way to read from the UDKEngine.ini file.

              Comment


                #8
                The link I gave you shows you how to set the mouse coordinates manually. Now you simply need to figure out what those coordinates should be and set them, when the resolution changes. So, if the mouse is at say, 255, 100 in resolution A, you simply need to do some math to determine where that would approximately be in resolution B, then set it manually on resolution change.

                Comment


                  #9
                  You still don't get it . If i do it manually(i actually tried and it works fine but i knew this problem will occur) the mouse click and mouse over events are still fired in the original position.

                  For example if a button is at position x=500,y=500,width=100,height=50
                  game res is 1024x768 and swf res is 1280x720
                  then mouse click and hover events for this button will be fired at an area
                  x---500x1024/1280=400 to 600x1024/1280=480
                  y---500x1024/1280=400 to 550x1024/1280=440
                  which is a problem. The button is somewhere else and it is getting hovered in some other place.

                  I can narrow down the problem to this:WHEN GAME RESOLUTION HAS CHANGED THE FLASH'S SWF'S STAGE SIZE STILL REMAINS THE SAME. AND EVENT LISTENERS ON THE STAGE WORK ACCORDING TO STAGE SIZE.
                  This is what is happening without manually changing mouse position. The 4 blue corner rectangles are in the swf.
                  Game res has been changed to 1024*768. swf res is 1280*720.
                  Below are images of screen.

                  Exact fit:




                  Noscale:

                  Comment


                    #10
                    I see. Unfortunately, I cannot reproduce this issue on my end. Perhaps if you provide me with your files I can take a look.

                    Comment


                      #11
                      Originally posted by Matt Doyle View Post
                      Unfortunately, I don't know how to get the current game resolution. I know how to set it though - setres 800x600
                      http://forums.epicgames.com/threads/...1#post30634461

                      Comment


                        #12
                        @Matt
                        The code in my original post is all that it takes to replicate it. Except that there is a 3D level behind the menu which works fine on changing res. There is no code that is related to this problem anywhere else in my game project.
                        Make sure you launch the game in 1280x720 fullscreen by editing UDKEngine.ini [SystemSettings] section. Hope that your monitor supports it. And then add a button that calls
                        SaveSettings with 1024x768f as parameter. Also make the menu in 1280x720 stage size.

                        Doing some research with the UTDemo that comes with UDK the cursor works fine but the menu gets cropped i think. Also they didn't use
                        SetAlignment,SetViewScaleMode,SetViewport functions but specified ​Stage.scaleMode = "noBorder"; in flash
                        I will take a look at this on Monday.




                        @Jetfire:
                        Thanks a lot. That should work. Will implement on Monday with a new build of udk.
                        I did try the
                        DUMPAVAILABLERESOLUTIONS on the player controller console command before and tried to log the returned string directly which turned out blank. I WAS USING AN OLDER BUILD!!!!!!!!
                        Resolution is such a basic setting for PC games and Epic hasn't supported it in udk till now!!!

                        Comment


                          #13
                          chimera201:

                          As I said. I cannot reproduce this issue on my end. I am running May 2012 UDK. What version are you running? Here are my sample working files:

                          https://dl.dropbox.com/u/39898937/UDK/ResChangeTest.zip

                          I have set it up exactly as you specified in your first post. The 4 rectangles are always in the corners, and the mouse works as expected in all resolutions.

                          And here is a video of it running as expected in windowed mode (but it runs exactly the same in fullscreen mode - fyi - I just couldn't capture it in fullscreen mode)

                          https://dl.dropbox.com/u/39898937/UD...hange_test.wmv

                          Comment


                            #14
                            @Matt
                            Okay that worked . I was using the Feb 2012 udk. I just migrated to the july version and that cursor just works fine. That was really bad. So is there a way to select the best answer in this long running forum.

                            @Jetfire
                            Getting the supported resolutions as expected.

                            Comment

                            Working...
                            X