You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.2 KiB
Markdown
125 lines
3.2 KiB
Markdown
This repository contains RenderWare source code by Criterion.
|
|
It is provided strictly for educational or demo-creation purposes. Use for commercial purposes is forbidden
|
|
without explicit consent by Criterion.
|
|
|
|
Code is being maintained.
|
|
|
|
Version 3.7ex, GTA community edition.
|
|
|
|
# How to include rw37 to your own VS project
|
|
|
|
1. Place the rw37 git repository folder into the same directory as your RW project (side-by-side). Thus you have something like...
|
|
|
|
```
|
|
X:\DEVEL\RW\rw37\ - rwsrc
|
|
X:\DEVEL\RW\rwproject\ - your own code
|
|
```
|
|
|
|
2. Assuming that you have a "build" folder inside of your project folder with the VS project inside, open the .vcxproj file with your favourite text editor. Go down the folder to the very bottom of the <Project> XML node. Then insert the following nodes at the end of your <Project> node:
|
|
|
|
```
|
|
<Import Project="../../rw37/build/defaults.props" />
|
|
<Import Condition="Exists('../../_repoconfig/rw37.props')" Project="../../_repoconfig/rw37.props" />
|
|
<Import Condition="Exists('../../rw37/build/rw37.vcxproj.user')" Project="../../rw37/build/rw37.vcxproj.user" />
|
|
<Import Project="../../rw37/build/buildcfg.targets" />
|
|
```
|
|
|
|
3. Include the rw37.vcxproj file into the VS solution of your rwproject.
|
|
4. Set your rwproject to depend on the rw37 project so that rw37 is built before it.
|
|
|
|
# Example TXD loader code
|
|
|
|
```
|
|
#include <src/rwcore.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#ifdef _DEBUG
|
|
void dbgmsg( RwDebugType type, const RwChar *msg )
|
|
{
|
|
OutputDebugStringA( msg );
|
|
OutputDebugStringA( "\n" );
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
int WINAPI WinMain(
|
|
HINSTANCE hInstance,
|
|
HINSTANCE hPrevInstance,
|
|
LPSTR lpCmdLine,
|
|
int nShowCmd
|
|
)
|
|
{
|
|
RwBool initSuccess = RwEngineInit( nullptr, 0, 0 );
|
|
|
|
if ( initSuccess == FALSE )
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
// Register the window class.
|
|
const wchar_t CLASS_NAME[] = L"Sample Window Class";
|
|
|
|
WNDCLASSW wc = { };
|
|
|
|
wc.lpfnWndProc = DefWindowProcW;
|
|
wc.hInstance = hInstance;
|
|
wc.lpszClassName = CLASS_NAME;
|
|
|
|
RegisterClass(&wc);
|
|
|
|
// Create the window.
|
|
|
|
HWND window = CreateWindowW( CLASS_NAME, L"Test Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, nullptr, nullptr, hInstance, nullptr );
|
|
|
|
RwEngineOpenParams params;
|
|
params.displayID = window;
|
|
|
|
RwBool openSuccess = RwEngineOpen( ¶ms );
|
|
|
|
if ( openSuccess == FALSE )
|
|
{
|
|
return -2;
|
|
}
|
|
|
|
#ifdef _DEBUG
|
|
RwDebugSetHandler( dbgmsg );
|
|
#endif //_DEBUG
|
|
|
|
RwBool startSuccess = RwEngineStart();
|
|
|
|
if ( startSuccess == FALSE )
|
|
{
|
|
return -3;
|
|
}
|
|
|
|
RwStream *txdStream = RwStreamOpen( rwSTREAMFILENAME, rwSTREAMREAD, "test_txd.txd" );
|
|
|
|
if ( txdStream != nullptr )
|
|
{
|
|
RwUInt32 len, ver;
|
|
RwBool foundTxd = RwStreamFindChunk( txdStream, rwID_TEXDICTIONARY, &len, &ver );
|
|
|
|
if ( foundTxd == TRUE )
|
|
{
|
|
RwTexDictionary *txd = RwTexDictionaryStreamRead( txdStream );
|
|
|
|
if ( txd != nullptr )
|
|
{
|
|
#ifdef _DEBUG
|
|
OutputDebugStringW( L"loaded txd.\n" );
|
|
#endif //_DEBUG
|
|
|
|
RwTexDictionaryDestroy( txd );
|
|
}
|
|
}
|
|
|
|
RwStreamClose( txdStream, nullptr );
|
|
}
|
|
|
|
RwEngineStop();
|
|
|
|
RwEngineClose();
|
|
|
|
return 0;
|
|
}
|
|
``` |