Initial commit: ROW Client source code

Game client codebase including:
- CharacterActionControl: Character and creature management
- GlobalScript: Network, items, skills, quests, utilities
- RYLClient: Main client application with GUI and event handlers
- Engine: 3D rendering engine (RYLGL)
- MemoryManager: Custom memory allocation
- Library: Third-party dependencies (DirectX, boost, etc.)
- Tools: Development utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,978 @@
//-----------------------------------------------------------------------------
// File: Moire.cpp
//
// Desc: Fun screen saver
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#include <windows.h>
#include <d3d8.h>
#include <d3dx8.h>
#include <stdio.h>
#include <commdlg.h>
#include <commctrl.h>
#include "d3dsaver.h"
#include "d3dfont.h"
#include "Moire.h"
#include "Resource.h"
#include "dxutil.h"
//-----------------------------------------------------------------------------
// Name: struct MYVERTEX
// Desc: D3D vertex type for this app
//-----------------------------------------------------------------------------
struct MYVERTEX
{
D3DXVECTOR3 p; // Position
FLOAT tu; // Vertex texture coordinates
FLOAT tv;
MYVERTEX(D3DXVECTOR3 pInit, FLOAT tuInit, FLOAT tvInit)
{ p = pInit; tu = tuInit; tv = tvInit; }
};
#define D3DFVF_MYVERTEX (D3DFVF_XYZ | D3DFVF_TEX1)
CMoireScreensaver* g_pMyMoireScreensaver = NULL;
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Entry point to the program. Initializes everything, and goes into a
// message-processing loop. Idle time is used to render the scene.
//-----------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
HRESULT hr;
CMoireScreensaver moireSS;
if( FAILED( hr = moireSS.Create( hInst ) ) )
{
moireSS.DisplayErrorMsg( hr );
return 0;
}
return moireSS.Run();
}
//-----------------------------------------------------------------------------
// Name: CMoireScreensaver()
// Desc: Constructor
//-----------------------------------------------------------------------------
CMoireScreensaver::CMoireScreensaver( )
{
g_pMyMoireScreensaver = this;
InitCommonControls();
ZeroMemory( m_DeviceObjectsArray, sizeof(m_DeviceObjectsArray) );
srand(0);
lstrcpy( m_strRegPath, TEXT("Software\\Microsoft\\Screensavers\\Moire") );
LoadString( NULL, IDS_DESCRIPTION, m_strWindowTitle, 200 );
m_dwMeshInterval = 30;
m_iMesh = -1;
Randomize( &m_iMesh, 3 );
m_iMeshPrev = -1;
m_fTimeNextMeshChange = 0.0f;
m_fTimeStartMeshChange = 0.0f;
m_dwTextureInterval = 90;
m_iTexture = -1;
Randomize( &m_iTexture, 4 );
m_iTexturePrev = -1;
m_fTimeNextTextureChange = 0.0f;
m_fTimeStartTextureChange = 0.0f;
m_dwColorInterval = 60;
m_iColorScheme = -1;
Randomize( &m_iColorScheme, 4 );
m_iColorSchemePrev = -1;
m_fTimeNextColorChange = 0.0f;
m_fTimeStartColorChange = 0.0f;
m_bBrightColors = TRUE;
m_fSpeed = 1.0f;
}
//-----------------------------------------------------------------------------
// Name: Randomize()
// Desc: Find a random number between 0 and iMax that is different from the
// initial value of *piNum, and store it in *piNum.
//-----------------------------------------------------------------------------
VOID CMoireScreensaver::Randomize( INT* piNum, INT iMax )
{
INT iInit = *piNum;
while ( *piNum == iInit )
{
*piNum = rand() % iMax;
}
}
//-----------------------------------------------------------------------------
// Name: SetDevice()
// Desc:
//-----------------------------------------------------------------------------
VOID CMoireScreensaver::SetDevice( UINT iDevice )
{
m_pDeviceObjects = &m_DeviceObjectsArray[iDevice];
}
//-----------------------------------------------------------------------------
// Name: BuildMeshes()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::BuildMeshes()
{
SAFE_RELEASE( m_pDeviceObjects->m_pVBArray[0] );
SAFE_RELEASE( m_pDeviceObjects->m_pVBArray[1] );
SAFE_RELEASE( m_pDeviceObjects->m_pVBArray[2] );
// Sandwich
{
m_dwNumVerticesArray[0] = 12;
if( FAILED( m_pd3dDevice->CreateVertexBuffer( m_dwNumVerticesArray[0] * sizeof(MYVERTEX),
D3DUSAGE_WRITEONLY, D3DFVF_MYVERTEX, D3DPOOL_MANAGED, &m_pDeviceObjects->m_pVBArray[0] ) ) )
{
return E_FAIL;
}
MYVERTEX* v;
m_pDeviceObjects->m_pVBArray[0]->Lock( 0, 0, (BYTE**)&v, 0 );
v[0] = MYVERTEX( D3DXVECTOR3( 10, -0.1f, -10 ), 0.0f, 0.0f );
v[1] = MYVERTEX( D3DXVECTOR3( -10, -0.1f, -10 ), 10.0f, 0.0f );
v[2] = MYVERTEX( D3DXVECTOR3( 10, 0.0f, 10 ), 0.0f, 10.0f );
v[3] = MYVERTEX( D3DXVECTOR3( -10, -0.1f, -10 ), 10.0f, 0.0f );
v[4] = MYVERTEX( D3DXVECTOR3( -10, 0.0f, 10 ), 10.0f, 10.0f );
v[5] = MYVERTEX( D3DXVECTOR3( 10, 0.0f, 10 ), 0.0f, 10.0f );
v[6] = MYVERTEX( D3DXVECTOR3( -10, 0.0f, 10 ), 0.0f, 10.0f );
v[7] = MYVERTEX( D3DXVECTOR3( -10, 0.1f, -10 ), 0.0f, 0.0f );
v[8] = MYVERTEX( D3DXVECTOR3( 10, 0.1f, -10 ), 10.0f, 0.0f );
v[9] = MYVERTEX( D3DXVECTOR3( 10, 0.1f, -10 ), 10.0f, 0.0f );
v[10] = MYVERTEX( D3DXVECTOR3( 10, 0.0f, 10 ), 10.0f, 10.0f );
v[11] = MYVERTEX( D3DXVECTOR3(-10, 0.0f, 10 ), 0.0f, 10.0f );
m_pDeviceObjects->m_pVBArray[0]->Unlock();
}
// Wall
{
m_dwNumVerticesArray[1] = 6;
if( FAILED( m_pd3dDevice->CreateVertexBuffer( m_dwNumVerticesArray[1] * sizeof(MYVERTEX),
D3DUSAGE_WRITEONLY, D3DFVF_MYVERTEX, D3DPOOL_MANAGED, &m_pDeviceObjects->m_pVBArray[1] ) ) )
{
return E_FAIL;
}
MYVERTEX* v;
m_pDeviceObjects->m_pVBArray[1]->Lock( 0, 0, (BYTE**)&v, 0 );
v[0] = MYVERTEX( D3DXVECTOR3( 20, -20, 0.0f ), 10.0f, 10.0f );
v[1] = MYVERTEX( D3DXVECTOR3( -20, -20, 0.0f ), 0.0f, 10.0f );
v[2] = MYVERTEX( D3DXVECTOR3( 20, 20, 0.0f ), 10.0f, 0.0f );
v[3] = MYVERTEX( D3DXVECTOR3( -20, -20, 0.0f ), 0.0f, 10.0f );
v[4] = MYVERTEX( D3DXVECTOR3( -20, 20, 0.0f ), 0.0f, 0.0f );
v[5] = MYVERTEX( D3DXVECTOR3( 20, 20, 0.0f ), 10.0f, 0.0f );
m_pDeviceObjects->m_pVBArray[1]->Unlock();
}
// Well
{
const INT NUM_SEGS = 48;
m_dwNumVerticesArray[2] = NUM_SEGS * 3;
if( FAILED( m_pd3dDevice->CreateVertexBuffer( m_dwNumVerticesArray[2] * sizeof(MYVERTEX),
D3DUSAGE_WRITEONLY, D3DFVF_MYVERTEX, D3DPOOL_MANAGED, &m_pDeviceObjects->m_pVBArray[2] ) ) )
{
return E_FAIL;
}
MYVERTEX* v;
m_pDeviceObjects->m_pVBArray[2]->Lock( 0, 0, (BYTE**)&v, 0 );
INT iVertex = 0;
FLOAT fTheta;
FLOAT fTheta2;
for( INT i = 0; i < NUM_SEGS; i++ )
{
fTheta = (i+0) * (2 * D3DX_PI / NUM_SEGS);
fTheta2 = (i+1) * (2 * D3DX_PI / NUM_SEGS);
v[iVertex + 0] = MYVERTEX( D3DXVECTOR3( 10*cosf(fTheta), 10*sinf(fTheta), -10.0f ), 5*cosf(fTheta), 5*sinf(fTheta) );
v[iVertex + 1] = MYVERTEX( D3DXVECTOR3( 0, 0, 100.0f ), 0.0f, 0.0f );
v[iVertex + 2] = MYVERTEX( D3DXVECTOR3( 10*cosf(fTheta2), 10*sinf(fTheta2), -10.0f ), 5*cosf(fTheta2), 5*sinf(fTheta2) );
iVertex += 3;
}
m_pDeviceObjects->m_pVBArray[2]->Unlock();
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: BuildTextures()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::BuildTextures()
{
HRESULT hr;
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[0] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[1] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[2] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[3] );
if( FAILED( hr = LoadDDSTextureFromResource( m_pd3dDevice,
MAKEINTRESOURCE(IDR_STRIPES_DDS), &m_pDeviceObjects->m_pTexArray[0] ) ) )
{
return hr;
}
if( FAILED( hr = LoadDDSTextureFromResource( m_pd3dDevice,
MAKEINTRESOURCE(IDR_BALL_DDS), &m_pDeviceObjects->m_pTexArray[1] ) ) )
{
return hr;
}
if( FAILED( hr = LoadDDSTextureFromResource( m_pd3dDevice,
MAKEINTRESOURCE(IDR_NOISE_DDS), &m_pDeviceObjects->m_pTexArray[2] ) ) )
{
return hr;
}
if( FAILED( hr = LoadDDSTextureFromResource( m_pd3dDevice,
MAKEINTRESOURCE(IDR_SPIRAL_DDS), &m_pDeviceObjects->m_pTexArray[3] ) ) )
{
return hr;
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: LoadDDSTextureFromResource()
// Desc: Note that this function asks D3DX to not create a full mip chain
// for the texture. Modify the NumMips parameter to the
// D3DXCreateTextureFromFileInMemoryEx call if you want to reuse this
// function elsewhere and you do want a full mip chain for the texture.
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::LoadDDSTextureFromResource( LPDIRECT3DDEVICE8 pd3dDevice,
TCHAR* strRes, LPDIRECT3DTEXTURE8* ppTex )
{
HRESULT hr;
HMODULE hModule = NULL;
HRSRC rsrc;
HGLOBAL hgData;
LPVOID pvData;
DWORD cbData;
rsrc = FindResource( hModule, strRes, "DDS" );
if( rsrc != NULL )
{
cbData = SizeofResource( hModule, rsrc );
if( cbData > 0 )
{
hgData = LoadResource( hModule, rsrc );
if( hgData != NULL )
{
pvData = LockResource( hgData );
if( pvData != NULL )
{
if( FAILED( hr = D3DXCreateTextureFromFileInMemoryEx(
m_pd3dDevice, pvData, cbData, D3DX_DEFAULT, D3DX_DEFAULT,
1, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_NONE,
D3DX_FILTER_NONE, 0, NULL, NULL, ppTex ) ) )
{
return hr;
}
}
}
}
}
if( *ppTex == NULL)
return E_FAIL;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: FrameMove()
// Desc: Called once per frame, the call is the entry point for animating
// the scene.
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::FrameMove()
{
D3DXCOLOR colBlack( 0, 0, 0, 0 );
m_fScale1 = 2.0f * (1 + sinf(m_fTime * m_fSpeed / 20.0f));
m_fRot1 = 0.0f;
m_fScale2 = 2.0f * (1 + sinf(m_fTime * m_fSpeed / 8.0f));
m_fRot2 = m_fTime * m_fSpeed * 0.025f;
if( m_fTimeNextColorChange == 0.0f )
{
// Schedule next color scheme change
m_fTimeNextColorChange = m_fTime + m_dwColorInterval;
}
else if( m_fTimeNextColorChange < m_fTime )
{
// Start color scheme change
m_iColorSchemePrev = m_iColorScheme;
Randomize( &m_iColorScheme, 4 );
m_fTimeStartColorChange = m_fTime;
m_fTimeNextColorChange = 0.0f;
}
if( m_fTimeStartColorChange != 0.0f )
{
// Continue color scheme change
if( m_fTime > (m_fTimeStartColorChange + 1.0f) )
{
// Conclude color scheme change
m_fTimeStartColorChange = 0.0f;
m_iColorSchemePrev = -1;
}
else
{
// For first second after color change, do linear
// transition from old to new color scheme
FLOAT fBeta = m_fTime - m_fTimeStartColorChange; // varies 0.0 to 1.0
D3DXCOLOR colOld1, colOld2, colOld3; // colors using old scheme
D3DXCOLOR colNew1, colNew2, colNew3; // colors using new scheme
GenerateColors( m_iColorSchemePrev, m_bBrightColors, &colOld1, &colOld2, &colOld3 );
GenerateColors( m_iColorScheme, m_bBrightColors, &colNew1, &colNew2, &colNew3 );
D3DXColorLerp( &m_col1, &colOld1, &colNew1, fBeta );
D3DXColorLerp( &m_col2, &colOld2, &colNew2, fBeta );
D3DXColorLerp( &m_col3, &colOld3, &colNew3, fBeta );
}
}
else
{
// No color scheme change is active, so compute colors as usual
GenerateColors( m_iColorScheme, m_bBrightColors, &m_col1, &m_col2, &m_col3 );
}
if( m_fTimeNextTextureChange == 0.0f )
{
// Schedule next texture change
m_fTimeNextTextureChange = m_fTime + m_dwTextureInterval;
}
else if( m_fTimeNextTextureChange < m_fTime )
{
// Start texture change
m_iTexturePrev = m_iTexture;
m_fTimeStartTextureChange = m_fTime;
m_fTimeNextTextureChange = 0.0f;
}
if( m_fTimeStartTextureChange != 0.0f )
{
// Continue texture change
FLOAT fDelta = m_fTime - m_fTimeStartTextureChange; // varies 0.0 to 1.0
// After 1 second, change textures if you haven't already
if( fDelta > 1.0f && m_iTexture == m_iTexturePrev)
{
Randomize( &m_iTexture, 4 );
}
if( fDelta < 1.0f )
{
// For first second after change starts, fade colors from normal to black
D3DXColorLerp( &m_col1, &m_col1, &colBlack, fDelta );
D3DXColorLerp( &m_col2, &m_col2, &colBlack, fDelta );
D3DXColorLerp( &m_col3, &m_col3, &colBlack, fDelta );
}
else if( fDelta < 2.0f )
{
// For second second after change starts, just show black
m_col1 = colBlack;
m_col2 = colBlack;
m_col3 = colBlack;
}
else if( fDelta < 3.0f )
{
// For third second after change starts, fade colors from black to normal
D3DXColorLerp( &m_col1, &colBlack, &m_col1, fDelta - 2.0f );
D3DXColorLerp( &m_col2, &colBlack, &m_col2, fDelta - 2.0f );
D3DXColorLerp( &m_col3, &colBlack, &m_col3, fDelta - 2.0f );
}
else
{
// transition done
m_fTimeStartTextureChange = 0.0f;
m_iTexturePrev = -1;
}
}
if( m_fTimeNextMeshChange == 0.0f )
{
// Schedule next mesh change
m_fTimeNextMeshChange = m_fTime + m_dwMeshInterval;
}
else if( m_fTimeNextMeshChange < m_fTime )
{
// Start mesh change
m_iMeshPrev = m_iMesh;
m_fTimeStartMeshChange = m_fTime;
m_fTimeNextMeshChange = 0.0f;
}
if( m_fTimeStartMeshChange != 0.0f )
{
// Continue mesh change
FLOAT fDelta = m_fTime - m_fTimeStartMeshChange;
// After 1 second, change meshes if you haven't already
if( fDelta > 1.0f && m_iMesh == m_iMeshPrev)
{
Randomize( &m_iMesh, 3 );
}
if( fDelta < 1.0f )
{
// For first second after change starts, fade colors from normal to black
D3DXColorLerp( &m_col1, &m_col1, &colBlack, fDelta );
D3DXColorLerp( &m_col2, &m_col2, &colBlack, fDelta );
D3DXColorLerp( &m_col3, &m_col3, &colBlack, fDelta );
}
else if( fDelta < 2.0f )
{
// For second second after change starts, just show black
m_col1 = colBlack;
m_col2 = colBlack;
m_col3 = colBlack;
}
else if( fDelta < 3.0f )
{
// For third second after change starts, fade colors from black to normal
D3DXColorLerp( &m_col1, &colBlack, &m_col1, fDelta - 2.0f );
D3DXColorLerp( &m_col2, &colBlack, &m_col2, fDelta - 2.0f );
D3DXColorLerp( &m_col3, &colBlack, &m_col3, fDelta - 2.0f );
}
else
{
// transition done
m_fTimeStartMeshChange = 0.0f;
m_iMeshPrev = -1;
}
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: GenerateColors()
// Desc:
//-----------------------------------------------------------------------------
VOID CMoireScreensaver::GenerateColors( INT iColorScheme, BOOL bBright,
D3DXCOLOR* pcol1, D3DXCOLOR* pcol2, D3DXCOLOR* pcol3 )
{
FLOAT fWave1;
FLOAT fWave2;
FLOAT fConstant;
if( bBright )
{
fWave1 = 1.0f * (1.0f + sinf(m_fTime))/2;
fWave2 = 0.5f * (1.0f + cosf(m_fTime))/2;
fConstant = 0.5f;
}
else
{
fWave1 = 0.50f + 0.50f * (1.0f + sinf(m_fTime))/2;
fWave2 = 0.25f + 0.25f * (1.0f + cosf(m_fTime))/2;
fConstant = 0.375f;
}
switch( iColorScheme )
{
case 0:
*pcol1 = D3DXCOLOR( fWave1, fWave2, 0.0f, 1.0f );
*pcol2 = D3DXCOLOR( fWave2, fWave1, 0.0f, 1.0f );
*pcol3 = D3DXCOLOR( 0.0f, 0.0f, fConstant, 1.0f );
break;
case 1:
*pcol1 = D3DXCOLOR( 0.0f, fWave1, fWave2, 1.0f );
*pcol2 = D3DXCOLOR( 0.0f, fWave2, fWave1, 1.0f );
*pcol3 = D3DXCOLOR( fConstant, 0.0f, 0.0f, 1.0f );
break;
case 2:
*pcol1 = D3DXCOLOR( fWave1, 0.0f, fWave2, 1.0f );
*pcol2 = D3DXCOLOR( fWave2, 0.0f, fWave1, 1.0f );
*pcol3 = D3DXCOLOR( 0.0f, fConstant, 0.0f, 1.0f );
break;
case 3:
*pcol1 = D3DXCOLOR( fWave1, fWave1, fWave1, 1.0f );
*pcol2 = D3DXCOLOR( fWave2, fWave2, fWave2, 1.0f );
*pcol3 = D3DXCOLOR( 0.0f, 0.0f, 0.0f, 1.0f );
break;
}
}
//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Called once per frame, the call is the entry point for 3d
// rendering. This function sets up render states, clears the
// viewport, and renders the scene.
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::Render()
{
D3DXMATRIX mat1;
D3DXMATRIX mat2;
D3DXMATRIX mat3;
SetProjectionMatrix( 0.05f, 120.0f );
m_pd3dDevice->SetTexture(0, m_pDeviceObjects->m_pTexArray[m_iTexture] );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
// m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
HRESULT hr;
DWORD dw;
hr = m_pd3dDevice->ValidateDevice(&dw);
m_pd3dDevice->SetVertexShader( D3DFVF_MYVERTEX );
m_pd3dDevice->SetStreamSource( 0, m_pDeviceObjects->m_pVBArray[m_iMesh], sizeof(MYVERTEX) );
// Clear the viewport
m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, m_col3, 1.0f, 0L );
// Begin the scene
if( SUCCEEDED( m_pd3dDevice->BeginScene() ) )
{
D3DXMatrixScaling( &mat1, m_fScale1, m_fScale1, 1.0 );
D3DXMatrixRotationZ( &mat2, m_fRot1 );
D3DXMatrixMultiply( &mat3, &mat1, &mat2 );
m_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &mat3 );
// m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, m_col1 );
D3DMATERIAL8 mtrl;
mtrl.Diffuse = m_col1;
mtrl.Ambient = m_col1;
mtrl.Specular = m_col1;
mtrl.Emissive = m_col1;
mtrl.Power = 0;
m_pd3dDevice->SetMaterial(&mtrl);
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_dwNumVerticesArray[m_iMesh] / 3 );
D3DXMatrixScaling( &mat1, m_fScale2, m_fScale2, 1.0 );
D3DXMatrixRotationZ( &mat2, m_fRot2 );
D3DXMatrixMultiply( &mat3, &mat1, &mat2 );
m_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &mat3 );
// m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, m_col2 );
mtrl.Diffuse = m_col2;
mtrl.Ambient = m_col2;
mtrl.Specular = m_col2;
mtrl.Emissive = m_col2;
mtrl.Power = 0;
m_pd3dDevice->SetMaterial(&mtrl);
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_dwNumVerticesArray[m_iMesh] / 3 );
// Show frame rate
m_pDeviceObjects->m_pStatsFont->DrawText( 3, 1, D3DCOLOR_ARGB(255,0,0,0), m_strFrameStats );
m_pDeviceObjects->m_pStatsFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), m_strFrameStats );
m_pDeviceObjects->m_pStatsFont->DrawText( 3, 21, D3DCOLOR_ARGB(255,0,0,0), m_strDeviceStats );
m_pDeviceObjects->m_pStatsFont->DrawText( 2, 20, D3DCOLOR_ARGB(255,255,255,0), m_strDeviceStats );
// End the scene.
m_pd3dDevice->EndScene();
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: RestoreDeviceObjects()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::RestoreDeviceObjects()
{
if( m_pd3dDevice == NULL )
return S_OK;
// Set up sensible projection and view matrices
D3DXMATRIX view;
D3DXMatrixLookAtLH( &view , &D3DXVECTOR3(0,0,-10) , &D3DXVECTOR3(0,0,0) , &D3DXVECTOR3(0,1,0) );
m_pd3dDevice->SetTransform( D3DTS_VIEW , &view );
// Set some basic renderstates
m_pd3dDevice->SetRenderState( D3DRS_DITHERENABLE , TRUE );
m_pd3dDevice->SetRenderState( D3DRS_SPECULARENABLE , FALSE );
if( FAILED( BuildMeshes() ) )
return E_FAIL;
if( FAILED( BuildTextures() ) )
return E_FAIL;
m_pDeviceObjects->m_pStatsFont = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD );
m_pDeviceObjects->m_pStatsFont->InitDeviceObjects( m_pd3dDevice );
m_pDeviceObjects->m_pStatsFont->RestoreDeviceObjects();
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: InvalidateDeviceObjects()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::InvalidateDeviceObjects()
{
m_pDeviceObjects->m_pStatsFont->InvalidateDeviceObjects();
m_pDeviceObjects->m_pStatsFont->DeleteDeviceObjects();
SAFE_DELETE( m_pDeviceObjects->m_pStatsFont );
SAFE_RELEASE( m_pDeviceObjects->m_pVBArray[0] );
SAFE_RELEASE( m_pDeviceObjects->m_pVBArray[1] );
SAFE_RELEASE( m_pDeviceObjects->m_pVBArray[2] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[0] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[1] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[2] );
SAFE_RELEASE( m_pDeviceObjects->m_pTexArray[3] );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: ReadSettings()
// Desc:
//-----------------------------------------------------------------------------
VOID CMoireScreensaver::ReadSettings()
{
ReadRegistry();
}
//-----------------------------------------------------------------------------
// Name: ConfigureDialogProcHelper()
// Desc:
//-----------------------------------------------------------------------------
INT_PTR CALLBACK ConfigureDialogProcHelper( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
return g_pMyMoireScreensaver->ConfigureDialogProc( hwndDlg, uMsg, wParam, lParam );
}
//-----------------------------------------------------------------------------
// Name: DoConfig()
// Desc:
//-----------------------------------------------------------------------------
VOID CMoireScreensaver::DoConfig()
{
DialogBox( NULL, MAKEINTRESOURCE(IDD_CONFIGURE), m_hWndParent, ConfigureDialogProcHelper );
}
//-----------------------------------------------------------------------------
// Name: ConfigureDialogProc()
// Desc:
//-----------------------------------------------------------------------------
INT_PTR CALLBACK CMoireScreensaver::ConfigureDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
HWND hwndSpeed = GetDlgItem( hwndDlg, IDC_SPEED );
HWND hwndIntense = GetDlgItem( hwndDlg, IDC_INTENSE );
HWND hwndPastel = GetDlgItem( hwndDlg, IDC_PASTEL );
HWND hwndColorInterval = GetDlgItem( hwndDlg, IDC_COLORINTERVAL );
HWND hwndTextureInterval = GetDlgItem( hwndDlg, IDC_TEXTUREINTERVAL );
HWND hwndMeshInterval = GetDlgItem( hwndDlg, IDC_MESHINTERVAL );
TCHAR sz[10];
DWORD iSpeed;
switch (uMsg)
{
case WM_INITDIALOG:
WriteRegistry();
SendMessage(hwndSpeed, TBM_SETRANGE, FALSE, MAKELONG(0, 5));
if( m_fSpeed == 0.25f )
SendMessage(hwndSpeed, TBM_SETPOS, TRUE, 0);
else if( m_fSpeed == 0.5f )
SendMessage(hwndSpeed, TBM_SETPOS, TRUE, 1);
else if( m_fSpeed == 0.75f )
SendMessage(hwndSpeed, TBM_SETPOS, TRUE, 2);
else if( m_fSpeed == 1.0f )
SendMessage(hwndSpeed, TBM_SETPOS, TRUE, 3);
else if( m_fSpeed == 1.5f )
SendMessage(hwndSpeed, TBM_SETPOS, TRUE, 4);
else if( m_fSpeed == 2.0f )
SendMessage(hwndSpeed, TBM_SETPOS, TRUE, 5);
if( m_bBrightColors )
CheckRadioButton( hwndDlg, IDC_INTENSE, IDC_PASTEL, IDC_INTENSE );
else
CheckRadioButton( hwndDlg, IDC_INTENSE, IDC_PASTEL, IDC_PASTEL );
wsprintf(sz, TEXT("%d"), m_dwColorInterval);
SetWindowText(hwndColorInterval, sz);
wsprintf(sz, TEXT("%d"), m_dwTextureInterval);
SetWindowText(hwndTextureInterval, sz);
wsprintf(sz, TEXT("%d"), m_dwMeshInterval);
SetWindowText(hwndMeshInterval, sz);
return TRUE;
case WM_COMMAND:
switch( LOWORD( wParam ) )
{
case IDC_COLORINTERVAL:
if( HIWORD( wParam ) == EN_CHANGE )
{
m_fTimeNextColorChange = 0.0f;
GetWindowText(hwndColorInterval, sz, 10);
sscanf(sz, TEXT("%d"), &m_dwColorInterval);
}
break;
case IDC_MESHINTERVAL:
if( HIWORD( wParam ) == EN_CHANGE )
{
m_fTimeNextMeshChange = 0.0f;
GetWindowText(hwndMeshInterval, sz, 10);
sscanf(sz, TEXT("%d"), &m_dwMeshInterval);
}
break;
case IDC_TEXTUREINTERVAL:
if( HIWORD( wParam ) == EN_CHANGE )
{
m_fTimeNextTextureChange = 0.0f;
GetWindowText(hwndTextureInterval, sz, 10);
sscanf(sz, TEXT("%d"), &m_dwTextureInterval);
}
break;
case IDC_SCREENSETTINGS:
DoScreenSettingsDialog( hwndDlg );
break;
case IDOK:
m_bBrightColors = ( IsDlgButtonChecked( hwndDlg, IDC_INTENSE ) == BST_CHECKED );
iSpeed = (DWORD)SendMessage( hwndSpeed, TBM_GETPOS, 0, 0 );
if( iSpeed == 0 )
m_fSpeed = 0.25f;
else if( iSpeed == 1 )
m_fSpeed = 0.5f;
else if( iSpeed == 2 )
m_fSpeed = 0.75f;
else if( iSpeed == 3 )
m_fSpeed = 1.0f;
else if( iSpeed == 4 )
m_fSpeed = 1.5f;
else if( iSpeed == 5 )
m_fSpeed = 2.0f;
WriteRegistry(); // save new settings
EndDialog(hwndDlg, IDOK);
break;
case IDCANCEL:
ReadRegistry(); // restore previous settings
EndDialog(hwndDlg, IDCANCEL);
break;
}
return TRUE;
default:
return FALSE;
}
}
//-----------------------------------------------------------------------------
// Name: ReadRegistry()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::ReadRegistry()
{
HKEY hkey;
DWORD dwType = REG_DWORD;
DWORD dwLength = sizeof(DWORD);
if( ERROR_SUCCESS == RegCreateKeyEx( HKEY_CURRENT_USER, m_strRegPath,
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ) )
{
RegQueryValueEx( hkey, TEXT("Bright Colors"), NULL, &dwType, (BYTE*)&m_bBrightColors, &dwLength );
RegQueryValueEx( hkey, TEXT("Mesh"), NULL, &dwType, (BYTE*)&m_iMesh, &dwLength);
if( m_iMesh < 0 )
m_iMesh = 0;
else if( m_iMesh > 2 )
m_iMesh = 2;
RegQueryValueEx( hkey, TEXT("Texture"), NULL, &dwType, (BYTE*)&m_iTexture, &dwLength);
if( m_iTexture < 0 )
m_iTexture = 0;
else if( m_iTexture > 3 )
m_iTexture = 3;
RegQueryValueEx( hkey, TEXT("Color Scheme"), NULL, &dwType, (BYTE*)&m_iColorScheme, &dwLength);
if( m_iColorScheme < 0 )
m_iColorScheme = 0;
else if( m_iColorScheme > 3 )
m_iColorScheme = 3;
DWORD iSpeed;
RegQueryValueEx( hkey, TEXT("Speed"), NULL, &dwType, (BYTE*)&iSpeed, &dwLength);
if( iSpeed > 5 )
iSpeed = 5;
if( iSpeed == 0 )
m_fSpeed = 0.25f;
else if( iSpeed == 1 )
m_fSpeed = 0.5f;
else if( iSpeed == 2 )
m_fSpeed = 0.75f;
else if( iSpeed == 3 )
m_fSpeed = 1.0f;
else if( iSpeed == 4 )
m_fSpeed = 1.5f;
else if( iSpeed == 5 )
m_fSpeed = 2.0f;
RegQueryValueEx( hkey, TEXT("Mesh Interval"), NULL, &dwType, (BYTE*)&m_dwMeshInterval, &dwLength);
if( m_dwMeshInterval > 9999 )
m_dwMeshInterval = 9999;
RegQueryValueEx( hkey, TEXT("Color Interval"), NULL, &dwType, (BYTE*)&m_dwColorInterval, &dwLength);
if( m_dwColorInterval > 9999 )
m_dwColorInterval = 9999;
RegQueryValueEx( hkey, TEXT("Texture Interval"), NULL, &dwType, (BYTE*)&m_dwTextureInterval, &dwLength);
if( m_dwTextureInterval > 9999 )
m_dwTextureInterval = 9999;
ReadScreenSettings( hkey );
RegCloseKey( hkey );
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: WriteRegistry()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMoireScreensaver::WriteRegistry()
{
HKEY hkey;
if( ERROR_SUCCESS == RegCreateKeyEx( HKEY_CURRENT_USER, m_strRegPath,
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ) )
{
RegSetValueEx( hkey, TEXT("Bright Colors"), NULL, REG_DWORD, (BYTE*)&m_bBrightColors, sizeof(DWORD) );
RegSetValueEx( hkey, TEXT("Mesh"), NULL, REG_DWORD, (BYTE*)&m_iMesh, sizeof(DWORD) );
RegSetValueEx( hkey, TEXT("Texture"), NULL, REG_DWORD, (BYTE*)&m_iTexture, sizeof(DWORD));
RegSetValueEx( hkey, TEXT("Color Scheme"), NULL, REG_DWORD, (BYTE*)&m_iColorScheme, sizeof(DWORD));
DWORD iSpeed;
if( m_fSpeed == 0.25f )
iSpeed = 0;
else if( m_fSpeed == 0.5f )
iSpeed = 1;
else if( m_fSpeed == 0.75f )
iSpeed = 2;
else if( m_fSpeed == 1.0f )
iSpeed = 3;
else if( m_fSpeed == 1.5f )
iSpeed = 4;
else if( m_fSpeed == 2.0f )
iSpeed = 5;
RegSetValueEx( hkey, TEXT("Speed"), NULL, REG_DWORD, (BYTE*)&iSpeed, sizeof(DWORD));
RegSetValueEx( hkey, TEXT("Mesh Interval"), NULL, REG_DWORD, (BYTE*)&m_dwMeshInterval, sizeof(DWORD));
RegSetValueEx( hkey, TEXT("Color Interval"), NULL, REG_DWORD, (BYTE*)&m_dwColorInterval, sizeof(DWORD));
RegSetValueEx( hkey, TEXT("Texture Interval"), NULL, REG_DWORD, (BYTE*)&m_dwTextureInterval, sizeof(DWORD));
WriteScreenSettings( hkey );
RegCloseKey( hkey );
}
return S_OK;
}

View File

@@ -0,0 +1,165 @@
# Microsoft Developer Studio Project File - Name="Moire" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Moire - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Moire.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Moire.mak" CFG="Moire - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Moire - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Moire - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Moire - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 d3d8.lib d3dx8.lib winmm.lib kernel32.lib comctl32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/Moire.scr" /stack:0x200000,0x200000
!ELSEIF "$(CFG)" == "Moire - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\Common" /I "..\swrast" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 dxguid.lib d3d8.lib d3dx8.lib winmm.lib kernel32.lib comctl32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 /out:"Debug/Moire.scr" /pdbtype:sept /libpath:"..\swrast" /stack:0x200000,0x200000
!ENDIF
# Begin Target
# Name "Moire - Win32 Release"
# Name "Moire - Win32 Debug"
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\app.ico
# End Source File
# Begin Source File
SOURCE=.\ball.dds
# End Source File
# Begin Source File
SOURCE=.\Moire.rc
# End Source File
# Begin Source File
SOURCE=.\noise.dds
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\spiral.dds
# End Source File
# Begin Source File
SOURCE=.\stripes.dds
# End Source File
# End Group
# Begin Group "Common"
# PROP Default_Filter "*.cpp,*.h"
# Begin Source File
SOURCE=..\..\..\common\src\d3dfont.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\d3dfont.h
# End Source File
# Begin Source File
SOURCE=..\..\..\common\src\d3dsaver.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\d3dsaver.h
# End Source File
# Begin Source File
SOURCE=..\..\..\common\src\dxutil.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\dxutil.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\Moire.cpp
# End Source File
# Begin Source File
SOURCE=.\Moire.h
# End Source File
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Moire"=.\Moire.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,86 @@
//-----------------------------------------------------------------------------
// File: Moire.h
//
// Desc:
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef _MOIRE_H
#define _MOIRE_H
#define MAX_DEVICE_OBJECTS 10
struct DeviceObjects
{
CD3DFont* m_pStatsFont;
LPDIRECT3DVERTEXBUFFER8 m_pVBArray[3];
LPDIRECT3DTEXTURE8 m_pTexArray[4];
};
class CMoireScreensaver : public CD3DScreensaver
{
protected:
DeviceObjects m_DeviceObjectsArray[MAX_DEVICE_OBJECTS];
DeviceObjects* m_pDeviceObjects;
DWORD m_dwNumVerticesArray[3];
DWORD m_dwMeshInterval;
INT m_iMesh;
INT m_iMeshPrev;
FLOAT m_fTimeNextMeshChange;
FLOAT m_fTimeStartMeshChange;
DWORD m_dwTextureInterval;
INT m_iTexture;
INT m_iTexturePrev;
FLOAT m_fTimeNextTextureChange;
FLOAT m_fTimeStartTextureChange;
DWORD m_dwColorInterval;
INT m_iColorScheme;
INT m_iColorSchemePrev;
FLOAT m_fTimeNextColorChange;
FLOAT m_fTimeStartColorChange;
BOOL m_bBrightColors;
FLOAT m_fScale1, m_fScale2;
FLOAT m_fRot1, m_fRot2;
D3DXCOLOR m_col1;
D3DXCOLOR m_col2;
D3DXCOLOR m_col3;
FLOAT m_fSpeed;
protected:
virtual VOID DoConfig();
virtual VOID ReadSettings();
virtual VOID SetDevice( UINT iDevice );
virtual HRESULT Render();
virtual HRESULT FrameMove();
virtual HRESULT RestoreDeviceObjects();
virtual HRESULT InvalidateDeviceObjects();
VOID Randomize( INT* piNum, INT iMax );
HRESULT BuildTextures();
HRESULT BuildMeshes();
HRESULT LoadDDSTextureFromResource( LPDIRECT3DDEVICE8 pd3dDevice,
TCHAR* strRes, LPDIRECT3DTEXTURE8* ppTex );
VOID GenerateColors( INT iColorScheme, BOOL bBright,
D3DXCOLOR* pcol1, D3DXCOLOR* pcol2, D3DXCOLOR* pcol3 );
HRESULT ReadRegistry();
HRESULT WriteRegistry();
public:
CMoireScreensaver();
// Override from CD3DScreensaver
INT_PTR CALLBACK ConfigureDialogProc( HWND hwndDlg, UINT uMsg,
WPARAM wParam, LPARAM lParam );
};
#endif

View File

@@ -0,0 +1,230 @@
# Microsoft Developer Studio Generated NMAKE File, Based on Moire.dsp
!IF "$(CFG)" == ""
CFG=Moire - Win32 Debug
!MESSAGE No configuration specified. Defaulting to Moire - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "Moire - Win32 Release" && "$(CFG)" != "Moire - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Moire.mak" CFG="Moire - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Moire - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Moire - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "Moire - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\Moire.scr"
CLEAN :
-@erase "$(INTDIR)\d3dfont.obj"
-@erase "$(INTDIR)\d3dsaver.obj"
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\Moire.obj"
-@erase "$(INTDIR)\Moire.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\Moire.scr"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Moire.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Moire.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=d3d8.lib d3dx8.lib winmm.lib kernel32.lib comctl32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\Moire.pdb" /machine:I386 /out:"$(OUTDIR)\Moire.scr" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\d3dfont.obj" \
"$(INTDIR)\d3dsaver.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\Moire.obj" \
"$(INTDIR)\Moire.res"
"$(OUTDIR)\Moire.scr" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "Moire - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\Moire.scr"
CLEAN :
-@erase "$(INTDIR)\d3dfont.obj"
-@erase "$(INTDIR)\d3dsaver.obj"
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\Moire.obj"
-@erase "$(INTDIR)\Moire.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\Moire.pdb"
-@erase "$(OUTDIR)\Moire.scr"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\Common" /I "..\swrast" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Moire.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Moire.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dxguid.lib d3d8.lib d3dx8.lib winmm.lib kernel32.lib comctl32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\Moire.pdb" /debug /machine:I386 /out:"$(OUTDIR)\Moire.scr" /pdbtype:sept /libpath:"..\swrast" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\d3dfont.obj" \
"$(INTDIR)\d3dsaver.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\Moire.obj" \
"$(INTDIR)\Moire.res"
"$(OUTDIR)\Moire.scr" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("Moire.dep")
!INCLUDE "Moire.dep"
!ELSE
!MESSAGE Warning: cannot find "Moire.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "Moire - Win32 Release" || "$(CFG)" == "Moire - Win32 Debug"
SOURCE=..\..\..\common\src\d3dfont.cpp
"$(INTDIR)\d3dfont.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\..\common\src\d3dsaver.cpp
"$(INTDIR)\d3dsaver.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\..\common\src\dxutil.cpp
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\Moire.cpp
"$(INTDIR)\Moire.obj" : $(SOURCE) "$(INTDIR)"
SOURCE=.\Moire.rc
"$(INTDIR)\Moire.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
!ENDIF

View File

@@ -0,0 +1,287 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define IDC_STATIC -1
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN_ICON ICON DISCARDABLE "app.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define IDC_STATIC -1\r\n"
"#include <windows.h>\r\n"
"\r\n"
"\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONFIGURE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 182
TOPMARGIN, 7
BOTTOMMARGIN, 227
END
IDD_SINGLEMONITORSETTINGS, DIALOG
BEGIN
LEFTMARGIN, 7
TOPMARGIN, 7
BOTTOMMARGIN, 90
END
IDD_MULTIMONITORSETTINGS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 252
TOPMARGIN, 7
BOTTOMMARGIN, 273
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONFIGURE DIALOG DISCARDABLE 0, 0, 189, 234
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Moire Settings"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK",IDOK,71,214,50,14
PUSHBUTTON "Cancel",IDCANCEL,127,214,50,14
PUSHBUTTON "&Display Settings...",IDC_SCREENSETTINGS,44,18,102,14
GROUPBOX "&Animation Speed",IDC_STATIC,10,47,168,56
CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS |
WS_TABSTOP,21,60,147,22
LTEXT "Slow",IDC_STATIC,23,82,16,8
LTEXT "Fast",IDC_STATIC,152,82,14,8
GROUPBOX "Color Type",IDC_STATIC,10,110,168,29
CONTROL "&Intense",IDC_INTENSE,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,16,123,65,10
CONTROL "&Pastel",IDC_PASTEL,"Button",BS_AUTORADIOBUTTON,91,122,
73,10
GROUPBOX "&Options",IDC_STATIC,10,145,168,62
LTEXT "Change Shape Every",IDC_STATIC,18,157,77,8
EDITTEXT IDC_MESHINTERVAL,102,154,25,14,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "seconds",IDC_STATIC,134,157,28,8
LTEXT "Change Colors Every",IDC_STATIC,18,173,77,8
EDITTEXT IDC_COLORINTERVAL,102,170,25,14,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "seconds",IDC_STATIC,134,173,28,8
LTEXT "Change Texture Every",IDC_STATIC,18,189,77,8
EDITTEXT IDC_TEXTUREINTERVAL,102,186,25,14,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "seconds",IDC_STATIC,134,189,28,8
GROUPBOX "Display Settings",IDC_STATIC,10,4,168,37
END
IDD_SINGLEMONITORSETTINGS DIALOG DISCARDABLE 0, 0, 255, 170
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Display Settings"
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "Video adapter",IDC_STATIC,7,7,241,69
LTEXT "Name:",IDC_STATIC,13,18,33,8
LTEXT "",IDC_ADAPTERNAME,57,18,159,8
LTEXT "Rendering:",IDC_STATIC,13,31,36,8
LTEXT "",IDC_RENDERING,57,31,130,17
PUSHBUTTON "&Help",IDC_MOREINFO,194,33,50,14
CONTROL "&Disable hardware 3D rendering",IDC_DISABLEHW,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,14,54,215,10
GROUPBOX "Display mode",IDC_DISPLAYMODEBOX,7,84,241,55
LTEXT "Display &mode for this video adapter:",IDC_MODESSTATIC,
13,95,126,8
COMBOBOX IDC_MODESCOMBO,144,93,100,133,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Note: The Automatic display mode finds a mode that works well with your current screen saver settings and video adapter.",
IDC_DISPLAYMODENOTE,13,109,227,27
LTEXT "Automatic",IDC_AUTOMATIC,184,126,32,8,NOT WS_VISIBLE
LTEXT "%d by %d, %d bit color",IDC_MODEFMT,13,152,71,8,NOT
WS_VISIBLE
DEFPUSHBUTTON "OK",IDOK,143,148,50,14
PUSHBUTTON "Cancel",IDCANCEL,197,148,50,14
END
IDD_MULTIMONITORSETTINGS DIALOG DISCARDABLE 0, 0, 270, 281
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Display Settings"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Monitor %d",IDC_TABNAMEFMT,214,8,32,8,NOT WS_VISIBLE
GROUPBOX "Video adapter",IDC_STATIC,13,23,244,65
LTEXT "Name:",IDC_STATIC,19,35,40,8
LTEXT "",IDC_ADAPTERNAME,65,35,168,8
LTEXT "Rendering:",IDC_STATIC,19,48,40,8
LTEXT "",IDC_RENDERING,65,48,132,17
PUSHBUTTON "&Help",IDC_MOREINFO,202,49,50,14
CONTROL "&Disable hardware 3D rendering on this monitor",
IDC_DISABLEHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,
71,215,10
GROUPBOX "Monitor usage",IDC_SCREENUSAGEBOX,13,94,244,44
CONTROL "Display &screen saver on this monitor",IDC_RENDER,
"Button",BS_AUTORADIOBUTTON,19,107,200,10
CONTROL "Display &nothing on this monitor",IDC_LEAVEBLACK,"Button",
BS_AUTORADIOBUTTON,19,120,200,10
GROUPBOX "Display mode",IDC_DISPLAYMODEBOX,13,146,244,55
LTEXT "Display &mode for this video adapter:",IDC_MODESSTATIC,
19,158,126,8
COMBOBOX IDC_MODESCOMBO,152,156,100,133,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Note: The Automatic display mode finds a mode that works well with your current screen saver settings and video adapter.",
IDC_DISPLAYMODENOTE,19,173,232,22
LTEXT "Automatic",IDC_AUTOMATIC,193,182,32,8,NOT WS_VISIBLE
LTEXT "%d by %d, %d bit color",IDC_MODEFMT,7,265,71,8,NOT
WS_VISIBLE
DEFPUSHBUTTON "OK",IDOK,159,259,50,14
PUSHBUTTON "Cancel",IDCANCEL,213,259,50,14
GROUPBOX "General Monitor Settings",IDC_GENERALBOX,7,214,256,32
CONTROL "Render same &image on all monitors",IDC_SAME,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,22,227,210,10
CONTROL "Tab1",IDC_MONITORSTAB,"SysTabControl32",WS_TABSTOP,7,7,
256,201
END
/////////////////////////////////////////////////////////////////////////////
//
// DDS
//
IDR_STRIPES_DDS DDS DISCARDABLE "stripes.dds"
IDR_BALL_DDS DDS DISCARDABLE "ball.dds"
IDR_NOISE_DDS DDS DISCARDABLE "noise.dds"
IDR_SPIRAL_DDS DDS DISCARDABLE "spiral.dds"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_DESCRIPTION "Moire Screensaver"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDS_ERR_GENERIC "There was an unspecified problem with this screen saver."
IDS_ERR_NODIRECT3D "Direct3D 8.0 could not be initialized. Please install the latest version of DirectX."
IDS_ERR_NOWINDOWEDHAL "Could not initialize the screen saver."
IDS_ERR_CREATEDEVICEFAILED "Could not create the Direct3D device."
IDS_ERR_NOCOMPATIBLEDEVICES
"Could not find any compatible Direct3D devices."
IDS_ERR_NOHARDWAREDEVICE
"No hardware-accelerated Direct3D devices were found."
IDS_ERR_HALNOTCOMPATIBLE
"This screen saver requires functionality that is not available on your Direct3D hardware accelerator."
IDS_ERR_NOHALTHISMODE "This screen saver requires functionality that is not available on your Direct3D hardware accelerator with the current desktop display settings."
IDS_ERR_MEDIANOTFOUND "Could not load required media."
IDS_ERR_RESIZEFAILED "Could not reset the Direct3D device."
IDS_ERR_OUTOFMEMORY "Not enough memory."
IDS_ERR_OUTOFVIDEOMEMORY "Not enough video memory."
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDS_ERR_NOPREVIEW "No preview available"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_INFO_GOODHAL "This video adapter supports hardware 3D rendering. This screen saver can be displayed on this monitor."
IDS_INFO_BADHAL_GOODSW "This video adapter supports hardware 3D rendering, but this screensaver requires functionality not available in hardware. A software renderer will be used instead. This screen saver can be displayed on this monitor."
IDS_INFO_BADHAL_BADSW "This video adapter supports hardware 3D rendering, but this screensaver requires functionality not available in hardware or software. This screen saver cannot be displayed on this monitor."
IDS_INFO_BADHAL_NOSW "This video adapter supports hardware 3D rendering, but this screensaver requires functionality not available in hardware. No software renderer is available. This screen saver cannot be displayed on this monitor."
IDS_INFO_NOHAL_GOODSW "This video adapter does not support hardware 3D rendering. A software renderer will be used instead. This screen saver can be displayed on this monitor."
IDS_INFO_NOHAL_BADSW "This video adapter does not support hardware 3D rendering. This screensaver requires functionality not available in the software renderer. This screen saver cannot be displayed on this monitor."
IDS_INFO_NOHAL_NOSW "This video adapter does not support hardware 3D rendering. No software renderer is available. This screen saver cannot be displayed on this monitor."
IDS_INFO_DISABLEDHAL_GOODSW
"The video adapter supports hardware 3D rendering, but it has been disabled. A software renderer will be used instead. This screen saver can be displayed on this monitor."
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_INFO_DISABLEDHAL_BADSW
"This video adapter supports hardware 3D rendering, but it has been disabled. This screensaver requires functionality not available in the software renderer. This screen saver cannot be displayed on this monitor."
IDS_INFO_DISABLEDHAL_NOSW
"This video adapter supports hardware 3D rendering, but it has been disabled. No software renderer is available. This screen saver cannot be displayed on this monitor."
IDS_RENDERING_HAL "The screen saver can use hardware 3D rendering on this monitor."
IDS_RENDERING_SW "The screen saver can use software 3D rendering on this monitor."
IDS_RENDERING_NONE "The screen saver cannot be displayed on this monitor."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,91 @@
//-----------------------------------------------------------------------------
// Name: Moire Direct3D Sample
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
Description
===========
The Moire sample shows how to use the DXSDK screensaver framework to write
a screensaver that uses Direct3D. The screensaver framework is very similar
to the sample application framework, using many methods and variables with
the same names. After writing a program with the screensaver framework, one
ends up with a fully-functional Windows screensaver rather than a regular
Windows application.
The Moire screensaver appears as a mesmerizing sequence of spinning lines
and colors. It uses texture transformation and alpha blending to create a
highly animated scene, even though the polygons that make up the scene do
not move at all.
Path
====
Source: DXSDK\Samples\Multimedia\D3D\Screensavers\Moire
Executable: DXSDK\Samples\Multimedia\D3D\Bin
User's Guide
============
Moire.scr can be started in five modes: configuration, preview, full, test,
and password-change. You can choose some modes by right-clicking the
moire.scr file and choosing Configure or Preview. Or you can start moire.scr
from the command line with the following command-line parameters:
-c Configuration mode
-t Test mode
-p Preview mode
-a Password-change mode
-s Full mode
When the screensaver is running in full mode, press any key or move the
mouse to exit.
Programming Notes
=================
Programs that use the screensaver framework are very similar to programs
that use the D3D sample application framework. Each screensaver needs to
create a class derived from the main application class, CD3DScreensaver.
The screensaver implements its own versions of the virtual functions
FrameMove(), Render(), InitDeviceObjects(), etc., that provide
functionality specific to each screensaver.
Screensavers can be written to be multimonitor-compatible, without much
extra effort. If you do not want your screensaver to run on multiple
monitors, you can just set the m_bOneScreenOnly variable to TRUE. But
by default, this value is false, and your program needs to be able to
handle multiple D3D devices. The function SetDevice() will be called each
time the device changes. The way that Moire deals with this is to create
a structure called DeviceObjects which contains all device-specific
pointers and values. CMoireScreensaver holds an array of DeviceObjects
structures, called m_DeviceObjectsArray. When SetDevice() is called,
m_pDeviceObjects is changed to point to the DeviceObjects structure for
the specified device. When rendering, m_rcRenderTotal refers to the
rendering area that spans all monitors, and m_rcRenderCurDevice refers
to the rendering area for the current device's monitor. The function
SetProjectionMatrix shows one way to set up a projection matrix that
makes proper use of these variables to render a scene that optionally
spans all the monitors, or renders a copy of the scene on each monitor,
depending on the value of m_bAllScreensSame (which can be controlled by
the user in the configuration dialog, if you want).
The ReadSettings() function is called by the screensaver framework at
program startup time, to read various screensaver settings from the
registry. DoConfig() is called when the user wants to configure the
screensaver settings. The program should respond to this by creating
a dialog box with controls for the various screensaver settings. This
dialog box should also have a button called "Display Settings" which,
when pressed, should call DoScreenSettingsDialog(). This common dialog
allows the user to configure what renderer and display mode should be
used on each monitor. You should set the member variable m_strRegPath
to a registry path that will hold the screensaver's settings. You can
use this variable in your registry read/write functions. The screensaver
framework will also use this variable to store information about the
default display mode in some cases.
This sample makes use of common DirectX code (consisting of helper functions,
etc.) that is shared with other samples on the DirectX SDK. All common
headers and source code can be found in the following directory:
Dxsdk\Samples\Multimedia\Common

View File

@@ -0,0 +1,75 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Moire.rc
//
#define IDI_MAIN_ICON 101
#define IDR_STRIPES_DDS 102
#define IDR_BALL_DDS 103
#define IDR_NOISE_DDS 104
#define IDR_SPIRAL_DDS 105
#define IDD_CONFIGURE 106
#define IDD_SINGLEMONITORSETTINGS 200
#define IDD_MULTIMONITORSETTINGS 201
#define IDC_INTENSE 1000
#define IDS_DESCRIPTION 1000
#define IDC_PASTEL 1001
#define IDC_SPEED 1002
#define IDC_MESHINTERVAL 1003
#define IDC_COLORINTERVAL 1004
#define IDC_TEXTUREINTERVAL 1005
#define IDC_SCREENSETTINGS 1006
#define IDC_MONITORSTAB 2000
#define IDC_TABNAMEFMT 2001
#define IDC_ADAPTERNAME 2002
#define IDC_RENDERING 2003
#define IDC_MOREINFO 2004
#define IDC_DISABLEHW 2005
#define IDC_SCREENUSAGEBOX 2006
#define IDC_RENDER 2007
#define IDC_LEAVEBLACK 2008
#define IDC_DISPLAYMODEBOX 2009
#define IDC_MODESSTATIC 2010
#define IDC_MODESCOMBO 2011
#define IDC_AUTOMATIC 2012
#define IDC_DISPLAYMODENOTE 2013
#define IDC_GENERALBOX 2014
#define IDC_SAME 2015
#define IDC_MODEFMT 2016
#define IDS_ERR_GENERIC 2100
#define IDS_ERR_NODIRECT3D 2101
#define IDS_ERR_NOWINDOWEDHAL 2102
#define IDS_ERR_CREATEDEVICEFAILED 2103
#define IDS_ERR_NOCOMPATIBLEDEVICES 2104
#define IDS_ERR_NOHARDWAREDEVICE 2105
#define IDS_ERR_HALNOTCOMPATIBLE 2106
#define IDS_ERR_NOHALTHISMODE 2107
#define IDS_ERR_MEDIANOTFOUND 2108
#define IDS_ERR_RESIZEFAILED 2109
#define IDS_ERR_OUTOFMEMORY 2110
#define IDS_ERR_OUTOFVIDEOMEMORY 2111
#define IDS_ERR_NOPREVIEW 2112
#define IDS_INFO_GOODHAL 2200
#define IDS_INFO_BADHAL_GOODSW 2201
#define IDS_INFO_BADHAL_BADSW 2202
#define IDS_INFO_BADHAL_NOSW 2203
#define IDS_INFO_NOHAL_GOODSW 2204
#define IDS_INFO_NOHAL_BADSW 2205
#define IDS_INFO_NOHAL_NOSW 2206
#define IDS_INFO_DISABLEDHAL_GOODSW 2207
#define IDS_INFO_DISABLEDHAL_BADSW 2208
#define IDS_INFO_DISABLEDHAL_NOSW 2209
#define IDS_RENDERING_HAL 2210
#define IDS_RENDERING_SW 2211
#define IDS_RENDERING_NONE 2212
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40000
#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B