C
C#7mo ago
Frite

how can I avoid chaos like this ?

No description
12 Replies
Keswiik
Keswiik7mo ago
For starters, what are you trying to do? Because you could just check Keyboard.GetState().IsKeyDown(...) instead of trying to make a bunch of properties
Frite
FriteOP7mo ago
but what if i want proprerties ?
Saber
Saber7mo ago
Then deal with the mess
Pobiega
Pobiega7mo ago
at least capitalize them, and use the => expression syntax
Frite
FriteOP7mo ago
No description
Shawn
Shawn7mo ago
Why do you want properties?
Frite
FriteOP7mo ago
to turn this into this
No description
The Fog from Human Resources
But why :pwetty: Seems like lots of extra work for very little payoff
Frite
FriteOP7mo ago
i had enouth of copy+past i will allways keep it when i code
kurumi
kurumi7mo ago
don't forget other snippets included: multiple functions to change console colors (aka Console.SetRed() / Blue / Green / etc), get all processes in OS (aka Processes.Google / notepad / vscode / etc). it is super useless at least you can create extension method to avoid this boilerplate code or write custom SG
Angius
Angius7mo ago
public bool IsKey(Key k)
=> Keyboard.GetState().IsKeyDown(k);
public bool IsKey(Key k)
=> Keyboard.GetState().IsKeyDown(k);
if (IsKey(Key.A))
{

}
if (IsKey(Key.A))
{

}
Shorter, but no boilerplate

Did you find this page helpful?