DerelictCocoa test app

This commit is contained in:
Vadim Lopatin 2015-11-11 18:49:36 +03:00
parent 3f4fa96cb7
commit 17274d19e0
6 changed files with 127 additions and 4 deletions

2
.gitignore vendored
View File

@ -22,3 +22,5 @@ screenshots.html
*.log
include
lib/res
.DS_Store
*.userprefs

View File

@ -196,6 +196,7 @@ Clone dependency libraries
git clone https://github.com/gecko0307/dlib.git
git clone https://github.com/Devisualization/image.git de_image
git clone https://github.com/Dav1dde/gl3n.git
git clone https://github.com/p0nce/DerelictCocoa.git
Open solution file with Mono-D

View File

@ -184,5 +184,12 @@
<Compile Include="3rdparty\fontconfig\package.d" />
<Compile Include="3rdparty\fontconfig\types.d" />
<Compile Include="src\dlangui\package.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\appkit.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\cocoa.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\coregraphics.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\coreimage.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\foundation.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\package.d" />
<Compile Include="deps\DerelictCocoa\source\derelict\cocoa\runtime.d" />
</ItemGroup>
</Project>

View File

@ -5,6 +5,8 @@ Project("{3947E667-4C90-4C3A-BEB9-7148D6FE0D7C}") = "dlangui-monod-osx", "dlangu
EndProject
Project("{3947E667-4C90-4C3A-BEB9-7148D6FE0D7C}") = "example1-monod-osx", "examples\example1\example1-monod-osx.dproj", "{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}"
EndProject
Project("{3947E667-4C90-4C3A-BEB9-7148D6FE0D7C}") = "derelictcocoatest-monod-osx", "examples\derelictcocoatest-monod-osx\derelictcocoatest-monod-osx.dproj", "{1F050D82-5245-4B51-A554-473194EA0DE9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -12,17 +14,23 @@ Global
Unittest|Any CPU = Unittest|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Debug|Any CPU.ActiveCfg = Debug|x64
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Debug|Any CPU.Build.0 = Debug|x64
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Release|Any CPU.Build.0 = Release|Any CPU
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Unittest|Any CPU.ActiveCfg = Unittest|Any CPU
{079F4963-E637-4E8F-9EB3-BDC404F9DC1D}.Unittest|Any CPU.Build.0 = Unittest|Any CPU
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Debug|Any CPU.ActiveCfg = Debug|x64
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Debug|Any CPU.Build.0 = Debug|x64
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Release|Any CPU.Build.0 = Release|Any CPU
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Unittest|Any CPU.ActiveCfg = Unittest|Any CPU
{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}.Unittest|Any CPU.Build.0 = Unittest|Any CPU
{1F050D82-5245-4B51-A554-473194EA0DE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F050D82-5245-4B51-A554-473194EA0DE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F050D82-5245-4B51-A554-473194EA0DE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F050D82-5245-4B51-A554-473194EA0DE9}.Release|Any CPU.Build.0 = Release|Any CPU
{1F050D82-5245-4B51-A554-473194EA0DE9}.Unittest|Any CPU.ActiveCfg = Unittest|Any CPU
{1F050D82-5245-4B51-A554-473194EA0DE9}.Unittest|Any CPU.Build.0 = Unittest|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1F050D82-5245-4B51-A554-473194EA0DE9}</ProjectGuid>
<Compiler>DMD2</Compiler>
<PreferOneStepBuild>true</PreferOneStepBuild>
<UseDefaultCompiler>true</UseDefaultCompiler>
<IncrementalLinking>true</IncrementalLinking>
<DependentProjectIds>
<DependentProjectIds>
<String>{1CC7C43E-7B39-4AFC-A45B-F1D9F582CF6D}</String>
</DependentProjectIds>
</DependentProjectIds>
<Includes>
<Includes>
<Path>../../src</Path>
<Path>../../deps/dlib</Path>
<Path>../../deps/gl3n</Path>
<Path>../../deps/DerelictGL3/source</Path>
<Path>../../deps/DerelictCocoa/source</Path>
<Path>../../deps/DerelictSDL2/source</Path>
<Path>../../deps/DerelictFT/source</Path>
<Path>../../deps/DerelictUtil/source</Path>
</Includes>
</Includes>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug</OutputPath>
<ObjectsDirectory>obj/Debug</ObjectsDirectory>
<LinkinThirdPartyLibraries>false</LinkinThirdPartyLibraries>
<UnittestMode>false</UnittestMode>
<OutputName>derelictcocoatest-monod-osx</OutputName>
<Target>Executable</Target>
<Externalconsole>true</Externalconsole>
<DebugLevel>0</DebugLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release</OutputPath>
<ObjectsDirectory>obj/Release</ObjectsDirectory>
<LinkinThirdPartyLibraries>false</LinkinThirdPartyLibraries>
<UnittestMode>false</UnittestMode>
<OutputName>derelictcocoatest-monod-osx</OutputName>
<Target>Executable</Target>
<Externalconsole>true</Externalconsole>
<DebugLevel>0</DebugLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Unittest|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Unittest</OutputPath>
<ObjectsDirectory>obj/Unittest</ObjectsDirectory>
<LinkinThirdPartyLibraries>false</LinkinThirdPartyLibraries>
<UnittestMode>true</UnittestMode>
<OutputName>derelictcocoatest-monod-osx</OutputName>
<Target>Executable</Target>
<Externalconsole>true</Externalconsole>
<DebugLevel>0</DebugLevel>
</PropertyGroup>
<ItemGroup>
<Folder Include="src\" />
</ItemGroup>
<ItemGroup>
<Compile Include="src\cocoatest.d" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,38 @@
module cocoatest;
import derelict.cocoa;
import dlangui.core.logger;
void main(string[] args)
{
Log.setStderrLogger();
Log.setLogLevel(LogLevel.Trace);
DerelictCocoa.load();
NSString appName = NSProcessInfo.processInfo().processName();
Log.i("appName = %s", appName);
//writefln("appName = %s", appName);
auto pool = new NSAutoreleasePool;
auto NSApp = NSApplication.sharedApplication;
NSApp.setActivationPolicy(NSApplicationActivationPolicyRegular);
NSMenu menubar = NSMenu.alloc;
menubar.init_();
NSMenuItem appMenuItem = NSMenuItem.alloc();
appMenuItem.init_();
menubar.addItem(appMenuItem);
NSApp.setMainMenu(menubar);
NSWindow window = NSWindow.alloc();
window.initWithContentRect(NSMakeRect(10, 10, 200, 200),
NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask, //NSBorderlessWindowMask,
NSBackingStoreBuffered, NO);
window.makeKeyAndOrderFront();
NSApp.activateIgnoringOtherApps(YES);
NSApp.run();
}