Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Canvas-based GUI Framework in UnrealScript [Community Code Project]

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

  • The input is now working, when i open the menu and just press enter the exit button is activated and i return to the main menu

    there are some things that need to be figured out however, when i press enter and the menu is closed, it gives an error that i don't have a pawn (because i don't). The problem is, when i press enter when the menu is opened, and i'm clicking a component (not the exit button) it still gives that error. my goal was to completely remove any other functions being called on keypress when the menu is active.

    on a sidenote, the Menu is no longer opened through the exec function, don't know if that could cause any problems for anyone, not being able to use the ini's anymore... One solution to bring more problems it seems...

    Comment


    • i'm more or less satisfied with how the input now works, menu opened through exec function again, no longer the error when pressing enter

      Had some problems with the Textbox, first time i completely failed, so i had to start all over again. Second try was actually not bad, but i had no idea how to fix what was wrong. Third try started with a shameless copy of Console , turned out i had most of it right the second try. only thing from epic's code that confuses me is "if (Character >= 0x20 && Character < 0x100)", i never would have thought of that, i don't even understand it

      anyway, need to do some more tweaking and testing, i expect to be able to upload it somewhere this weekend

      Comment


      • Originally posted by thommie View Post
        "if (Character >= 0x20 && Character < 0x100)"
        those look like hex values, and If this appears in a foreach (character in string) then it might be checking to see if the "character" being entered is even an acceptable character to check against an exec function. kinda like back in c++ working with cin making sure that what was entered was even more then just a line return before checking the actual value of what was entered.

        Comment


        • thanks for clearing that up gardian06, it has been a while since i've used c++.

          small update today:
          Added a Textbox that can be used for the input of text.
          added key functionality to the components.
          -pressing enter while in the ExampleMenuScene now activates the exitbutton.
          left and right arrow also work when the scrollbox is selected to browse through the list.

          now i need something for the ToDo list

          Comment


          • I got a PM from a guy who was wondering why the example content didn't work for him. Had to explain him that the example content is currently referencing textures that are not provided with the download and that he needs to use some of his own textures for that.

            And yeah, 0x20 should equal 32 and 0x100 should equal 256. And those are exactly the non-printable (whitespace) characters of the ASCII table.
            Most compilers automatically parse hex (starting with 0x) or octal values (starting with 0) into their decimal (or actually binary, since that's how it's stored anyway) pendant. So some programmer was simply flexing with his brain.

            Comment


            • i've adjusted the example content, and added a picture at the downloads section. Import the file in udk at GUI.GUI_Buttons_02 and it should work without any problems. doesn't look like much, but it's something

              Comment


              • Crusha, did you try the display of text in a button yet? i have some problems with it, and i have no idea how to fix it. it will probably be something easy i'm missing.

                i know i forgot to add a part in the GUIButtonComponent, in DrawCaption() (the bold part)
                Code:
                if(bLocalizeCaption)
                			DrawString = Localize(LocalizationHeading,CaptionInfo[DrawIndex].Caption,LocalizationFileName);
                		else
                			DrawString = CaptionInfo[DrawIndex].Caption;
                which would enable you to use non-localized strings in a button, though this is only part of the problem (i think).

                Problem:
                i've added a button in the defaultproperties, with a localized caption, working perfectly.
                i've added a button in the InitMenuScene() of the MenuScene, setting the exact same properties as the one in the defaultproperties. it only displays the texture, not the caption.

                Checked that the position at which the string is drawn is correct and inside the component's boundaries.
                Checked the DrawString in the button's DrawCaption(), it's correct, as is the font.

                i have no idea how to fix it, since everything seems to be correct and it is still not working


                Edit:
                like i said, it was something easy i had missed. the part where i said it had the exact same properties... i forgot to include the alfa of the drawcolor of the caption.....

                Comment


                • Massive update:
                  • Fixed severe memory leaks that could cause the editor to crash after playing a round in PIE. Among other things.
                  • Mouse cursor is now also affected by XBox pad control stick. It's sensibility can be individually set but there is not real support for the console buttons yet.
                  • GUIButtonComponent and it's subclasses can now specify a SoundCue to play on MouseEntered, Exited, Pressed and Released.
                  • Added option bForceNormalDrawInfo and bForceNormalCaptionInfo, which will force the Component to always use the Info at index 0. This is useful if you intend to not use any else as it will avoid redundant code and makes things more readable.
                  • Fixed FindComponentByName (now renamed to "ByTag") to work properly. Using this will allow you to get references to the Components any time and anywhere in the menu scene (and regardless of their hierarchy depth) by recursively checking for their Tag property (which is a new string property that is specified manually and is reliable compared to the Name property). That way can we get completely rid of hard object references to the Components, which would need to be cleared up properly in the end.
                  • Added function GetComponentSize() which returns the current Width and Height of the Component as part of a 2D vector.
                  • Added function MoveComponent() which handles the creation and maintenance of a GUIComponentModifier that moves the component to a specified location over time.
                  • Added event Moved() which is called after MoveComponent finished.
                  • GUIHUD assures now that the HUDs' PostRender() is called, thus also calling DrawHUD() and others to properly show Kismet messages, errors, debug stats and calculate the screen size value correctly.
                  • GUIHUD.CheckViewPortAspectRatio() now falls back to Canvas Clip values in case ViewX or ViewY should ever be 0 due to some issue with subclassing certain HUDs.
                  • If you don't specify a Font to use in the CaptionDrawInfo, it will fall back to GUIHUD.PlayerFont as the globally used Font in your menu. Useful to save some writing.
                  • TogglePauseMenu() is now stubbed to prevent the Scaleform menu from coming up.
                  • Renamed ScrollBox Components to an appropriate GUI-version to follow our old naming scheme.
                  • Added EditInLine(New) support for the system, allowing to test it in real time using the Remote Control.


                  You can now design the GUI in real time by using the Remote Control functionality of the UDK. Simply add -remotecontrol to the parameters of your UDK shortcut and you get this menu where you can edit values of each exposed property at run time. You still need to type the values out yourself in the DefaultProperties after you set them there, but it's an enormous help if you want to experiment with this stuff.

                  Here is my example (I obscured it to not disclose our game yet):

                  Click image for larger version

Name:	GUIMenu.jpg
Views:	1
Size:	93.0 KB
ID:	3249000


                  This is the code that was used to create it:
                  http://pastebin.com/1LMyAxwT

                  Comment


                  • And i was just about to start studying...

                    anyway, i am getting some errors currently, mainly with the font.

                    or others like
                    Code:
                    ScriptWarning: Accessed None 'UTPlayerOwner'
                    	GUIExampleHUD DM-Deck.TheWorld:PersistentLevel.GUIExampleHUD_0
                    	Function UTGame.UTHUDBase:PostBeginPlay:0294
                    
                    ScriptWarning: Attempt to assign variable through None
                    	GUIExampleHUD DM-Deck.TheWorld:PersistentLevel.GUIExampleHUD_0
                    	Function UTGame.UTHUDBase:PostBeginPlay:02E5
                    and some weird thing to do with the sound, which has little to do with the map i'm on.
                    Code:
                    ScriptWarning: Accessed None 'PlayerOwner'
                    	UTMusicManager DM-Deck.TheWorld:PersistentLevel.UTMusicManager_0
                    	Function UTGame.UTMusicManager:Tick:05A6
                    it's hard choosing between studying and diablo 3, but now you just had to go and do this

                    good job and i will try to find some more errors so others won't.


                    EDIT:
                    Had to fix the font issue, it already started to annoy me.

                    Comment


                    • Hmm, got to look into that later. I honestly didn't pay attention to change the ExampleHUD according to these changes. If the ExampleHUD extends from UTGame stuff and I changed the default GUIFramework to actually use one of the earlier parent classes, things might go a bit wonky.


                      The MusicManager issue is one related to the UTMapMusicInfo and has not really something to do with this system. I think it's rather because Epic doesn't check if you actually use UTPlayerController subclasses when you have a MapMusicInfo in the map.

                      Comment


                      • indeed it seems that they are connected to the UT* classes.

                        I intend to expand the example content a bit, seeing as the current ExampleMenuScene doesn't look like much, to show more of the potential of this framework. (hoping more people will start using it)

                        Comment


                        • Quite some changes in such short time:
                          • Added GUILabelComponent. A Label is a Component that is solely responsible for drawing text. No textures, no button functionality. It's a lightweight for performance and usability.
                          • Added GUIPage, which is basically the same as a GUIContainerComponent (and extending from it). What makes it "special" is the concept that it introduces. GUIPages can be pushed and popped on a Stack that is separate from the usual GUIComponents array (they are still in that array, the Stack just keeps track of their order). Pushing a GUIPage on the Stack will automatically take care of disabling the one that was last on top of it. Popping it from the Stack will disable it, remove it from the Stack and enable the one below it.
                            The advantage of this is that you don't need to remember what page came before the new one - as soon as you pop the new one again, the previous one will appear again without any changes and that all with the single same command. (This actually becomes useful with the next big change in this update.)
                          • Fixed Input Event not working.
                          • Added functionality to intercept specific keys (as defined in DefaultProperties) and convert them to specific events in the MenuScene itself. This allows us to also navigate menus with gamepad and keyboard now instead of with just mouse. It's not fully finished yet, hence why I still have some logs in it. But this is where the Stack system from above becomes useful: I can now intercept a button for "Abort" (in my case Escape or Xbox_B) and all that the MenuScene needs to do now is to call PopPage() and I am back in the previous menu, regardless of which page was open.
                            Other keys that are intercepted are Enter or XBox_A for "Confirm", which does the same as clicking LMB, and Up/Down/Left/Right on the keyboard as well as the XBox_DPad for navigating to the next button in that direction. XBox control sticks are not tracked yet. Would be easy but I am not sure yet if I should do that or leave the control sticks with a mouse cursor navigation tool.

                          Comment


                          • Some minor bug fixes in the latest release now.


                            And here is my latest example code:
                            http://pastebin.com/br8gUPbc


                            I am running into one issue with that, though. When I have a key press like Enter or Escape and intercept it, it will cause a click on the next clickable Component that I hover across and also doesn't accept any new input before that happened. Not sure yet what might be causing that.

                            Comment


                            • i just discovered some issues in the textbox. once you activate it, you can not deactivate it...
                              also it's cursor doesn't show up.

                              i'll create a new examplemenuscene that will also include all the new options.

                              EDIT: fixed the textbox problem.

                              and also, i noticed that the menuscene will still pass keys to the defaultinputcomponent even though i have already clicked other components. i had meant to have this component to only accept input when nothing had been done since the menu was opened. now i've got a menu that keeps going back to the main menu whenever i press enter and don't have the textbox selected

                              and... sadly i haven't been able to replicate your problem, but i will keep on trying.


                              EDIT:
                              should we not return true by default with the inputkey function in the menuscene? at the end of the function, when no component has accepted the key, it will revert to the original action from the *Input.ini files, which in the case of pressing enter means that the pause stops.

                              EDIT (again):
                              this didn't work, menu wouldn't close anymore... why can't it ever be that easy?

                              Comment


                              • Hmm, I made some slight changes myself as well. Got to see if I can merge things. :>

                                EDIT: But I will wait for you to upload your changes first.

                                Comment

                                Working...
                                X