Commit 9063cefe authored by Sami Nopanen's avatar Sami Nopanen Committed by Alexandre Julliard

Initial implementation of cards.dll.

parent 75a1f6d0
......@@ -1497,6 +1497,7 @@ dlls/avicap32/Makefile
dlls/avifil32/Makefile
dlls/cabinet/Makefile
dlls/capi2032/Makefile
dlls/cards/Makefile
dlls/cfgmgr32/Makefile
dlls/comcat/Makefile
dlls/comctl32/Makefile
......
......@@ -22,6 +22,7 @@ BASEDIRS = \
avifil32 \
cabinet \
capi2032 \
cards \
cfgmgr32 \
comcat \
comctl32 \
......@@ -233,6 +234,7 @@ SYMLINKS_SO = \
avifil32.dll.so \
cabinet.dll.so \
capi2032.dll.so \
cards.dll.so \
cfgmgr32.dll.so \
comcat.dll.so \
comctl32.dll.so \
......@@ -399,6 +401,9 @@ cabinet.dll.so: cabinet/cabinet.dll.so
capi2032.dll.so: capi2032/capi2032.dll.so
$(RM) $@ && $(LN_S) capi2032/capi2032.dll.so $@
cards.dll.so: cards/cards.dll.so
$(RM) $@ && $(LN_S) cards/cards.dll.so $@
cfgmgr32.dll.so: cfgmgr32/cfgmgr32.dll.so
$(RM) $@ && $(LN_S) cfgmgr32/cfgmgr32.dll.so $@
......@@ -909,6 +914,7 @@ IMPORT_LIBS = \
libavifil32 \
libcabinet \
libcapi2032 \
libcards \
libcfgmgr32 \
libcomcat \
libcomctl32 \
......@@ -1057,6 +1063,11 @@ libcapi2032.def: capi2032/capi2032.spec.def
libcapi2032.a: capi2032/capi2032.spec.def
$(DLLTOOL) -k -l $@ -d capi2032/capi2032.spec.def
libcards.def: cards/cards.spec.def
$(RM) $@ && $(LN_S) cards/cards.spec.def $@
libcards.a: cards/cards.spec.def
$(DLLTOOL) -k -l $@ -d cards/cards.spec.def
libcfgmgr32.def: cfgmgr32/cfgmgr32.spec.def
$(RM) $@ && $(LN_S) cfgmgr32/cfgmgr32.spec.def $@
libcfgmgr32.a: cfgmgr32/cfgmgr32.spec.def
......@@ -1603,6 +1614,7 @@ avicap32/avicap32.spec.def: $(WINEBUILD)
avifil32/avifil32.spec.def: $(WINEBUILD)
cabinet/cabinet.spec.def: $(WINEBUILD)
capi2032/capi2032.spec.def: $(WINEBUILD)
cards/cards.spec.def: $(WINEBUILD)
cfgmgr32/cfgmgr32.spec.def: $(WINEBUILD)
comcat/comcat.spec.def: $(WINEBUILD)
comctl32/comctl32.spec.def: $(WINEBUILD)
......@@ -1723,6 +1735,7 @@ avicap32/avicap32.dll.so: avicap32
avifil32/avifil32.dll.so: avifil32
cabinet/cabinet.dll.so: cabinet
capi2032/capi2032.dll.so: capi2032
cards/cards.dll.so: cards
cfgmgr32/cfgmgr32.dll.so: cfgmgr32
comcat/comcat.dll.so: comcat
comctl32/comctl32.dll.so: comctl32
......
Makefile
b1fv.bmp
b2fv.bmp
c1.bmp
c10.bmp
c2.bmp
c3.bmp
c4.bmp
c5.bmp
c6.bmp
c7.bmp
c8.bmp
c9.bmp
cards.dll.dbg.c
cards.res
cards.spec.c
cards.spec.def
cj.bmp
ck.bmp
cq.bmp
d1.bmp
d10.bmp
d2.bmp
d3.bmp
d4.bmp
d5.bmp
d6.bmp
d7.bmp
d8.bmp
d9.bmp
dj.bmp
dk.bmp
dq.bmp
h1.bmp
h10.bmp
h2.bmp
h3.bmp
h4.bmp
h5.bmp
h6.bmp
h7.bmp
h8.bmp
h9.bmp
hj.bmp
hk.bmp
hq.bmp
jr.bmp
s1.bmp
s10.bmp
s2.bmp
s3.bmp
s4.bmp
s5.bmp
s6.bmp
s7.bmp
s8.bmp
s9.bmp
sj.bmp
sk.bmp
sq.bmp
version.res
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = cards.dll
IMPORTS = user32 gdi32 kernel32
C_SRCS = \
cards.c
RC_SRCS = \
cards.rc \
version.rc
RC_BINSRC = cards.rc
RC_BINARIES = \
b1fv.bmp \
b2fv.bmp \
c1.bmp \
c2.bmp \
c3.bmp \
c4.bmp \
c5.bmp \
c6.bmp \
c7.bmp \
c8.bmp \
c9.bmp \
c10.bmp \
cj.bmp \
ck.bmp \
cq.bmp \
d1.bmp \
d2.bmp \
d3.bmp \
d4.bmp \
d5.bmp \
d6.bmp \
d7.bmp \
d8.bmp \
d9.bmp \
d10.bmp \
dj.bmp \
dk.bmp \
dq.bmp \
h1.bmp \
h2.bmp \
h3.bmp \
h4.bmp \
h5.bmp \
h6.bmp \
h7.bmp \
h8.bmp \
h9.bmp \
h10.bmp \
hj.bmp \
hk.bmp \
hq.bmp \
jr.bmp \
s1.bmp \
s2.bmp \
s3.bmp \
s4.bmp \
s5.bmp \
s6.bmp \
s7.bmp \
s8.bmp \
s9.bmp \
s10.bmp \
sj.bmp \
sk.bmp \
sq.bmp
@MAKE_DLL_RULES@
### Dependencies:
/*
* Cards dll implementation
*
* Copyright (C) 2004 Sami Nopanen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "cards.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(cards);
void WINAPI cdtTerm(void);
static HINSTANCE hInst;
static int cardWidth;
static int cardHeight;
static HBITMAP cardBitmaps[CARD_MAX + 1];
/***********************************************************************
* Initializes the cards.dll library. Loads the card bitmaps from the
* resources, and initializes the card size variables.
*/
BOOL WINAPI cdtInit(int *width, int *height)
{
BITMAP bm;
int i;
TRACE("(%p, %p)\n", width, height);
for(i = 0; i <= CARD_MAX; i++)
cardBitmaps[i] = 0;
for(i = 0; i <= CARD_MAX; i++)
{
cardBitmaps[i] = LoadBitmapA(hInst, MAKEINTRESOURCEA(i));
if(cardBitmaps[i] == 0)
{
cdtTerm();
return FALSE;
}
}
GetObjectA(cardBitmaps[0], sizeof(BITMAP), &bm);
*width = cardWidth = bm.bmWidth;
*height = cardHeight = bm.bmHeight;
return TRUE;
}
/***********************************************************************
* Draw a card. Unlike cdtDrawCard, this version allows you to stretch
* card bitmaps to the size you specify (dx, dy). See cdtDraw for info
* on card, type and color parameters.
*/
BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int type, DWORD color)
{
HDC hMemoryDC;
HBITMAP hCardBitmap;
HGDIOBJ result;
TRACE("(%p, %d, %d, %d, %d, %d, %d, %ld)\n", hdc, x, y, dx, dy, card, type, color);
if((card < 0) || (card > CARD_MAX))
{
FIXME("Unexpected card: %d\n", card);
return 0;
}
if((type < 0) || (type > 2))
FIXME("Unexpected type: %d\n", type);
hCardBitmap = cardBitmaps[card];
if(hCardBitmap == 0)
return FALSE;
hMemoryDC = CreateCompatibleDC(hdc);
if(hMemoryDC == 0)
return FALSE;
result = SelectObject(hMemoryDC, hCardBitmap);
if((result == 0) || (result == HGDI_ERROR))
{
DeleteDC(hMemoryDC);
return FALSE;
}
SetBkColor(hdc, color);
if((cardWidth == dx) && (cardHeight == dy))
BitBlt(hdc, x, y, cardWidth, cardHeight, hMemoryDC, 0, 0, SRCCOPY);
else
StretchBlt(hdc, x, y, dx, dy, hMemoryDC, 0, 0, cardWidth, cardHeight, SRCCOPY);
DeleteDC(hMemoryDC);
return TRUE;
}
/***********************************************************************
* Draws a card at position x, y in its default size (as returned by
* cdtInit.
*
* Type parameter controls whether the front (0), back (1), or inverted
* front (2) of the card is to be drawn.
*
* The card parameter defines the card graphic to be drawn. If we are
* drawing fronts of cards, card should have a value from 0 through 51
* to represent the card face. If we are drawing card backs, 53 through
* 68 represent different card backs.
*
* When drawing card faces, two lowest bits represent the card suit
* (clubs, diamonds, hearts, spades), and the bits above that define the
* card value (ace, 2, ..., king). That is,
* card = face * 4 + suit.
*
* Color parameter defines the background color, used when drawing some
* card backs.
*/
BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int type, DWORD color)
{
TRACE("(%p, %d, %d, %d, %d, %ld)\n", hdc, x, y, card, type, color);
return cdtDrawExt(hdc, x, y, cardWidth, cardHeight, card, type, color);
}
/***********************************************************************
* Animates the card backs, e.g. blinking lights on the robot, the sun
* donning sunglasses, bats flying across the caste, etc.. Works only
* for cards of normal size (as drawn with cdtDraw). To draw frames of
* the card back animation, start with frame = 0, and increment the
* frame by one, until cdtAnimate returns FALSE (to indicate that we
* have gone through all frames of animation).
*/
BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame)
{
TRACE("(%p, %d, %d, %d, %d)\n", hdc, cardback, x, y, frame);
FIXME("Implement me.");
return FALSE;
}
/***********************************************************************
* Frees resources reserved by cdtInitialize.
*/
void WINAPI cdtTerm()
{
int i;
TRACE("()\n");
for(i = 0; i <= CARD_MAX; i++)
{
if(cardBitmaps[i] != 0)
DeleteObject(cardBitmaps[i]);
cardBitmaps[i] = 0;
}
}
/***********************************************************************
* DllMain.
*/
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
hInst = inst;
DisableThreadLibraryCalls( inst );
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
/*
* Cards dll definitions
*
* Copyright (C) 2004 Sami Nopanen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CARDS_H__
#define __CARDS_H__
/* Card suits */
#define CARD_SUIT_CLUBS 0
#define CARD_SUIT_DIAMONDS 1
#define CARD_SUIT_HEARTS 2
#define CARD_SUIT_SPADES 3
/* 0-51 = normal 52 cards of deck */
/* 52 = ? */
/* 53-68 = card backs */
#define CARD_UNKNOWN 52
#define CARD_BACK_CROSSHATCH 53
#define CARD_BACK_WEAVE1 54
#define CARD_BACK_WEAVE2 55
#define CARD_BACK_ROBOT 56
#define CARD_BACK_FLOWERS 57
#define CARD_BACK_VINE1 58
#define CARD_BACK_VINE2 59
#define CARD_BACK_FISH1 60
#define CARD_BACK_FISH2 61
#define CARD_BACK_SHELLS 62
#define CARD_BACK_CASTLE 63
#define CARD_BACK_ISLAND 64
#define CARD_BACK_CARDHAND 65
#define CARD_BACK_UNUSED 66
#define CARD_BACK_THE_X 67
#define CARD_BACK_THE_O 68
#define CARD_MAX 68
/* As defined by CARD_SUIT_* */
#define SUIT_FROM_CARD(card) (card & 3)
/* 0 = ace, ..., 12 = king */
#define FACE_FROM_CARD(card) (card >> 2)
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
@ stdcall cdtInit(ptr ptr)
@ stdcall cdtDraw(long long long long long long)
@ stdcall cdtDrawExt(long long long long long long long long)
@ stdcall cdtAnimate(long long long long long)
@ stdcall cdtTerm()
/*
* Cards dll version resources
*
* Copyright (C) 2004 Sami Nopanen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine Cards Library"
#define WINE_FILENAME_STR "cards.dll"
#define WINE_FILEVERSION 5,0,2134,1
#define WINE_FILEVERSION_STR "5.00.2134.1"
#define WINE_PRODUCTVERSION 5,0,2134,1
#define WINE_PRODUCTVERSION_STR "5.00.2134.1"
#define WINE_PRODUCTNAME_STR "Wine"
#include "wine/wine_common_ver.rc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment