Results 1 to 3 of 3
  1. #1
    infexious's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0

    Cool Efficient Text GUI Using Loops

    Hey guys, today I'm going to present a simpler and more efficient way to go about displaying a text gui (for all of you out there that still use them).
    Normally, you'd see that lots of people like to use something like this:
    Code:
    if (GuiHacks.fly) {
        fontrenderer.drawStringWithShadow("F: Fly", 2, 12, 0xff0000);
    } else fontrenderer.drawStringWithShadow("F: Fly", 2, 12, 0xffff00);
    
    if (GuiHacks.nofall) {
        fontrenderer.drawStringWithShadow("N: Nofall", 2, 12, 0xff0000);
    } else fontrenderer.drawStringWithShadow("N: Nofall", 2, 12, 0xffff00);
    Now this is fine, but it can get quite tedious (plus it looks tacky) to add that for every one of your hacks. So instead you'd would want to find a way to draw them with only a short amount of code -- loops! In this case, the 'for' loop is your friend. So let's make a couple of arrays.
    You're going to need two arrays; one for the booleans and one for the strings. So go ahead and set up the arrays in this fashion:
     
    Code:
    boolean[][] guiHacksBool = {
        { //"page" 1
            hackFlyDetected,
            hackNofall,
            hackHighJump
        },
        { //"page" 2
            hackGuitar,
            hackUndetectedFly,
            hackLOL
        }
    };
    
    String[][] guiHacksStr = {
        { //"page" 1
            "F: Fly (Detected)",
            "N: No Fall",
            "J: High Jump"
        },
        { //"page" 2
            "G: Guitar",
            "X: Fly (Undetected)",
            "L: LOL"
        }
    }


    Remember, that you're also going to have to initialize those lists in the class before you actually start using them.
    Okay; so now you probably see where I'm going at (hopefully) with these two lists. The first one holds the booleans and the second one holds the text that is to be drawed on the screen if that said boolean be true. Let's take a look at the loop code:
    Code:
    for (int p=0;p<guiHacksBool[showHackGUICurrentPage].length;p++) {
        if (guiHacksBoolean[guiPage][p]) {
            fontrenderer.drawStringWithShadow(guiHacksStr[guiPage][p], 2, 12+p*10, 0x00ff00);
        } else {
            fontrenderer.drawStringWithShadow(guiHacksStr[guiPage][p], 2, 12+p*10, 0xff0000);
        }
    }
    If you study the code above, you'll soon realize that it's pretty simple. You set it up so that it cycles through the boolean list and then draws the matching string. In this case, 'guiPage' is a declared int that lets you know what "page" you're on in the arrays. I suggest adding a key toggle to add/subtract this value.

    Well, that's pretty much the main idea. A tip: again, make sure to initialize the list (preferably by a different name as a final) so that you can access it by a key toggle (like that guiPage incrementer/decrementer). But you still have to leave the previous declaration so that your booleans don't always return their initial value.

    I commend all who took their time to read through this tutorial because I enjoyed writing this. Good luck!
    Last edited by infexious; 05-20-2012 at 11:04 AM. Reason: a bit of small typos

  2. #2
    InCapacitated's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    Everywhere
    Posts
    2,843
    Reputation
    71
    Thanks
    477
    My Mood
    Lurking
    We would like to see a result screen shot, please put one.
    Thanks.

    Strygwyr, the Bloodseeker
    "For the Flayed Twins, I seek blood."





    Add me up on Steam : Knight Lock




  3. #3
    JonathaN-QQ's Avatar
    Join Date
    May 2012
    Gender
    male
    Location
    MPGH
    Posts
    217
    Reputation
    10
    Thanks
    63
    My Mood
    Aggressive
    thx thx thx thx
    Leecher: 0 ()
    Choob: 25 ()
    Newbie: 50 ()
    Advanced Member: 100 ()
    H4X0R Member: 150 ()
    Dual-Keyboard Member: 250 ()
    Expert Member: 500 ()
    Bobo's Trainer: 750 ()
    MPGH Expert: 1000 ()
    Synthetic Hacker: 1250 ()
    Blackhat Hacker: 1500 ()
    Whitehat Hacker: 2000 ()
    Bobo's Guardian: 2500 ()
    Upcoming MPGHiean: 3000 ()
    MPGH Addict: 3500 ()
    MPGHiean: 4000 ()
    MPGH Knight: 4500 ()
    MPGH Lord: 5000 ()
    MPGH Champion: 5500 ()
    MPGH King: 6000 ()
    MPGH Legend: 6500 ()
    MPGH God: 7000 ()
    MPGH God II: 7500 ()
    MPGH God III: 8000 ()
    MPGH God IV: 8500 ()
    MPGH God V: 9000 ()
    Arun's Slave: 9500 ()
    Dave's Slave: 10000 ()

  4. The Following User Says Thank You to JonathaN-QQ For This Useful Post:

    deuzagrega123 (05-25-2012)

Similar Threads

  1. [Info] Injectors download + How to use a .dll file[Video and Text]
    By Drake in forum Combat Arms Europe Hacks
    Replies: 115
    Last Post: 11-28-2019, 05:01 PM
  2. [Detected] Trans Spam (customizable/GUI/easy use)
    By DanK in forum Vindictus Hacks & Cheats
    Replies: 38
    Last Post: 08-04-2011, 11:27 AM
  3. Replies: 14
    Last Post: 12-29-2010, 05:32 AM
  4. How to make a GUI (.exe) trainer using cheat engine
    By iJustHelp in forum Call of Duty Modern Warfare 2 Tutorials
    Replies: 8
    Last Post: 05-01-2010, 06:32 PM
  5. Fonts and text colour people use
    By DoubleDutch in forum General
    Replies: 22
    Last Post: 12-05-2009, 08:20 PM

Tags for this Thread