Пример #1
0
void WINAPI DLLExport EditorDisplay(mv _far * mV, fpObjInfo oiPtr, fpLevObj loPtr,
                                    LPEDATA edPtr, RECT FAR * rc)
{
#ifndef RUN_ONLY

    LPSURFACE ps = WinGetSurface((int)mV->mvIdEditWin);
    if (ps != NULL) // Do the following if this surface exists
    {
        // ps->SetClipRect(rc->left, rc->top, rc->right-rc->left,
        // rc->bottom-rc->top);

        // Prevent the user from having a seizure
        // srand((long)mV->mvEditFrame + edPtr->width + edPtr->height);

        // Get surfaces of tilesets
        // cSurface surfs[TILESETCOUNT];
        // for (int i = 0; i < edPtr->tilesetCount; ++i)
        //{
        //	LockImageSurface(mV->mvIdAppli, edPtr->tilesets[i], surfs[i]);
        //}

        // Draw opaque background
        if (!edPtr->transparent)
            ps->Rectangle(rc->left, rc->top, rc->right, rc->bottom, edPtr->background, 0, 0, 1);

        //// For each tile
        // if (edPtr->tileWidth > 0 && edPtr->tileHeight > 0)
        //{
        //	for (int x = rc->left; x <= rc->right; x += edPtr->tileWidth)
        //	{
        //		for (int y = rc->top; y <= rc->bottom; y +=
        // edPtr->tileHeight)
        //		{
        //			// Draw a random tile
        //			if (edPtr->tilesetCount)
        //			{
        //				int tileset = 0;
        //				//int tileset = rand() %
        // edPtr->tilesetCount;
        //				int tx = rand() %
        //(surfs[tileset].GetWidth()
        ///
        // edPtr->tileWidth);
        //				int ty = rand() %
        //(surfs[tileset].GetHeight()
        ///
        // edPtr->tileHeight);
        //				surfs[tileset].Blit(*ps, x, y,
        // tx*edPtr->tileWidth,
        // ty*edPtr->tileHeight, edPtr->tileWidth, edPtr->tileHeight,
        // BMODE_TRANSP, BOP_COPY);
        //			}
        //			// Draw grid
        //			else
        //			{
        //				ps->Rectangle(x, y,
        // x+edPtr->tileWidth+1,
        // y+edPtr->tileHeight+1,
        // 1, 0x999999);
        //			}
        //		}
        //	}
        //}

        // Draw border
        ps->Rectangle(rc->left, rc->top, rc->right, rc->bottom, 1, OPAQUE_BLACK);
        ps->ClearClipRect();

        // Unlock stuff
        // for (int i = 0; i < edPtr->tilesetCount; ++i)
        //{
        //	UnlockImageSurface(surfs[i]);
        //}
    }

#endif // !RUN_ONLY
}
Пример #2
0
void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr, RECT FAR *rc)
{
#ifndef RUN_ONLY

	// This is a simple case of drawing an image onto MMF's frame editor window
	// First, we must get a pointer to the surface used by the frame editor

	LPSURFACE ps = WinGetSurface((int)mV->mvIdEditWin);
	if ( ps != NULL )		// Do the following if this surface exists
	{

        int x = rc->left;
        int y = rc->top;
        int w = rc->right-rc->left;
        int h = rc->bottom-rc->top;



		cSurface is;			// New surface variable for us to use
		is.Create(4, 4, ps);	// Create a surface implementation from a prototype (frame editor win)
 
		is.LoadImage(hInstLib, EXO_IMAGE, LI_NONE);	// Load our bitmap from the resource,
		
        COLORREF color;
        is.GetPixel(0,0,color);
        
        ps->Fill(x, y, w, h, color);

        ps->Rectangle(x+4,y+4,rc->right-4,rc->bottom -4, (COLORREF)0x000000, 1, (COLORREF)0x000000, false);
        ps->Rectangle(x,y,x+36,y+36,color,0,color,true);
        ps->Line(rc->right-112,rc->bottom-5,rc->right-8,rc->bottom-5,1,color);


		// This actually blits (or copies) the whole of our surface onto the frame editor's surface
		// at a specified position.
		// We could use different image effects when we copy, e.g. invert, AND, OR, XOR,
		// blend (semi-transparent, the 6th param is amount of transparency)
		// You can 'anti-alias' with the 7th param (default=0 or off)      

        is.Blit(*ps, x, y, BMODE_TRANSP, BOP_COPY, 0);	// Blit the image to the frame editor surface!

        		// Create font
		HFONT hFnt = NULL;

		// Ink effects
		BOOL bTransp = ((oiPtr->oiHdr.oiInkEffect & EFFECTFLAG_TRANSPARENT) != 0);
		BlitMode bm = (bTransp) ? BMODE_TRANSP : BMODE_OPAQUE;
		BOOL bAntiA = (oiPtr->oiHdr.oiInkEffect & EFFECTFLAG_ANTIALIAS) ? TRUE : FALSE;
		BlitOp bo = (BlitOp)(oiPtr->oiHdr.oiInkEffect & EFFECT_MASK);
		LPARAM boParam = oiPtr->oiHdr.oiInkEffectParam;

		// Draw text
		DWORD dwDTFlags =  DT_RIGHT | DT_BOTTOM | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS;
		ps->DrawText("Exclusion Zone", 14, rc, dwDTFlags, 0x000000, hFnt,
					 bm, bo, boParam, bAntiA, 0UL,8UL);

		// Delete font
		if ( hFnt != NULL )
			DeleteObject(hFnt);

        
        
	}

#endif // !RUN_ONLY
}