Skip to content

Commit

Permalink
Added an Mac OS OpenGL sample
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Aug 19, 2016
1 parent f86c406 commit 461edf9
Show file tree
Hide file tree
Showing 31 changed files with 770 additions and 6 deletions.
15 changes: 9 additions & 6 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,10 @@ Task ("samples")
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "iPhoneSimulator" };
});
RunNuGetRestore ("./samples/Skia.OSX.GLDemo/Skia.OSX.GLDemo.sln");
DotNetBuild ("./samples/Skia.OSX.GLDemo/Skia.OSX.GLDemo.sln", c => {
c.Configuration = "Release";
});
}

if (IsRunningOnWindows ()) {
Expand All @@ -884,19 +888,18 @@ Task ("samples")
DotNetBuild ("./samples/Skia.Forms.Demo/Skia.Forms.Demo.Windows.sln", c => {
c.Configuration = "Release";
});
RunNuGetRestore ("./samples/Skia.WindowsDesktop.GLDemo/Skia.WindowsDesktop.GLDemo.sln");
DotNetBuild ("./samples/Skia.WindowsDesktop.GLDemo/Skia.WindowsDesktop.GLDemo.sln", c => {
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "x86" };
});
}

RunNuGetRestore ("./samples/Skia.WindowsDesktop.Demo/Skia.WindowsDesktop.Demo.sln");
DotNetBuild ("./samples/Skia.WindowsDesktop.Demo/Skia.WindowsDesktop.Demo.sln", c => {
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "x86" };
});

RunNuGetRestore ("./samples/Skia.WindowsDesktop.GLDemo/Skia.WindowsDesktop.GLDemo.sln");
DotNetBuild ("./samples/Skia.WindowsDesktop.GLDemo/Skia.WindowsDesktop.GLDemo.sln", c => {
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "x86" };
});
});

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
29 changes: 29 additions & 0 deletions samples/Skia.OSX.GLDemo/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using AppKit;
using Foundation;

namespace Skia.OSX.Demo
{
[Register ("AppDelegate")]
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}

public override void DidFinishLaunching (NSNotification notification)
{
// Insert code here to initialize your application
}

public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}

public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
{
return true;
}
}
}

19 changes: 19 additions & 0 deletions samples/Skia.OSX.GLDemo/AppDelegate.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions samples/Skia.OSX.GLDemo/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Skia.OSX.Demo</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.skia-osx-demo</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>billholmes</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>

</dict>
</plist>
13 changes: 13 additions & 0 deletions samples/Skia.OSX.GLDemo/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using AppKit;

namespace Skia.OSX.Demo
{
static class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.Main (args);
}
}
}
107 changes: 107 additions & 0 deletions samples/Skia.OSX.GLDemo/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<scenes>
<!--Application-->
<scene sceneID="JPo-4y-FX3">
<objects>
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="Skia.OSX.Demo" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Skia.OSX.Demo" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About Skia.OSX.Demo" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eHP-pT-vMg"/>
<menuItem title="Quit Skia.OSX.Demo" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
<customView key="view" id="QUA-QF-Q3f">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<view translatesAutoresizingMaskIntoConstraints="NO" id="m2S-Jp-Qdl" customClass="SkiaView">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
</view>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mnJ-8z-WRI">
<rect key="frame" x="228" y="17" width="205" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="3Ya-mE-NFc"/>
<constraint firstAttribute="height" constant="21" id="PW1-2o-QII"/>
</constraints>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="5te-c2-WKW">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="LKv-bG-q8C"/>
</popUpButtonCell>
<connections>
<action selector="PopUpButtonAction:" target="XfG-lQ-9wD" id="lmM-6c-sIb"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="mnJ-8z-WRI" secondAttribute="bottom" constant="20" id="A3L-Bb-rlF"/>
<constraint firstAttribute="trailing" secondItem="mnJ-8z-WRI" secondAttribute="trailing" constant="20" id="DYI-UX-Zkb"/>
<constraint firstAttribute="bottom" secondItem="m2S-Jp-Qdl" secondAttribute="bottom" id="Gw9-r7-0Df"/>
<constraint firstItem="m2S-Jp-Qdl" firstAttribute="top" secondItem="QUA-QF-Q3f" secondAttribute="top" id="Uut-tC-oBU"/>
<constraint firstItem="m2S-Jp-Qdl" firstAttribute="leading" secondItem="QUA-QF-Q3f" secondAttribute="leading" id="Xcr-Wg-5ia"/>
<constraint firstAttribute="trailing" secondItem="m2S-Jp-Qdl" secondAttribute="trailing" id="rZp-9d-Lpb"/>
</constraints>
</customView>
<connections>
<outlet property="PopUpButton" destination="mnJ-8z-WRI" id="mEQ-lK-fod"/>
<outlet property="SkiaView" destination="m2S-Jp-Qdl" id="8ta-WW-AHG"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
</document>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 461edf9

Please sign in to comment.