求助:DirectX 8.0 源码报错
第一章第一节的源码,就没有通过。
实验配置:
Windows7、DX8_SDK
Cfree5.0,设置了Include和Library目录。源码未通过。
VC++6.0,设置了Include和Library目录。源码未通过。
网上看到以下片段:
“第二步:添加链接所需的库文件,如dxguid.lib、d3d9.lib、d3dx9.lib等,……”
这一步骤我不懂,不知是否因为缺少这一步骤?针对DX8和本源码,该如何设置?
----------------------------------------------------------------------------------------
下载: 源码 +《Direct3D中的2D编程》PDF
https://download.csdn.net/download/u010971968/5882089
PDF在线阅读
https://ishare.iask.sina.com.cn/f/22639180.html
附源码Example1_1,所有可在上面链接下载
//Example1_1
//main.cpp
//Ernest Pazera
//04OCT2001
//TGO-01-C
//Libs: d3d8.lib
#include <windows.h> //include windows stuff
#include <stdio.h> //standard input/output
#include "D3D8.h" //include direct3d8 stuff
//constants
//window class name
const char* WINDOWCLASS = "3D42DGP" ;
//window title
const char* WINDOWTITLE = "Example 1.1 (TGO-01-C): Creating and Destroying an IDirect3D8 object" ;
//globals
//instance handle
HINSTANCE g_hInstance = NULL ;
//window handle
HWND g_hWnd = NULL ;
//IDirect3D8 pointer
IDirect3D8* g_pd3d = NULL ;
//function prototypes
//winmain
int WINAPI WinMain ( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nShowCmd ) ;
//window procedure
LRESULT CALLBACK TheWindowProc ( HWND hWnd , UINT uMsg , WPARAM wParam , LPARAM lParam ) ;
//initialization
void Prog_Init ( ) ;
//clean up
void Prog_Done ( ) ;
//window procedure
LRESULT CALLBACK TheWindowProc ( HWND hWnd , UINT uMsg , WPARAM wParam , LPARAM lParam )
{
//which message did we get?
switch ( uMsg )
{
case WM_DESTROY : //window being destroyed
{
//quit
PostQuitMessage ( 0 ) ;
//message handled, return 0
return ( 0 ) ;
} break ;
default: //all other messages, send to default handler
return ( DefWindowProc ( hWnd , uMsg , wParam , lParam ) ) ;
}
}
//winmain
int WINAPI WinMain ( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nShowCmd )
{
//grab instance handle
g_hInstance = hInstance ;
//redirect stderr and stdout output
freopen ( "stderr.txt" , "w" , stderr ) ;
freopen ( "stdout.txt" , "w" , stdout ) ;
//fill in window class
WNDCLASSEX wc ;
wc.cbClsExtra = 0 ; //no extra class information
wc.cbSize = sizeof ( WNDCLASSEX ) ; //size of structure
wc.cbWndExtra = 0 ; //no extra window information
wc.hbrBackground = ( HBRUSH ) GetStockObject ( BLACK_BRUSH ) ; //black brush
wc.hCursor = NULL ; //no cursor
wc.hIcon = NULL ; //no icon
wc.hIconSm = NULL ; //no small icon
wc.hInstance = g_hInstance ; //instance handle
wc.lpfnWndProc = TheWindowProc ; //window procedure
wc.lpszClassName = WINDOWCLASS ; //name of class
wc.lpszMenuName = NULL ; //no menu
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC ; //class styles
//register window class
RegisterClassEx ( &wc ) ;
//create window
g_hWnd = CreateWindowEx ( 0 , WINDOWCLASS , WINDOWTITLE , WS_OVERLAPPEDWINDOW , 0 , 0 , 320 , 240 , NULL , NULL , g_hInstance , NULL ) ;
//show the window
ShowWindow ( g_hWnd , nShowCmd ) ;
//initialization
Prog_Init ( ) ;
MSG msg ;
//message pump
for ( ; ; )
{
//check for a message
if ( PeekMessage( &msg , NULL , 0 , 0 , PM_REMOVE ) )
{
//message exists
//check for quit message
if ( msg.message == WM_QUIT ) break ;
//translate the message
TranslateMessage ( &msg ) ;
//dispatch the message
DispatchMessage ( &msg ) ;
}
}
//clean up
Prog_Done ( ) ;
//exit
return ( msg.wParam ) ;
}
//initialization
void Prog_Init ( )
{
//create the IDirect3D8 object
g_pd3d = Direct3DCreate8 ( D3D_SDK_VERSION ) ;
//error check
if ( g_pd3d )
{
//success
fprintf ( stdout , "IDirect3D8 object created successfully.\n" ) ;
}
else
{
//failure
fprintf ( stderr , "IDirect3D8 object creation failed.\n" ) ;
}
}
//clean up
void Prog_Done ( )
{
//safe release of IDirect3D8 object
if ( g_pd3d )
{
//release
g_pd3d->Release ( ) ;
//set to null
g_pd3d = NULL ;
//report action
fprintf ( stdout , "IDirect3D8 object released.\n" ) ;
}
}
相关推荐
永劫无间启动报错解决[可运行源码]
本文提供了永劫无间游戏启动报错的全面解决方案,包括基础排查步骤如重启游戏和电脑、验证游戏文件完整性,以及驱动与系统更新的重要性。还详细介绍了后台程序管理、硬件配置检查和网络优化方案。针对不同错误代码提供了分类处理方法,如重装DirectX或调整虚拟内存设置。此外,文章还推荐使用InsCode(快马)平台快速构建游戏辅助工具,无需复杂配置即可生成实用程序,适合快速验证想法的玩家。
Win98/2000时代DirectX 7.0开发必备精简包:含D3D、DSound、DInput等全套头文件与工具源码
专为老旧Windows平台(如Win98/2000)和VC++ 6.0环境准备的DirectX 7.0轻量开发资源,不依赖完整SDK安装即可直接编译使用。包含图形渲染核心头文件:d3d.h、d3dcaps.h、d3drm.h、d3dxmath.h;音频模块dsound.h、dmusici.h、dmusicf.h;输入控制dinput.h、dinputd.h;网络通信dplay.h、dplobby.h;以及通用辅助文件ddutil.cpp、dxfile.h、dsetup.h、dmerror.h等。所有接口定义
【C++】2.0版游戏GUI图形界面示例程序 by浅墨
浅墨出品,零资源分下载,分享精神至上~ 20版主要实现了GUI多页面间的切换。 其中的音乐和背景来自刺客信条。 源码的配套博文是 《 【Visual C++】游戏开发五十七 浅墨DirectX教程二十四 打造游戏GUI界面(二)》 ,文章地址http://blog.csdn.net/poem_qianmo/article/details/16922703, 点击Release文件夹下的exe文件可以直接看到运行效果 运行需要DirectX运行库的支持。报缺少D3D的DLL系列错误的童鞋们请google/百度一下 “DirectX 9.0c runtime”,下载并装个最新版的。 报缺少MVCR100D.Dll错误的朋友们去下一个安装就可以了,或者直接点击sln打开工程再次编译一次。 如果是想调试并运行源代码,但是报错了,请去下载最新版DirectX SDK并进行DirectX开发环境的配置。 编写环境:VS2010 我的博客地址是http://blog.csdn.net/zhmxy555,源码结合配套文章一起看效果更佳。 希望能和大家一起交流,共同学习,共同进步。
win7--vs2015下载编译webrtc源码过程
此文档为2018年9月20号,下载webrtc源码并成功编译的过程及步骤,包含其中遇到的各种问题及解决方法。
易语言源码易语言DX按钮源码
易语言源码易语言DX按钮源码


