3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include "DXGIException.h"
\r
26 #include "Factory1.h"
\r
27 #include "Adapter1.h"
\r
29 using namespace System;
\r
35 Factory1::Factory1( IDXGIFactory1* pointer, ComObject^ owner )
\r
38 Construct( pointer, owner );
\r
41 Factory1::Factory1( IntPtr pointer )
\r
44 Construct( pointer, NativeInterface );
\r
47 Factory1^ Factory1::FromPointer( IDXGIFactory1* pointer, ComObject^ owner, ComObjectFlags flags )
\r
49 return ComObject::ConstructFromPointer<Factory1, IDXGIFactory1>( pointer, owner, flags );
\r
52 Factory1^ Factory1::FromPointer( IntPtr pointer )
\r
54 return ComObject::ConstructFromUserPointer<Factory1>( pointer );
\r
57 Factory1::Factory1()
\r
60 IDXGIFactory1* factory = 0;
\r
61 RECORD_DXGI( CreateDXGIFactory1( __uuidof( IDXGIFactory1 ), reinterpret_cast<void**>( &factory ) ) );
\r
62 if( Result::Last.IsFailure )
\r
63 throw gcnew DXGIException( Result::Last );
\r
65 Construct( factory );
\r
68 int Factory1::GetAdapterCount1()
\r
71 IDXGIAdapter1* adapter = 0;
\r
72 while( InternalPointer->EnumAdapters1( count, &adapter ) != DXGI_ERROR_NOT_FOUND )
\r
81 Adapter1^ Factory1::GetAdapter1(int index)
\r
83 IDXGIAdapter1* adapter = 0;
\r
84 RECORD_DXGI( InternalPointer->EnumAdapters1( index, &adapter) );
\r
85 if( Result::Last.IsFailure )
\r
88 return Adapter1::FromPointer( adapter, this );
\r
91 bool Factory1::IsCurrent::get()
\r
93 return InternalPointer->IsCurrent() == TRUE;
\r