LetterHunter::LetterHunter(HWND hwnd, int maxTextCount)
	:hwnd_(hwnd),
	maxTextCount_(100),
	d2d_(NULL),
	dinput_(NULL),
	soundManager_(NULL),
	score_(NULL),
	textBuffer_(NULL),
	currentTextObject_(NULL)
{
	// Initialize Direct2D
	d2d_ = new D2D();
	d2d_->createDeviceIndependentResources();
	d2d_->createDeviceResources(hwnd);

	// Initialize Direct Input
	dinput_ = new DInput();
	soundManager_ = new SoundManager();

	// Initialize score obejct
	score_ = new Score(d2d_->getD2DHwndRenderTarget(), d2d_->getDWriteFactory(), hwnd_);
	score_->setColor(D2D1::ColorF(D2D1::ColorF::Red));

	RECT rect;
	GetWindowRect(hwnd_, &rect);

	int width  = rect.right - rect.left;
	int height = rect.bottom - rect.top;

	setWindowWidth(width);
	setWindowHeight(height);
}
Exemple #2
0
// ---------------------------------------------------------------------------
//  configure
// ---------------------------------------------------------------------------
//! Configure this Analyzer with the given frequency resolution 
//! (minimum instantaneous frequency difference between Partials)
//! and analysis window width (main lobe, zero-to-zero, in Hz). 
//! All other Analyzer parameters are (re-)computed from the 
//! frequency resolution and window width.      
//! 
//! \param resolutionHz is the frequency resolution in Hz.
//! \param windowWidthHz is the main lobe width of the Kaiser
//! analysis window in Hz.
//!     
//! There are three categories of analysis parameters:
//! - the resolution, and params that are usually related to (or
//! identical to) the resolution (frequency floor and drift)
//! - the window width and params that are usually related to (or
//! identical to) the window width (hop and crop times)
//! - independent parameters (bw region width and amp floor)
//
void
Analyzer::configure( double resolutionHz, double windowWidthHz )
{
    //  use specified resolution:
    setFreqResolution( resolutionHz );
    
    //  floor defaults to -90 dB:
    setAmpFloor( -90. );
    
    //  window width should generally be approximately 
    //  equal to, and never more than twice the 
    //  frequency resolution:
    setWindowWidth( windowWidthHz );
    
    //  the Kaiser window sidelobe level can be the same
    //  as the amplitude floor (except in positive dB):
    setSidelobeLevel( - m_ampFloor );
    
    //  for the minimum frequency, below which no data is kept,
    //  use the frequency resolution by default (this makes 
    //  Lip happy, and is always safe?) and allow the client 
    //  to change it to anything at all.
    setFreqFloor( resolutionHz );
    
    //  frequency drift in Hz is the maximum difference
    //  in frequency between consecutive Breakpoints in
    //  a Partial, by default, make it equal to one half
    //  the frequency resolution:
    setFreqDrift( .5 * resolutionHz );
    
    //  hop time (in seconds) is the inverse of the
    //  window width....really. Smith and Serra (1990) cite 
    //  Allen (1977) saying: a good choice of hop is the window 
    //  length divided by the main lobe width in frequency samples,
    //  which turns out to be just the inverse of the width.
    setHopTime( 1. / m_windowWidth );
    
    //  crop time (in seconds) is the maximum allowable time
    //  correction, beyond which a reassigned spectral component
    //  is considered unreliable, and not considered eligible for
    //  Breakpoint formation in extractPeaks(). By default, use
    //  the hop time (should it be half that?):
    setCropTime( m_hopTime );
    
    //  bandwidth association region width 
    //  defaults to 2 kHz, corresponding to 
    //  1 kHz region center spacing:
    storeResidueBandwidth();

	//  configure the envelope builders using default 
	//  parameters:
	buildFundamentalEnv( 0.99 * resolutionHz,
                         1.5 * resolutionHz );
    m_ampEnvBuilder.reset( new AmpEnvBuilder );
    
    //  enable phase-correct Partial construction:
    m_phaseCorrect = true;
}
 SRGBTextureTest()
 {
     setWindowWidth(128);
     setWindowHeight(128);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
 PointSpritesTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
 {
     setWindowWidth(windowWidth);
     setWindowHeight(windowHeight);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
 MaxTextureSizeTest()
 {
     setWindowWidth(512);
     setWindowHeight(512);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
 UniformTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
 {
     setWindowWidth(128);
     setWindowHeight(128);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
Exemple #7
0
 CopyTexImageTest()
 {
     setWindowWidth(16);
     setWindowHeight(16);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
void LetterHunter::resize(int width, int height)
{
	// resize d2d render target
	d2d_->onResize(width, height);

	// Update window size
	setWindowWidth(width); 
	setWindowHeight(height);
}
 CopyTextureTest()
 {
     setWindowWidth(256);
     setWindowHeight(256);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
 CompressedTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
 {
     setWindowWidth(512);
     setWindowHeight(512);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
Exemple #11
0
    void VolumeModel::init(const ModelInfo::Params & params) {
        AbstractModelWithPoints::init(params);

        VolumeInfo::PhysicalSize physicalSize = params["physicalSize"].value<VolumeInfo::PhysicalSize>();
        VolumeInfo::Size size = params["size"].value<VolumeInfo::Size>();
        VolumeInfo::Scaling scaling = params["scaling"].value<VolumeInfo::Scaling>();

        scale(scaling);

        setSlope(params["slope"].value<VolumeInfo::Slope>());
        setIntercept(params["intercept"].value<VolumeInfo::Intercept>());

        setWindowCenter(params["windowCenter"].value<VolumeInfo::WindowCenter>());
        setWindowWidth(params["windowWidth"].value<VolumeInfo::WindowWidth>());

        setHuRange(params["huRange"].value<VolumeInfo::HuRange>());
        setValueRange(params["valueRange"].value<VolumeInfo::ValueRange>());

        ModelInfo::VerticesVTPtr vertices = new ModelInfo::VerticesVT;
        ModelInfo::IndicesPtr indices = new ModelInfo::Indices;

        GLfloat scalingFactor = (GLfloat) scene()->scalingFactor();

        GLfloat zCurrent = - physicalSize.z() * scaling.z() / scalingFactor / 2.0f;
        
        GLfloat step = - (zCurrent * 2.0f) / size.z();
        GLfloat stepTexture = 1.0f / size.z();

        GLfloat zCurrentTexture = 0.0f;

        GLfloat w = physicalSize.x() / 2.0f * scaling.x() / scalingFactor;
        GLfloat h = physicalSize.y() / 2.0f * scaling.y() / scalingFactor;

        for (int i = 0; i != (int) size.z(); ++ i) {
            vertices->push_back(ModelInfo::VertexVT(- w, - h, zCurrent, 0.0f, 1.0f, zCurrentTexture));
            vertices->push_back(ModelInfo::VertexVT(- w, h, zCurrent, 0.0f, 0.0f, zCurrentTexture));
            vertices->push_back(ModelInfo::VertexVT(w, h, zCurrent, 1.0f, 0.0f, zCurrentTexture));
            vertices->push_back(ModelInfo::VertexVT(w, - h, zCurrent, 1.0f, 1.0f, zCurrentTexture));

            indices->push_back(4 * i);
            indices->push_back(4 * i + 2);
            indices->push_back(4 * i + 1);
            indices->push_back(4 * i);
            indices->push_back(4 * i + 3);
            indices->push_back(4 * i + 2);

            zCurrent += step;
            zCurrentTexture += stepTexture;
        };

        ModelInfo::BuffersVT buffers;

        buffers.vertices = ModelInfo::VerticesVTPointer(vertices);
        buffers.indices = ModelInfo::IndicesPointer(indices);
        
        fillBuffers<ModelInfo::BuffersVT>(buffers);
    }
Exemple #12
0
 IndexedPointsTest() : ANGLETest(2, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
 {
     setWindowWidth(128);
     setWindowHeight(128);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
     setConfigDepthBits(24);
 }
Exemple #13
0
 ReadPixelsTest()
 {
     setClientVersion(3);
     setWindowWidth(32);
     setWindowHeight(32);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
 WebGLReadOutsideFramebufferTest() : mFBData(kFbWidth, kFbHeight)
 {
     setWindowWidth(kFbWidth);
     setWindowHeight(kFbHeight);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
     setWebGLCompatibilityEnabled(true);
 }
 PBOExtensionTest()
 {
     setClientVersion(2);
     setWindowWidth(32);
     setWindowHeight(32);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
 }
 IndexedPointsTest()
 {
     setWindowWidth(128);
     setWindowHeight(128);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
     setConfigDepthBits(24);
 }
 DepthStencilFormatsTest()
 {
     setWindowWidth(128);
     setWindowHeight(128);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
     setClientVersion(2);
 }
 D3DTextureTest()
 {
     setWindowWidth(128);
     setWindowHeight(128);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
     setConfigDepthBits(24);
     setConfigStencilBits(8);
 }
    UnpackAlignmentTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
    {
        setWindowWidth(128);
        setWindowHeight(128);
        setConfigRedBits(8);
        setConfigGreenBits(8);
        setConfigBlueBits(8);
        setConfigAlphaBits(8);
        setConfigDepthBits(24);

        mProgram = 0;
    }
 BufferDataTest()
     : mBuffer(0),
       mProgram(0),
       mAttribLocation(-1)
 {
     setWindowWidth(16);
     setWindowHeight(16);
     setConfigRedBits(8);
     setConfigGreenBits(8);
     setConfigBlueBits(8);
     setConfigAlphaBits(8);
     setConfigDepthBits(24);
 }
    BlendMinMaxTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
    {
        setWindowWidth(128);
        setWindowHeight(128);
        setConfigRedBits(8);
        setConfigGreenBits(8);
        setConfigBlueBits(8);
        setConfigAlphaBits(8);
        setConfigDepthBits(24);

        mProgram = 0;
        mColorLocation = -1;
    }
    BlendMinMaxTest()
    {
        setWindowWidth(128);
        setWindowHeight(128);
        setConfigRedBits(8);
        setConfigGreenBits(8);
        setConfigBlueBits(8);
        setConfigAlphaBits(8);
        setConfigDepthBits(24);

        mProgram = 0;
        mColorLocation = -1;
    }
    VertexAttributeTest()
    {
        setWindowWidth(128);
        setWindowHeight(128);
        setConfigRedBits(8);
        setConfigGreenBits(8);
        setConfigBlueBits(8);
        setConfigAlphaBits(8);
        setConfigDepthBits(24);

        mProgram = 0;
        mTestAttrib = -1;
        mExpectedAttrib = -1;
    }
Exemple #24
0
    void VolumeModel::invoke(const QString & name, const ModelInfo::Params & params) {
        if (name == "setHuRange") {
            setHuRange(params["range"].value<VolumeInfo::HuRange>());
            return;
        }

        if (name == "setWindowCenter") {
            setWindowCenter(params["windowCenter"].value<VolumeInfo::WindowCenter>());
            return;
        }

        if (name == "setWindowWidth") {
            setWindowWidth(params["windowWidth"].value<VolumeInfo::WindowWidth>());
            return;
        }

        AbstractModelWithPoints::invoke(name, params);
    }
Exemple #25
0
    SwizzleTest()
    {
        setWindowWidth(128);
        setWindowHeight(128);
        setConfigRedBits(8);
        setConfigGreenBits(8);
        setConfigBlueBits(8);
        setConfigAlphaBits(8);
        setClientVersion(3);

        GLenum swizzles[] =
        {
            GL_RED,
            GL_GREEN,
            GL_BLUE,
            GL_ALPHA,
            GL_ZERO,
            GL_ONE,
        };

        for (int r = 0; r < 6; r++)
        {
            for (int g = 0; g < 6; g++)
            {
                for (int b = 0; b < 6; b++)
                {
                    for (int a = 0; a < 6; a++)
                    {
                        swizzlePermutation permutation;
                        permutation.swizzleRed = swizzles[r];
                        permutation.swizzleGreen = swizzles[g];
                        permutation.swizzleBlue = swizzles[b];
                        permutation.swizzleAlpha = swizzles[a];
                        mPermutations.push_back(permutation);
                    }
                }
            }
        }
    }
ShootingApplication::ShootingApplication( int argc, char *argv[] ):
	GameApplication( argc, argv )
	{		
		setWindowWidth( SCREEN_WIDTH );
		setWindowHeight ( SCREEN_HEIGHT );
	}