Skip to content

Instantly share code, notes, and snippets.

@Alan-FGR
Alan-FGR / MyFunction.txt
Last active October 1, 2017 19:38
Better code comments for C#
Current way has some cool features, but nobody uses them, and SNR is terrible, plus XML is terribly bad too:
/// <summary>
/// Function summary goes here
/// </summary>
/// <param name="param1">Some <i>crazy</i> number</param>
/// <param name="param2">Some <b>bad</b> string</param>
/// <param name="param3">An amazingly nice value</param>
/// <returns>Function returns <see cref="SomeClassType"/></returns>
@Alan-FGR
Alan-FGR / Program.cs
Created September 1, 2017 23:20
Multiple Scenes on Nez.FNA
// YOU NEED MY MULTISCENE BRANCH: https://github.com/Alan-FGR/Nez/tree/multiscene
class TestScene : MScene
{
public override void initialize()
{
base.initialize();
setDesignResolution(640,360,SceneResolutionPolicy.ShowAll);
renderer = new DefaultRenderer();
renderer.renderTexture = new RenderTexture(640,360);
@Alan-FGR
Alan-FGR / GameScene.cs
Created September 1, 2017 20:32
Example showing how to have independent resolution for UI and game in Nez
public class GameScene : Scene, IFinalRenderDelegate
{
public const int UI_RENDER_LAYER = 512;
private readonly Renderer uiRenderer_;
private readonly Renderer gameRenderer_;
private int uiZoom_ = 3;
private int gameZoom_ = 2;
public GameScene()
{
@Alan-FGR
Alan-FGR / snippet.cs
Created August 30, 2017 04:14
Set hardware cursor in FNA
IntPtr surf = SDL2.SDL_image.IMG_Load("yourcursor.bmp"); // SDL_image supports most popular of formats
IntPtr cur = SDL2.SDL.SDL_CreateColorCursor(surf, 0, 0); // set hot spot (click pixel)
SDL2.SDL.SDL_SetCursor(cur); // actually sets the cursor
SDL2.SDL.SDL_ShowCursor(1); // just in case :P
@Alan-FGR
Alan-FGR / LICENSE
Created August 16, 2017 12:42
Easy Licensing
Copyright (c) <YEAR> <OWNER>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
--- NO MISREPRESENTATION (OPTIONAL)
Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
---
@Alan-FGR
Alan-FGR / ImpostorChunk.hp3
Created July 16, 2017 21:56
Atomic Impostors
Vector<Node*> imposterNodes;
protected:
SharedPtr<Geometry> geometry_;
private:
VertexBuffer* vb = NULL;
IndexBuffer* ib = NULL;
using AtomicEngine;
using AtomicPlayer;
public class AtomicMain : AppDelegate
{
private UIView uiView_;
public override void Start()
{
uiView_ = new UIView();
//
// Copyright (c) 2008-2016 the Urho3D project.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
1>------ Build started: Project: GenerateScriptBindings, Configuration: Release x64 ------
1> Building Custom Rule C:/_AtomicTest192/AtomicGameEngine/Source/AtomicTool/CMakeLists.txt
1> CMake does not need to re-run because C:\_AtomicTest192\AtomicGameEngine-VS2015\Source\AtomicTool\CMakeFiles\generate.stamp is up-to-date.
1> TSLINT: Linting files in {./Script/AtomicEditor/**/*.ts,./Script/AtomicWebViewEditor/**/*.ts}
1> TSLINT: WARNING - Lint errors detected
1> Script/AtomicEditor/resources/ProjectTemplates.ts[164, 11]: missing semicolon
1> Script/AtomicEditor/resources/ResourceOps.ts[39, 149]: missing semicolon
1> Script/AtomicEditor/resources/ResourceOps.ts[81, 26]: missing semicolon
1> Script/AtomicEditor/resources/ResourceOps.ts[98, 14]: missing semicolon
1> Script/AtomicEditor/ui/frames/HierarchyFrame.ts[92, 1]: trailing whitespace
@Alan-FGR
Alan-FGR / cache.cs
Created November 26, 2016 13:34
Why?
// OK
internal static class Cache
{
private static readonly ResourceCache _cache;
static Cache()
{
_cache = AtomicNET.GetSubsystem<ResourceCache>();
}