Explicit 213 Posted January 7, 2015 /** * Created with IntelliJ IDEA * User: Anthony * Date: 12/11/14 */ public enum OSCrosshair { /** * #ordinal corresponds with the crosshair index */ NONE, DEFAULT, ACTION } Example use: public boolean didSuccessfullyInteract() { return getMouse().getCrosshairColor() == OSCrosshair.ACTION.ordinal() } Obviously use #getLastCrosshairColor or even write another method if checking after the crosshair has disappeared.
Eliot 193 Posted January 7, 2015 For those of us who may be unaware, please explain what a mouse crosshair is.
Pandemic 2853 Posted January 7, 2015 For those of us who may be unaware, please explain what a mouse crosshair is. It's the little crosshair that turns red to show you clicked something.
Explicit 213 Author Posted January 8, 2015 enum is a waste but easier to understand then 0,1,2 No it's not, an enum makes perfect sense here. Hardcoding these values into your code is a beyond awful way to do things.
Nuclear Nezz 2105 Posted January 8, 2015 No it's not, an enum makes perfect sense here. Hardcoding these values into your code is a beyond awful way to do things. But aren't you essentially hard coding it anyway with the return getMouse().getCrosshairColor() == OSCrosshair.ACTION.ordinal() ? Also we definitely have constants with the numbers for variable name recognition. I dunno if they got obfuscated or not though.
Harold 11 Posted January 8, 2015 Kek the ordinals get rekt if u guys use proper obfuscation sorry m8 but probably won't work (Never use ordinal dude :-(, store it in a variable instead )
Explicit 213 Author Posted January 8, 2015 Kek the ordinals get rekt if u guys use proper obfuscation sorry m8 but probably won't work (Never use ordinal dude :-(, store it in a variable instead ) Titties, I forgot about obfuscation. But aren't you essentially hard coding it anyway with the return getMouse().getCrosshairColor() == OSCrosshair.ACTION.ordinal() ? Also we definitely have constants with the numbers for variable name recognition. I dunno if they got obfuscated or not though. How is that hard coded? If the action index changes I merely have to change the enum constant, unlike if I put the exact number in where I would have to search my code for all uses.
Nuclear Nezz 2105 Posted January 10, 2015 Titties, I forgot about obfuscation. How is that hard coded? If the action index changes I merely have to change the enum constant, unlike if I put the exact number in where I would have to search my code for all uses. tru. But if you're using it in one method than you'd only have to change it in one place anyway So you have the same amount of changes. I dunno. I consider that hard coding. I wouldn't if you set variables in the enums. Or if you set it as a variable. but enum.ordinal()? I dun like it. rip
Explicit 213 Author Posted January 11, 2015 tru. But if you're using it in one method than you'd only have to change it in one place anyway Where is face palm emoticon
Recommended Posts
Archived
This topic is now archived and is closed to further replies.