Skip to content

Instantly share code, notes, and snippets.

View jamesmundy's full-sized avatar

James Mundy jamesmundy

View GitHub Profile
@jamesmundy
jamesmundy / Windows8TileLayout
Created October 29, 2014 22:33
Small section of a sample where I create a Windows 8 tile control. https://medium.com/p/84454669b005
<Grid>
<Grid x:Name="Grid" Background="#FF00FB22">
<Grid.Projection>
<PlaneProjection RotationX="-180"/>
</Grid.Projection>
</Grid>
<Grid x:Name="Grid1" Background="Red">
<Grid.Projection>
<PlaneProjection/>
</Grid.Projection>
@jamesmundy
jamesmundy / FlipInStoryboard
Created October 29, 2014 22:59
FlipIn animation for Windows 8 Tile Control: https://medium.com/p/84454669b005
Storyboard x:Name="FlipIn">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="grid">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="0:0:0.5">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
<UserControl
x:Class="W8TileControl.TileControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<UserControl.Resources>
@jamesmundy
jamesmundy / W8TileC#
Created October 29, 2014 23:25
Windows 8 Tile Control Code-behind: https://medium.com/p/84454669b005
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace W8TileControl
{
public sealed partial class TileControl : UserControl
{
public static readonly DependencyProperty FrontImageProperty = DependencyProperty.Register(
@jamesmundy
jamesmundy / SVGImageControl for Xamarin Android
Created November 18, 2014 17:07
An SVG image control for Xamarin.Android.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
@jamesmundy
jamesmundy / SVG Custom Attribute
Created November 18, 2014 17:13
Custom attribute used for my SVG Image control
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<declare-styleable name="ImageControl">
<attr name="SVGSource" format="string"/>
</declare-styleable>
</resources>
@jamesmundy
jamesmundy / SCGImageControl Layout
Created November 18, 2014 17:24
Using our SVG ImageControl in a layout
Needed for custom attribute: xmlns:app="http://schemas.android.com/apk/res-auto"
<Foundbite.GameAndroid.CustomViews.ImageControl
android:layout_width="match_parent"
android:layout_height="match_parent"
app:SVGSource="SVG/Image.svg"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginBottom="36dp"
android:layout_marginTop="36dp" />
@jamesmundy
jamesmundy / GetPath
Created November 26, 2014 16:49
GetPath method used to save in different places depending on build type.
public static string GetPath()
{
if (Debugger.IsAttached) return Android.OS.Environment.ExternalStorageDirectory.Path;
else return Application.Context.FilesDir.Path;
}
@jamesmundy
jamesmundy / Settings
Created November 26, 2014 17:06
Settings class for retrieving data using ApplicationSettings
public class Settings
{
//Store game highscore.
public static readonly Setting<int> HighScore = new Setting<int>("HighScore", 0);
}
@jamesmundy
jamesmundy / SettingsSave
Last active August 29, 2015 14:10
Save a value into settings using IsolatedStorage.ApplicationSettings
Settings.HighScore.Value = 1000;