void DirectX3DGraphics::_beginDraw()
    {
        D3DXMATRIX identity;
        D3DXMATRIX ortho;
        D3DXMatrixIdentity(&identity);

        D3DXMatrixOrthoLH(&ortho, (float)mWidth, (float)mHeight, 0.0f, 1.0f);
        mDevice->SetTransform(D3DTS_VIEW, &identity);
        mDevice->SetTransform(D3DTS_WORLD, &identity);       
        mDevice->SetTransform(D3DTS_PROJECTION, &ortho);
    
        mDevice->SetRenderState(D3DRS_DITHERENABLE, FALSE);
        mDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
        mDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
        mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
        mDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
        mDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
        
        mDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
        mDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);

        mDevice->SetTexture(0, 0);

        pushClipArea(Rectangle(0, 0, mWidth, mHeight));
    }
Exemple #2
0
void Graphics::drawImageRect(int x, int y, int w, int h, Image *topLeft,
                             Image *topRight, Image *bottomLeft,
                             Image *bottomRight, Image *top, Image *right,
                             Image *bottom, Image *left, Image *center)
{
    pushClipArea(gcn::Rectangle(x, y, w, h));

    // Draw the center area
    drawImagePattern(center, topLeft->getWidth(), topLeft->getHeight(),
                     w - topLeft->getWidth() - topRight->getWidth(),
                     h - topLeft->getHeight() - bottomLeft->getHeight());

    // Draw the sides
    drawImagePattern(top, left->getWidth(), 0, w - left->getWidth() -
                     right->getWidth(), top->getHeight());
    drawImagePattern(bottom, left->getWidth(), h - bottom->getHeight(),
                     w - left->getWidth() - right->getWidth(),
                     bottom->getHeight());
    drawImagePattern(left, 0, top->getHeight(), left->getWidth(),
                     h - top->getHeight() - bottom->getHeight());
    drawImagePattern(right, w - right->getWidth(), top->getHeight(),
                     right->getWidth(), h - top->getHeight() -
                     bottom->getHeight());

    // Draw the corners
    drawImage(topLeft, 0, 0);
    drawImage(topRight, w - topRight->getWidth(), 0);
    drawImage(bottomLeft, 0, h - bottomLeft->getHeight());
    drawImage(bottomRight, w - bottomRight->getWidth(),
              h - bottomRight->getHeight());

    popClipArea();
}
Exemple #3
0
 void HGEGraphics::_beginDraw()
 {
     pushClipArea(Rectangle(0, 
                            0,
                            mHGE->System_GetState(HGE_SCREENWIDTH), 
                            mHGE->System_GetState(HGE_SCREENHEIGHT)));
 }
 void IrrlichtGraphics::_beginDraw()
 {
     Rectangle area;
     area.x = 0;
     area.y = 0;
     area.width = mDriver->getScreenSize().Width;
     area.height = mDriver->getScreenSize().Height;
     pushClipArea(area);
 }
 void COCOS2DXGraphics::_beginDraw()
 {
     Rectangle area;
     area.x = 0;
     area.y = 0;
     area.width = mTarget->w;
     area.height = mTarget->h;
     pushClipArea(area);
 }
Exemple #6
0
    void AllegroGraphics::_beginDraw()
    {
        if (mTarget == NULL)
        {
            throw GCN_EXCEPTION("Target BITMAP is null, set it with setTarget first.");
        }

        // push a clip area the size of the target bitmap
        pushClipArea(Rectangle(0, 0, mTarget->w, mTarget->h));
    }
    void OpenGLGraphics::_beginDraw()
    {
        glPushAttrib(
            GL_COLOR_BUFFER_BIT |
            GL_CURRENT_BIT |
            GL_DEPTH_BUFFER_BIT |
            GL_ENABLE_BIT |
            GL_FOG_BIT |
            GL_LIGHTING_BIT |
            GL_LINE_BIT |
            GL_POINT_BIT |
            GL_POLYGON_BIT |
            GL_SCISSOR_BIT |
            GL_STENCIL_BUFFER_BIT |
            GL_TEXTURE_BIT |
            GL_TRANSFORM_BIT |
            GL_POINT_BIT |
            GL_LINE_BIT
            );

        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
        glLoadIdentity();

        glMatrixMode(GL_TEXTURE);
        glPushMatrix();
        glLoadIdentity();

        glMatrixMode(GL_PROJECTION);
        glPushMatrix();
        glLoadIdentity();
        
        glOrtho(0.0,
                (double)mWidth,
                (double)mHeight,
                0.0,
                -1.0,
                1.0);

        glDisable(GL_LIGHTING);
        glDisable(GL_CULL_FACE);
        glDisable(GL_DEPTH_TEST);
        glDisable(GL_TEXTURE_2D);

        glEnable(GL_SCISSOR_TEST);
        glPointSize(1.0);
        glLineWidth(1.0);

        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

        pushClipArea(Rectangle(0, 0, mWidth, mHeight));
    }
void OpenGLGraphics::_beginDraw()
{
    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrtho(0.0, (double)mScreen->w, (double)mScreen->h, 0.0, -1.0, 1.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glEnable(GL_SCISSOR_TEST);

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    pushClipArea(gcn::Rectangle(0, 0, mScreen->w, mScreen->h));
}
 void OpenLayerGraphics::_beginDraw()
 {
     pushClipArea(Rectangle(0, 0, mWidth, mHeight));
 }