@LeeC2202 Gee I haven't recognized this before. @rappo needs to fix this. Shouldn't be a big thing.
Cyron43
View profile on GTA5-Mods.com »
Posts made by Cyron43
-
RE: Main site.... how does it search?posted in Site-Related Questions & Feedback
-
RE: [SCRIPT] [RELEASE] [WIP] - Grand Theft Spaceposted in Releases & Works in Progress
@Cri-28 We modders are no company.
We are not on a payroll,
we have our real life duties,
we work on our mods when we feel like it,
we have no release dates for our products.
Hmm maybe I should make this a bumper sticker or a T-Shirt print. -
RE: Teamworkposted in Site-Related Questions & Feedback
@Shaezbreizh If developers want to work in a team there are distributed versioning systems like git and git repository hosters like Bitbucket and github. This is not only suitable for joined programming efforts (however the main reason) but for all kind of files. Just google the bold printed keywords for more information.
If developers even want to work in a team is a whole different story. Developers are like artists. We all have our own way of doing things like a painter has his unique way of swinging the brush. Even professionals have different opinions about how to approach solutions and which software architecture they think fits best. One everlasting conflict, for example, is whether a "test first" approach is the best. There are clean code developers (like myself) and so called duct tape programmers (they call themselves pragmatic programmers). They get things done more quickly but their code is a mess and hardly maintainable. Personally I wouldn't want anyone to mess with my code.
-
RE: [SCRIPT] [RELEASE] [WIP] - Grand Theft Spaceposted in Releases & Works in Progress
On the bright side, @sollaholla's space mod got a lot of publicity with this. :D
I was unaware of it before the sh** has hit the fan. -
RE: [.NET] [C#] [SHVDN] Modding Basics! What is OnTick? [Part 2]posted in Tutorials
@LeeC2202 That makes sense. Thank you.
However, what you described is exactly the reason why I always use the KeyUp event as it recognizes the key combination at the time the user releases the keys. I can imagine that someone (hypothetically) releases the keys not simultaneously. What if he releases the Shift-key first? The KeyUp event would fire (right?) but wouldn't the Modifier-property return "None" (or whatever gets returned in that case)? I admit I have never used the Modifier-property in my profession but you gave me a reason to have a closer look at it. -
RE: [.NET] [C#] [SHVDN] Modding Basics! What is OnTick? [Part 2]posted in Tutorials
@LeeC2202 About using both key events: of course you are right in that case. However I had those mods in mind which attach both events and one of them to an empty handler (relates to my point 2). I should have made this more clear. My bad.
About the keyboard state: Why is
e.Modifiers != Keys.Shiftbetter than!e.Shift? In the MSDN library we can read the following remark: "To determine whether a specific modifier key was pressed, use the Control, Shift, and Alt properties. Modifier flags can be combined with bitwise OR.". So if I want to query a combination of Shift, Ctrl and/or Alt I'd need to filter the Modifiers property through a bitwise OR operation instead of simply querying KeyEventArgs.Shift and so on.
https://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs.modifiers(v=vs.110).aspx -
RE: [.NET] [C#] [SHVDN] Modding Basics! What is OnTick? [Part 2]posted in Tutorials
-
You don't need to subscribe to both the KeyDown event and the KeyUp event. Decide for either one. I recommend the KeyUp event because it's more reliable on key combinations.
-
Don't attach an empty event handler method to an event. That makes absolutely no sense. I know you didn't do that in your examples here. I'm just saying because I have seen this several times in the code of other people.
-
The key filter is insufficient. It does not differentiate between L, Shift+L, Ctrl+L, Alt+L or any combination of these. A correct key filter looks like this:
if(e.KeyCode == Keys.L && !e.Alt && !e.Ctrl && !e.Shift)
Maybe you ask why it is important to query such bool properties for being false. The simple reason is that we only have a low amount of keys on the keyboard but a huge load of mods which need keyboard input. If one waits for L and the other for Shift+L and one or both have no proper key filtering you end up with a conflict!
-
For performance reasons one should only subscribe to the Tick event if actually needed.
-
Avoid accidental multiple subscriptions of the same event handler to the Tick event. This can easily happen, especially when the code grows bigger. Simply avoid this with the help of a bool field, like this:
private bool _onTickAttached;
...
private void SomeMethod(...)
{
if(!_onTickAttached)
{
Tick += OnTick;
_onTickAttached = true;
}
}private void AnotherMethod()
{
if(_onTickAttached)
{
Tick -= OnTick;
_onTickAttached = false;
}
} -