Skip to content

Instantly share code, notes, and snippets.

View terriblememory's full-sized avatar

I forgot. terriblememory

View GitHub Profile
@terriblememory
terriblememory / App.xaml.cs
Last active May 24, 2017 21:51
Minimal UWP App.xaml.cs
// You don't need all of the crud the new project wizard barfs out.
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace MyThing
{
sealed partial class App : Application
{
@terriblememory
terriblememory / App.cpp
Last active October 12, 2017 16:09
Single file C++ UWP D3D11 shell
/**
App.cpp
*/
#include "pch.h"
#include <agile.h>
#include <dxgi1_4.h>
#include <d3d11_3.h>
#include <DirectXMath.h>
@terriblememory
terriblememory / Acrylic.cs
Last active October 12, 2017 16:03
UWP CompositionBrush containing a tiling noise texture, host backdrop
var compositor = Window.Current.Compositor;
var noiseUri = new System.Uri("ms-appx:///Assets/noisy-texture-256x256.png");
var noiseSurface = LoadedImageSurface.StartLoadFromUri(noiseUri);
var noiseBrush = compositor.CreateSurfaceBrush();
noiseBrush.Surface = noiseSurface;
noiseBrush.Stretch = CompositionStretch.None;
var composeNoiseAndBackgroundEffectDesc = new ArithmeticCompositeEffect()
{
@terriblememory
terriblememory / LomontFFT.cs
Last active October 10, 2017 05:37
Lomont Fast Fourier Transform (see http://www.lomont.org/Software/index.php)
// Code to implement decently performing FFT for complex and real valued
// signals. See www.lomont.org for a derivation of the relevant algorithms
// from first principles. Copyright Chris Lomont 2010-2012.
// This code and any ports are free for all to use for any reason as long
// as this header is left in place.
// Version 1.1, Sept 2011
using System;
/* History:
* Sep 2011 - v1.1 - added parameters to support various sign conventions
@terriblememory
terriblememory / XamlCompositionBrushBaseExample.cs
Created October 12, 2017 16:05
XamlCompositionBrushBase example
public class ExampleBrush : XamlCompositionBrushBase
{
protected override void OnConnected()
{
if (CompositionBrush == null)
{
var compositor = Window.Current.Compositor;
var bitmapUri = new System.Uri("ms-appx:///Assets/StoreLogo.png");
var bitmapSurface = LoadedImageSurface.StartLoadFromUri(bitmapUri);
@terriblememory
terriblememory / PixelImage.cs
Last active November 3, 2017 19:41
A UWP XAML Brush class that uses a modifiable pixel image as its data source. The real functionality this adds over the built-in types (e.g. WriteableBitmap and Image) is control over the interpolation mode.
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.UI.Composition;
using System;
using Windows.Graphics.DirectX;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
namespace PixelImage
{
@terriblememory
terriblememory / AppView.cpp
Created December 6, 2017 22:04
Minimal C++/CX D3D11 UWP sample
/**
D3D11AppView.cpp
*/
#include "pch.h"
#include "D3D11AppView.h"
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
@terriblememory
terriblememory / D3D11AppView.cpp
Last active March 19, 2022 09:25
Minimal C++/WinRT D3D11 UWP sample
/**
D3D11AppView.cpp
*/
#include "pch.h"
#include "D3D11AppView.h"
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
@terriblememory
terriblememory / README.MD
Created December 12, 2017 20:14
Configuring a C++/WinRT project in Visual Studio.

Configuring a C++/WinRT project in Visual Studio.

  1. Select Tools|Nuget Package Manager|Manage Nuget Packages for Solution...
  2. Select Browse, search for cppwinrt and install for the project.
  3. Right click the project, and select Properties.
  4. Select All Configurations and All Platforms.
  5. Select C/C++, Command Line.
  6. Add /await /std:c++latest command line switches.
  7. Select C/C++, All Options.
  8. Set Consume Windows Runtime Extension to No.
@terriblememory
terriblememory / charts.cs
Last active May 15, 2018 21:53
List of FAA raster chart names and short codes
/// <summary>
/// In general the three letter code is just the first three letters of
/// the name. Where this would result in a duplicate (e.g. New Orleans,
/// New York) or otherwise be unclear some reasonable mnemonic is chosen.
/// </summary>
private Dictionary<string, string> cities = new Dictionary<string, string>
{
{ "ALB", "Albuquerque" },
{ "ANC", "Anchorage" },
{ "ATL", "Atlanta" },