我正在创建一个Direct2D应用程序,API概述页面说第一步是创建一个工厂......我试过这个功能
func buttonAction(sender : UIButton) {
var selectedButtonCell = sender.superview as! UICollectionViewCell
//Incase your button is inside cell.contentview
// var selectedButtonCell = sender.superview.superview as! UICollectionviewCell
var indexPath = collectionView.indexPathForCell(selectedButtonCell)
if indexPath.row == 0 {
//Button in first cell is selected
//Send user to first button view controller
}
}
但是它给出了错误
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &factory);
我在WinMain函数中调用D2D1CreateFactory函数。
这是我初始化工厂指针的方式
Error 62 error LNK2019: unresolved external symbol _D2D1CreateFactory@16 referenced in function "long __cdecl D2D1CreateFactory(enum D2D1_FACTORY_TYPE,struct _GUID const &,void * *)" (?D2D1CreateFactory@@YAJW4D2D1_FACTORY_TYPE@@ABU_GUID@@PAPAX@Z
这些是包含和库目录
ID2D1Factory *factory;
我有使用direct3D的经验所以我熟悉设备和渲染目标,但我的印象是对于direct2D工厂是第一个,因此我没有创建任何设备,渲染目标等...... / p>
感谢任何帮助。
答案 0 :(得分:3)
尝试将此指令添加到您的代码中。
#pragma comment(lib, "d2d1.lib")
它会将d2d1.lib
链接到您的目标代码。
您可以使用此指令链接到其他库。