parent
6b21e16dc8
commit
cad621e0e9
72
Cookbook.md
Normal file
72
Cookbook.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
* sizes of things in C#:
|
||||||
|
```
|
||||||
|
sizeof(Vector2) = 8
|
||||||
|
sizeof(Vector3) = 12
|
||||||
|
sizeof(Vector4) = 16
|
||||||
|
sizeof(Color) = 4
|
||||||
|
sizeof(VertexPositionColor) = 16
|
||||||
|
```
|
||||||
|
|
||||||
|
* To call sizeof(), wrap it in an unsafe block, like:
|
||||||
|
```csharp
|
||||||
|
unsafe {
|
||||||
|
Debug.WriteLine("sizeof(Vector2) = " + sizeof(Vector2));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
You also have to check a tickybox: `Project > Properties > [X] Allow unsafe code`.
|
||||||
|
|
||||||
|
* How to listen for garbage-collection events in C#: <https://docs.microsoft.com/en-us/dotnet/api/system.gc.registerforfullgcnotification>
|
||||||
|
|
||||||
|
* Modern PIL documentation: <https://pillow.readthedocs.io/en/stable/reference/Image.html>
|
||||||
|
|
||||||
|
* Import new sprite set from the CCG asset pack:
|
||||||
|
|
||||||
|
```
|
||||||
|
python3 tools/assets/import_ccg.py ~/linuxhome/assets/cleancutgames/Pixelart_Medieval_Fantasy_Characters_Pack/Characters/ Ninja_Female ~/src/assets/ > import.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Then `cp import.txt` into the appropriate output directory.
|
||||||
|
|
||||||
|
* Access modifiers in C#: <https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers>
|
||||||
|
|
||||||
|
* Matt Thorson's Monocle engine:
|
||||||
|
<https://bitbucket.org/MattThorson/monocle-engine/src/default/Monocle/>
|
||||||
|
|
||||||
|
* Here's the source code for the C# List class (for example): <https://referencesource.microsoft.com/#mscorlib/system/collections/generic/list.cs>
|
||||||
|
|
||||||
|
* Boot up SNES30 controller to talk with Windows via XInput: hold Start for a few seconds to turn it off if needed, then hold down Start+X to power on the controller in XInput mode. [Manual here.](https://download.8bitdo.com/Manual/Controller/SN30+SF30/SN30+SF30_Manual_V4.pdf) My controller's been updated to firmware version 4.20.
|
||||||
|
|
||||||
|
* Add git remotes for both gitlab and github:
|
||||||
|
|
||||||
|
```
|
||||||
|
git remote add origin git@github.com:mcmillen/sneak-private.git
|
||||||
|
git remote add gitlab git@gitlab.com:SemiColinGames/sneak-private.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can `git push origin` or `git push gitlab`.
|
||||||
|
|
||||||
|
* Remove a remote:
|
||||||
|
|
||||||
|
```
|
||||||
|
git remote remove github
|
||||||
|
```
|
||||||
|
|
||||||
|
* Push code to private and public repositories:
|
||||||
|
|
||||||
|
```
|
||||||
|
git push && tools/copybara/copybara.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
(previously: `git push origin && git push gitlab && tools/copybara/copybara.sh`)
|
||||||
|
|
||||||
|
* Find all TODOs:
|
||||||
|
|
||||||
|
```
|
||||||
|
grep TODO $(git ls-tree -r master --name-only)
|
||||||
|
```
|
||||||
|
|
||||||
|
* Fix file endings for all C# files:
|
||||||
|
|
||||||
|
```
|
||||||
|
git ls-tree -r master --name-only | grep ".cs$" | xargs dos2unix
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user