Playing card engine in HTA

Author Message
AMBience

  • Total Posts : 31
  • Scores: 0
  • Reward points : 0
  • Joined: 7/24/2008
  • Status: offline
Playing card engine in HTA Friday, December 16, 2011 1:19 PM (permalink)
0
This 35k HTA is like VisualBasic with cards.DLL
It first started out as a graphic storage routine (which it still is), but for 16x16 transparent gifs to be used in a TreeView I'm working on (was working on).

There's no way you can store 52 cards each one 71x96 pixels and post it on a forum (even with gif compression), so I changed the image containers to hold different sized data blocks in standard char-pixel format, a plot routine and a logical card creator...and that's it really, pretty basic stuff.

I've set up 52 <IMG> objects with each bitmap loaded, you can drag them around, see the properties in the tooltip and double-click them to flip them over.

As for rules, I've given them some game properties and empty drag\drop events, the rest is up to you...........

Happy Xmas!
 
 <HTML><HEAD>
 <TITLE>HTA Cards - By Alan Bond 2011</TITLE>
 <HTA:APPLICATION
 ID="frmMain" APPLICATIONNAME="HTACards" SINGLEINSTANCE="Yes"
 CONTEXTMENU="No" SELECTION="No" WINDOWSTATE="Maximize"
 INNERBORDER="No" SCROLL="No" ICON="Sol.EXE"
 />
</HEAD>

<BODY SCROLL="No" STYLE="Border:0;Margin:0" BGCOLOR="ButtonFace">

<!-- '---------------- Easy edit graphic storage ------------------' -->
<DIV ID="divCardParts" STYLE="Display:None">

<!-- 'Numbers 11x14 -->
<CODE ID="cdeNumbers">
.....#.....|..#####....|.#######...|.....##....|.#######...|...####....|.#######...|
.....#.....|.#######...|.#######...|....###....|.#######...|..#####....|.#######...|
....###....|.##...##...|.##..##....|...####....|.##........|.###.......|.##...##...|
....###....|......##...|....##.....|..#####....|.##........|.##........|.....##....|
...##.##...|.....###...|...##......|.###.##....|.######....|.######....|.....##....|
...##.##...|....###....|..#####....|###..##....|.#######...|.#######...|....##.....|
..##...##..|...###.....|..######...|#########..|......##...|.##...##...|....##.....|
..#######..|..###......|......##...|#########..|......##...|.##...##...|....##.....|
.#########.|.###..##...|......##...|.....##....|.##...##...|.##...##...|...##......|
.##.....##.|.##...##...|.##...##...|.....##....|.##...##...|.##...##...|...##......|
####...####|.#######...|.#######...|....####...|.#######...|.#######...|...##......|
####...####|.#######...|..#####....|....####...|..#####....|..#####....|...##......|
...........|...........|...........|...........|...........|...........|...........|
...........|...........|...........|...........|...........|...........|...........|

..#####....|..#####....|##..####...|....####...|..#####....|####.####..|#....#.....|
.#######...|.#######...|##.######..|....####...|.#######...|####.####..|##..##.....|
.##...##...|.##...##...|##.##..##..|.....##....|.##...##...|.##..##....|######.....|
.##...##...|.##...##...|##.##..##..|.....##....|.##...##...|.##.##.....|#.##.#.....|
.##...##...|.##...##...|##.##..##..|.....##....|.##...##...|.####......|######.....|
..#####....|.##...##...|##.##..##..|.....##....|.##...##...|.###.......|##..##.....|
.#######...|.#######...|##.##..##..|.....##....|.##...##...|.####......|#.##.#....#|
.##...##...|..######...|##.##..##..|.....##....|.##...##...|.##.##.....|.######..##|
.##...##...|......##...|##.##..##..|.##..##....|.##...##...|.##..##....|.....######|
.##...##...|.....###...|##.##..##..|.##..##....|.##...##...|.##...##...|.....#.##.#|
.#######...|..#####....|##.######..|.######....|.#######...|####.####..|.....######|
..#####....|..####.....|##..####...|..####.....|..#####....|####.####..|.....#.##.#|
...........|...........|...........|...........|.....###...|...........|.....##..##|
...........|...........|...........|...........|......##...|...........|......####.|
</CODE>

<!-- 'Small suit 9x10 -->
<CODE ID="cdeSSuit">
....#....|...###...|.###.###.|....#....|
...###...|..#####..|####.####|...###...|
..#####..|..#####..|#########|..#####..|
.#######.|.#.###.#.|#########|.#######.|
#########|#########|#########|#########|
#########|#########|.#######.|.#######.|
#########|#########|..#####..|..#####..|
.##.#.##.|.##.#.##.|...###...|...###...|
...###...|....#....|....#....|....#....|
...###...|...###...|.........|.........|
</CODE>

<!-- 'Large suit 15x15 -->
<CODE ID="cdeLSuit">
.......#.......|......###......|..####...####..|.......#.......|
......###......|.....#####.....|.######.######.|......###......|
.....#####.....|....#######....|#######.#######|.....#####.....|
....#######....|....#######....|###############|....#######....|
...#########...|....#######....|###############|...#########...|
..###########..|.....#####.....|###############|..###########..|
.#############.|..###.###.###..|###############|.#############.|
.#############.|.#############.|.#############.|###############|
###############|###############|.#############.|.#############.|
###############|###############|..###########..|..###########..|
###############|###############|...#########...|...#########...|
######.#.######|.#####.#.#####.|....#######....|....#######....|
.####..#..####.|..###..#..###..|.....#####.....|.....#####.....|
......###......|......###......|......###......|......###......|
.....#####.....|.....#####.....|.......#.......|.......#.......|
</CODE>

<!-- 'Ace of Spades 39x39 -->
<CODE ID="cdeAOS">
...................#...................|
..................###..................|
.................#####.................|
................#######................|
...............####.####...............|
..............####.#.####..............|
.............####.###.####.............|
............####.#####.####............|
...........####.#######.####...........|
..........####.####.####.####..........|
.........####.####.#.####.####.........|
........####.####.###.####.####........|
.......####.####.##.##.####.####.......|
......####.####.##.#.##.####.####......|
.....####.####.##.###.##.####.####.....|
....####.####.###.###.###.####.####....|
...####.####.#####.#.#####.####.####...|
..####.######.#####.#####.######.####..|
..###.########.###.#.###.########.###..|
.####.###.#####.#.###.#.#####.###.####.|
.###.#####.##.##.##.##.##.##.#####.###.|
.###.#####.####.#.###.#.####.#####.###.|
###.####..####.###.#.###.####..####.###|
###.###.#####.#####.#####.#####.###.###|
###.###.####.#############.####.###.###|
###.###.###.#####.###.#####.###.###.###|
###.####...#####.#.#.#.#####...####.###|
###.###########.###.###.###########.###|
###.##########.#########.##########.###|
####.########.###########.########.####|
.###..#####..####.###.####..#####..###.|
.#####.....#####..###..#####.....#####.|
..#############...###...#############..|
...###########...#####...###########...|
.....#######.....#####.....#######.....|
................#######................|
................#######................|
...............#########...............|
..............###########..............|
</CODE>

<!-- 'Card back pattern 7x7 (4 colours)-->
<CODE ID="cdeBack">
!*****!|
*!***!*|
**!*!**|
***!***|
**!*!**|
*!***!*|
!*****!|
</CODE>

<!-- '12 royals 47x37 (4 colours) -->
<CODE ID="cdeRoyal">
###############################################|###############################################|###############################################|
#...##...#*#***#*#**#*#***#**#................#|#..........##.##.#.#.*#!##!!!!#...............#|#...............#!!!!!!!!!!!!!!!!!!!!#........#|
#..#!!#...#*#**#*#**#*#**#**#........#........#|#..#......#####.#.##.*#!!#!!!#.......#........#|#........#.......#!!!!!!!#!#!#!#!#!##.........#|
#.#!#*!#...#*###*####*###**#........###.......#|#..#......##.#.##..#.*#!!!!!!#......###.......#|#.......###.......##!#!#!#*#*#*#*#*#..........#|
#.#!#*!#....#**************#.......#####......#|#..#......###.#..#..#*#!##!!#......#####......#|#......#####.......#*#*#**********#..........##|
#.#!#*!#....################......#######.....#|#.#!#.....#.##....#.#*#!!#!!#.....#######.....#|#.....#######......#*****##########.........###|
#..#!!#.....#.....#!#!#!#!#......#########....#|#.#!#....##.#......##**#!!!!!#...#########....#|#....#########.....#######........##.......#!##|
#...##......#.##..#!#!#!#!#.....###########...#|#.#!#....#*.####.####**#!##!!#..###########...#|#...###########....#.#.#.#........#.#......#!##|
#..#!!#.....#.#.##.#!#!#!#!#...#############..#|#.#!#....#*.###.###.#***#!#!#..#############..#|#..#############...#.#.#.#####.####.#......#!##|
#.#!#*!#....#......#!#!#!#!#...#############..#|##!!!#...#*.#...#...#.**#!!#...#############..#|#..#############...#.#.#.##.###.####.......#!##|
#..#!!#....#.......#!#!#!#!#..###############.#|##!#!#...#*.#...#....#***#!#..###############.#|#.###############..#.#.#.#....#...#.#......#!##|
#...##....#........#!#!#!#!#..###############.#|##!!!#..#**.#...#....#.***##..###############.#|#.###############..#.#.#.#....#...#.#......#!##|
#..#!!#...##..##.#.#!#!#!#!#..###############.#|#.#!#...#*.##..###....#***##..###############.#|#.###############..#.#.#.#....#...#.#......#!##|
#.#!#*!#....#..###.#!#!#!#!#..######.#.######.#|#.#!#...#*.##.........#.***#..######.#.######.#|#.######.#.######..#.#.#.#...###..#.#......#!##|
#.#!#*!#....#......#!#!#!#!!##.####..#..####..#|######..#.####.###...#*#.***#..####..#..####..#|#..####..#..####...#.#.#.#.##...#.#.#......#!##|
#.#!#*!#....###...#!!#!#!#!!!!#.....###.......#|##!!!#.#*.####..#...#*##.***##......###.......#|#.......###......###.#.#.#.#.###..##.##....#!##|
#..#!!#.....#.....#!!#!!#!#!#!!#...#####......#|#.###..#*.###!#....###!##.***##....#####......#|#......#####....#..#.#.#.#........#.#..#...#!##|
#.#####....##.....*##!#!#!#!!#!#..............#|##!!!#.#*.#!##!####!#!#!!#.***##..............#|#..............#.#.#.#.#.#..#...#.#.#..#...#!##|
#.#...##.#####..****#!##!#!##!!#..............#|##!!!#.####!!##!#!#!##!!###....##.......**....#|#............###.##..#.#.##.#.#.#.#..##!##.#!##|
#..##..########*****##!!#!#!!!##..............#|#.###..####!!!!#####!!!########*##....**##**..#|#..........###!##...#..#.#..#.###..###!##.##!##|
#.#..####.########################............#|#.#*#.###.##!#!!!!!!#!###..##****#!..**#!!#**.#|#........##!#*!#####.##.#..#.#.#!#*##!##.#*#!##|
#.#.###.#.####################.#.###..........#|#.#!##!##.##!!#!#!#!!##..###***.#!##..**##**.##|#......####!###!##!########.#.##!###!##.####!##|
#.###.####.#!#!#!#!#!#!#!#!#!#.###.###........#|#.#!#*!!#####!!!!!!!##.###****.#!##!##..**..#*#|#....##!#!##!##!#*##!#!#!######!#*#!##.#***#!##|
##*###.#.#.###################.#.#.##*##......#|###!#**!##.##!#!#!!##.###***..#!###!!!#.#..#!*#|#..##**#####!#*#!#**######!#!##!###!##.#*###!##|
#*##*#.####.#****************#.###.#***###..###|###!#**!######!!!!##.##****..#!#*###!!!##.###!#|#.#*!!##!###!###!#***!!!!#####!#*#!##.#****#!##|
###*###.#.#.##*!**!**!**!**!*#.#.#.#*###**##!##|###!#**!!##.##!!!##.##****.**#!########!#####!#|##!**#####!##!##!#***!###!!**#!###!##.#*####!##|
##*##!#.####.#***!#!*!*!#!***#.###.###**##!!!##|###!#.**!###.###!#.##***..***#!#***#####....#!#|#*!!*##!#!#!#!#*#!#**!!!!!!**#!##!##.#*****#!##|
#*##!#!#.#.#.##*!#!*!!!*!#!**#.#.#.#**##!!#####|###!##**!!####!!#.##***.***###!########.....#!#|#**!#####!###!###!###########!#*#!##.#*########|
###!#!##.#####!#*!**!#!**!***#.###.####!!!!!###|###!#.#**!###!**!##***.**#####!!#****#......#!#|#!**##!#!#!!!#!##!##...#...##!###!##.#*#!!!!###|
##!#!#!##.##!######.###.###.##.#.#.###!!#####!#|###!##.**!!##!**!#***.*###..###!#####..#..##!*#|#!!*####!#!###!##!#..#...#..#!##!##.#*#!###!!!#|
#!#!#!#####!##!#.#.#.#.#.#.#.#.######!!!!!!##!#|###!#.##**!!#!**!#**.*###....###!#**#.#######*#|#*!!##!#!#!!!#!#*#!#.#.#.#..#!##!##.#*#!!#.#!!#|
##!#!##*##!##!!##.###.###.####.#.###!!#!####!##|###!##.#***!!#!!#**.###*..##..###!#####!#######|#**!####!#!###!###!#...#...#!#*#!####**####.###|
#!!!##.*#!####!####################!!!!!!!##!##|###!#.#.#***!!###*.###..#####..###!#*#!!#!###!#|#!**##!#!#!!!!#!##!#.#...#.#!###!#!###*****####|
#!###**#!##!!!!#..................#!!#!####!#*#|###!##.#.#********###...........###!#!!!#!!!!##|#*!*####!#!####!##!#########!##!###########...#|
####.*#!##!###!#*****************#!!!!!!!##!**#|###!#.#.#.############################!!!!!##!#|#**!##!##!#!!!#!##!#!!!!!!!!!##!########...####|
###**#!##!!!!!####################!#!#####!#**#|###!##.#.#***************************######!!##|###*#####!#!###!##!#########!##!#!!###!##.#...#|
##!*#!####!##!###!##.#...##.##.##!!!!!!!#!****#|###!#.#.###.###.###.###.###.###.###.###!!!!####|#..#.##!##!#!!#!#*!###***###!##!###!!####..####|

###############################################|###############################################|###############################################|
#........##**#***#*#**#*#***#*#...............#|#!!!!!!!!!!*##*.#.#.##.#......................#|#................#!!!#!!!#!!!#!!!!!!!!#.......#|
##........##**#**#*#**#*#**#*#......###.......#|##!!!!!!!!!*##*.##.#.###............###.......#|#.......###.......#!###!###!###!!#!!!#........#|
#*#.......###**###*####*###*#......#####......#|#.#!!!!!##!*##*.#..##.##...........#####......#|#......#####.......#************###!#.........#|
#**#.....#**#**************##.....#######.....#|#..#!!!!#!**##*.#.#..#.#..........#######.....#|#.....#######.......############***#........#.#|
#***#....#*#################......#######.....#|#..#!!!!!**##**.##....###.........#######.....#|#.....#######.......################.......####|
######...**##........#!#!#!#......#######.....#|#...#!!!!**##*..#......##.........#######.....#|#.....#######......##........#.#####......#.#*#|
#!!!#...#**##........#!#!#!#.......#####......#|#...#!##!*###*..###.####*#.........#####......#|#......#####......#.#........#.#.###......#.#*#|
##!!#...###!####.###.#!#!#!#....###.###.###...#|#...#!#!**##**.#.##..###*#......###.###.###...#|#...###.###.###...#.####.#####.#.#.#......#.#*#|
#!!!#.....#!###.###.##!#!#!#...#############..#|#..#!!!**###*..#...#...##*#....#############..#|#..#############..#####.###.##.#.#.#......#.#*#|
##!!#.....#!#...#....#!#!#!#..###############.#|#..#!!!**##**.#....#...##*#...###############.#|#.###############.#.#...#....#.#.#.#......#.#*#|
#!!!#....##!#...#....#!#!#!#..###############.#|#.#!##**##**..#....#...###*#..###############.#|#.###############.#.#...#....#.#.#.#......#.#*#|
##!!#...#!#!#...#....#!#!#!#..###############.#|##!!#**###*..#....###..#*#**#.###############.#|#.###############.#.#...#....#.#.#.#......#.#*#|
#!!!#...#!#!#..###...#!#!#!##..#####.#.#####..#|#.##**###**..#.........#**#**#.#####.#.#####..#|#..#####.#.#####..#.#..###...#.#.#.#......#.#*#|
###!#...###!#........#!#!##!!#..###..#..###...#|#...####**..#*#...###.###*##**#.###..#..###...#|#...###..#..###..#..###...##.#.#.#.###....#.#*#|
#!!!#..#!!#!.#.###...#!###!!##......###.......#|#....###*...##*#...#..####*##**#....###.......#|#.......###......####..###...#.#.#.#..#...#.#*#|
###!#..#!#!!##......##!#!!######...#####......#|#...###**..##!###....#!####*##**#..#####......#|#......#####......#.#........#.#..#.#.##..#.#*#|
#!!!#..#!!!##*#....#*#!##!###.#.#.............#|#..###**.##*!*!#!####!#*!!*#**##*#............#|#...............###.#.#...#.##.#.###.##*###.#*#|
#!!!##..###*#**####***#!!!##.##.*##..........##|#.###**.#..#*!**!#!#!**!!*#.#**##*#...##......#|#..............#..#.#.#.#.#.#.##.#.#.#****#.#*#|
##!#..##*#*##****##***#######!#.***##.......#!#|####*########*!!*****!!!*#####**#*#..#**##....#|#..............#.#..#.#.#.#.##.#...##*!***#.#*#|
#.#....##*#*#*!!*###*##..##.#!#.**!*.##....#!!#|###*!!!#####.##*!!!!!!**#.#.#!#*#*#.#*##**#...#|#...........####...#.#.#*#.#..#*###**!!***#.#*#|
######.#*#*##****#.###..##.#!!#.*!!!*.#####!!!#|##!!#!!!#..#..###*###*##..##!#!#*#.#*****#....#|#........############*#***#*##****#*****!##.#*#|
#..##..##*#*#*!!*#..#..##.#!!!#.!!*!!.#####!!!#|#!!!!#!#!#.#.###.#***#.####!!!###...###*#.###.#|#.....###**#!!##.##!##**********##*!****#.#.#*#|
###!#..#*#*##****##...##.#!!###.*!!!*.#####!!!#|#*****#!!!####.#.#*!*#.#.#!#!###!#.....#.#!!!##|#....#******#!!#####!###******###*!!**!#..#.#*#|
#.#!#..##*#*#*!!*###.##.*#!!!!#.**!**.#####!!!#|#******#!!#!##.#.#***#.##!!!#*##!##.###.#!!##.#|#..##*.*.*.*.#!!##.#!#!###**###!#*****#..##.#*#|
##!!#..#*#*##****#.###.*#!!####.*****.#####!!!#|#*******##!!!!#####*####!#!#**##!###!!!#####..#|#.###*********#!!####!#!######!#****!#..###.#*#|
#.#!#.#*#*###*!!*##.#.##!!!!!!#.**!**.#####!!!#|#!#!#!#***##!#!!!!###!!!!###!*##!##!!!#.#...#.#|#*###.*.*.*.*.*#!!###!#!!####!!#*!***#.####.#*#|
##!!####*####****#*#.#*#!#!####.*!!!*.#####!!!#|##!#!#!#!#**###!!!!!!!!#####!**##!#####..####.#|#*###**********##!*###!##!##!##*!!**#..####.#*#|
#!!!########*!!*#!#*#*#!!!!!!!#.!!*!!.#####!!!#|#!#!########**!##########!##!**###**#*##.#..#.#|#*###*.*.*.*.*.###!*##!#!!!!!!#****!#.##*##.#*#|
#!!!##.###.#****##!#*#!#!######.*!!!*###**#!!!#|##!##!!!!!!!##**!####!##!##!****#*..*########.#|#*###*****####*##*#!###!###*###*****#.#####.#*#|
#!!!#...#..#*!!*#!!!#!!!!!!!!!#.**!**#**!!#!!!#|#!#!!!#####!!!#**#####!#!##!***#!#*.**#*#...#.#|##!!##*.*#....######!##!#!!!!!#*!*!#..##*##.#*#|
#!!!#.#...##****####!!#!#######.####******#!!!#|##!!###!#!###!!#*!#####!###!**#!!##****#####..#|#!!!!#**#..##..##**#!##!###*##*!!**#.######.#*#|
#!!!##.#.#.#*!!*#!!!!!!!!!!!!!##..#**!!***#!!!#|#*###!#!#!#!##!!#*####!#!##!**#!#!!#*..*#*#...#|##!!###*#.#**#.######!##!#!!!#****!#.########*#|
#!!!#.#.#.##****##!*#!###!#*!#...#******###!!!#|#**##!######!!#!#*!##!###!#!*#!!#####*.**###..#|#########.#**#.##***#!##!##*##*****#.###..#..##|
#!!!##.#.#.*!!*#!!!#*#...#*##....#*!!**##.#!!!#|#*.*##*****####!!#*#!######!*#!#!!#**#****#*#.#|##**#####..##..#######!#!#!!!#**!*!#.##....####|
#!!!#.#.#.#****##!!!#.###.#.....#*****#.#.#!!!#|#*..*#*...**#!!#!######!!#####!####*..#*..*####|##########....################*!!**#.##.##...##|
#!!!##.#.##*!!*#!###.#***#.#...##*!!*#.#.##!!!#|##****#.##.*####!#***#****#!!#!#!!#*.#.#*.**#*#|##..#..#######**#....#***######***!#.##...#####|

###############################################|###############################################|###############################################|
#.........#**.***.*.**.*.***.*#...............#|#...........##.#.#..###*!!!!!#................#|#...............#!#!!!#!!!#!!!#!!!!!!#........#|
##..###....#**.**.*.**.*.**.*#..****...****...#|#..........##.#.#.#.###*!#!!#...****...****...#|#...****...****..###!###!###!###!##!#.........#|
#*#..#!#....#**...*....*...*##.******.******..#|#.........####.##...###*!!!!#..******.******..#|#..******.******..#!!!!!!!!!!!!#!!##..##......#|
#*#..#!!#...#**************##.*******.*******.#|#.........#!#.#..#...##*!#!#..*******.*******.#|#.*******.*******..#*********!!!!!#..#!!#.....#|
#*#..#!!#...#################.***************.#|#........##!##....##.##**!!#..***************.#|#.***************..##########*****#..#!!###...#|
#####.#!!#...#!#!#!#!#.....#..***************.#|#........#!*#.......####*!!#..***************.#|#.***************..#........##########!#..##..#|
#.*.*..#!#...#!#!#!#!#..##.#..***************.#|#.......##!*####.###.###**!!#.***************.#|#.***************..#........#.#.#.#..#!#..#!#.#|
#.*.*...##..#!#!#!#!#.##.#.#..***************.#|#.......#!**###.###.#####**!#.***************.#|#.***************.#####.#####.#.#.###!!####!#.#|
#.#.#..#!#..#!#!#!#!#......#...*************..#|#......##!**#...#....#.###*#...*************..#|#..*************.#.###.###.##.#.#.###!!##..#..#|
#####.#!!#..#!#!#!#!#.......#..*************..#|#......#!**!#...#....#.####....*************..#|#..*************.#.#...#....#.#.#.#.#!!#...#..#|
#*#..#!!#...#!#!#!#!#........#..***********...#|#......#!**!#...#....#..####....***********...#|#...***********..#.#...#....#.#.#.#..#######..#|
#*#..#!!#...#!#!#!#!#...##.###...*********....#|#......#!**!#..###....#.#####....*********....#|#....*********...#.#...#....#.#.#..#..#****#..#|
#*#..#!#....#!#!#!#!#.###..#......*******.....#|#.....#!**!!#.........#..#####....*******.....#|#.....*******...#.#...###....#.#.#.#.########.#|
#*#.###...###!#!#!#!#......#.......*****......#|#.....#!**!###.###...#!#..#####....*****......#|#......*****....#.#..........#..#.#.##*#*#*#*##|
#*#......#!!!##!#!#!#....###........***...#...#|#.....#!**##!#..#...#!!#...######...***.......#|#.......***......##.#.###.....#.#.#.#*******###|
#*#.....#!!#!#!#!##!#......#.........*..##*##.#|#.....#!*#!##!#....#!!###...#######..*........#|#........*...#####..#......#.#.#.#..##*****#..#|
#*#.....#!#!!#!#!#!#***....######.......#***#.#|#.....#!#.!###!####!!###!#...######...........#|#..........###*##..#.#...#.#.#.#...#..###*#.**#|
#*#.....#!!##!!#!##*****###!!#!!!#.......#*#..#|#.....##!.#!###!!!!####!#.#...####....##.##...#|#.......#######*###..#.#.#.###...##.#...###**##|
#*#......#!!!!#!##*********#!!##!#....####*#..#|#....##!#!*.!#########!*.!###...#....#!!#!!#..#|#.....###*#..##**#.##..#.#..#.###.....##*######|
#*#......#######!!##*******##!!!!#...#...#*#..#|#...#!!!!#!.#!!####!!!#.!########....#!***#...#|#...##..#*#...##**##..##.##.#!!#..#..#*#*#!####|
#*#....##*.*#!!!!!!!######!!!#!!##..#.....###.#|#..###!##!#!*.#!!!!#.*!!####.....#....#!*!!#..#|#.###.#.#*#.#..##**###!##.##!!!#.#..#*!#*###!##|
#*#..######*.##!!!!!!!!!!!!!!!##.*###..##.#.#.#|#.#!!!!!!!!#!!!*.#*!!!##.##..#.#.##.####!!#.#.#|##!!*#.#.#*#.#..#**##!#!##!!!!#....#*!#*#####!#|
#*###..**####*.###!!!!!!!!!###.***####..#####.#|#####!###!!####!!!!####!##.#....#**#!!!###!##.#|#!***##..#*#....##**##!##!!!!!##...#!*#*#!#####|
#*#**....**####*.*#########*.***####**#..#..#.#|#!!!!!!!!!##..#####!###!##....##**#!!!#..##!#.#|#**#####..#*#.#..#***###!!!!!!#...#!*#*##*!!###|
#####**....**####*.*.*.*.*.***####**...######.#|####!####!#.#.######!#!##.#.##**######...#!!#.#|#*#####*#.#**#.#.##**##!!!!!!#..#.#*#**####!!##|
#!!!###**....**####*#######*####**....*###.#..#|#!!!!!!!!##.####..##!#!##..#***#!!!#.#####!#..#|##!###***#.#**#...#***#!!!!!##.#..##**####**!!#|
#!!#!!!##**....**###*#...#*###**....**##..##..#|##!#!###!###.##..#.##!##.#.#**#!***#.#*#.##...#|#!**!###**#.#***#.##*#!!!!!#*#...##**####****!#|
#!#!!!#!!##**....**##*#.#*##**....**##!#.#.##.#|#!!!!!!!!#.#.#*##..##!##..#**#!**!*##.##.##...#|#**!!!*#####.##**##.##!!!!!##..##**#####**!*#!#|
####!#!!*####**....*##*#*##*....**##!!!#....###|###!#!##!###.#!**#..#!#.#.#**#!***###.#.#..#..#|#*!!!#*!!####..################**######*****!!#|
#...#!!*##!!!##**...*##*##*....*##!!!!!#.#.####|#!!!!!!!!##.##!!**#.###..#**#!**!*##.##.#..#..#|#!!!#*###!#####.....***********#######**!*#!!##|
##...#*##!!!!!!#**...*###*...**#!!!!!!!#....###|##!####!##.##!#!!*#####..#**#!****#.###..###..#|#!!!#*!!!!#!#....*#############.#####*****!!!##|
#..#.###!#########*...*#*...*#########!#.#.####|#!!!!!!!##.##!##!*##!!####**#!*!**#.#.#...#*#.#|#!!!#*###!#!#.........#****#....####**!*#!!!###|
##....#!!#.......#**..###..**#.......#!#....###|##!##!!###.##!*#!!*###!!!##*#!**###.###.##***##|#!!!#*!!!!#!#.......###.***#.#.####*!***!!!####|
###.#.#!!#.#####.##**#...#**##.#####.#!#.#.####|#!!!!!#*###.#!*#!**#!####!!#####**##.###******#|##!!!#*!!###########.#####*##.#######*#!!!###*#|
###....#!#.#!!####.##.###.##.####!!#.#!#....###|####!#**#.#.#!##!!*#!#!!!##!!#***!#.#.#******##|###!!!!#########...##!!!!!##..####**#!!!!###*##|
####.#.#!#.#!!##..##.#***#.##..##!!#.#!#.#.####|#!!!#***##.##!#!!*#!#!***!###**!!!###.#****##!#|#*##!#####!!!!!#...##!#*#!#..#.#!!!!!!!!####**#|

###############################################|###############################################|###############################################|
#.........#*.***.**.**.**.**.*##..............#|#.#!!!!!!!!!#**#..#.#.##!#....................#|#.............#!!!!#!!!#!!!!!!!!!!!!!#........#|
#..........#*.**.**.**.**.*.*##.......*.......#|#..#!!!!!##!#**#.#.#.#.#!!#...........*.......#|#.......*......#!!###!###!!#!!!!!!!!#...###..##|
#...........#*...**....**..*##.......***......#|#..#!!!!!!!!#**#...##.###!#..........***......#|#......***......#********!###!!#!!!#...#!#..#*#|
##...........#**************#.......*****.....#|#...#!!!!##!#**#..#..#.###!#........*****.....#|#.....*****.....#########****!###!##..#!!#..#*#|
###..........################......*******....#|#...#!!!!!!##*#.##....#####!#......*******....#|#....*******.....############*****#...#!!#..#*#|
##!#.........#####!#........##....*********...#|#...#!!!##!#**##.......#*##!#.....*********...#|#...*********....#......##.########..#!!#.#####|
##!#.........###!#!#........##....*********...#|#...#!!!!!##*#..###.####*###!#....*********...#|#...*********....#.##...#.#.#######..#!#..*.*.#|
##!#.........#!#!#!#.###.####!#..***********..#|#...#!!##!#**#.#.###.###**##!#...***********..#|#..***********...###.#..#.#.#.#.#.#..##...*.*.#|
##!#....#....#!#!#!##.###.###!#.*************.#|#...#!!!!##*##.....#...#**###!#.*************.#|#.*************..#......#.#.#.#.#.#..#!#..#.#.#|
##!#...##....#!#!#!#....#...#!#..***********..#|#..#!!##!#**#.#....#...#***##!#..***********..#|#..***********..#.......#.#.#.#.#.#..#!!#.#####|
##!#.##!#....#!#!#!#....#...#!#...*********...#|#..#!!!!##*#.#.#...#...#***##!#...*********...#|#...*********..#........#.#.#.#.#.#...#!!#..#*#|
#####!!#.....#!#!#!#....#...#!#...*********...#|#.#!!#!##**#.##...###..#***##!#...*********...#|#...*********..###.......#.#.#.#.#.#..#!!#..#*#|
#*!!!###.....#!#!#!#...###..#!#....*******....#|#..#!!##**#..#.........#****##!#...*******....#|#....*******.....####.#..#.#.#.#.#.#...#!#..#*#|
##!####......#!#!#!#........#!###...*****.....#|#...###**#..#*#...###.#!#***##!#....*****.....#|#.....*****......#..###...#.#.#.#.#.#...###.#*#|
#*!##......##!!#!#!#...###.#.!#!!#...***......#|#....#**#...##*#...#..#!##**##!#.....***......#|#......***........##.......#.#.#.#.#.#......#*#|
##!#......#!!#!#!#!##......##!!#!#....*.......#|#...#**#...#!!###....#!!#.#*##!#......*.......#|#.......*........#......###..#.#.#.#.#......#*#|
#*!#......#!##!##!#*.#....#.*#!!!#...........##|#..#**#####.#!!!######!!#.####!#..............#|#..###...........##....#...#.#.#.#.#.#......#*#|
##!#......#!!!#!!#****####****#####.........#*#|#.#**##.####.####!!!!###.#####!#......###.....#|#.#.#.###.....##.#.....#.##..#.#.#.#.#......#*#|
#*!#......########***********##.#!###......#!##|##**##.#.####....####...###.##!#....##!!##....#|#.##.#.#.#...#.##......##...#.#.#.#.#.......#*#|
##!#....##*###.#####*******######!#.###....#!*#|#**#.##.########......###.###!##....#!##!!#.#.#|###.#.#.#.#..#..........################....#*#|
#*!#..###!#*####.#############.##!###!!##..#!##|#*#!#.####.##.##########.#.###!#...#!!!!!#..###|##.#.#.....##!#.....########!!#...#!!#..#######|
##!#######!#*#####.#########.####!#.#!!#*###!*#|####!#.#####.#.####.#####.###.#!#...###!#..#!##|#.#.#....#####!###########.##!!#.###!!#..#!!#.#|
#*!########!#*######.#.#.#.###*##!####!#***#!##|###!#!#.####.#.#.#.#.#.#####.#!!##.....##.#!!##|#..#..#####**##!###**####.##.#!!###.#!!#.##!!##|
##!###*#####!#*#############*#*##!!#.#!!##*#!*#|##!###!#..###.####.#.######.#!!####.....##!##.#|#...##*##!#**###!#*#**####################.#!.#|
####.##*#####!#*##*#*#*#*#*#*#*#.#!####!!!##!##|#!##*##!##.########.#####..#!#!##.##...#####..#|#.##*****#!##.##!#**#*##!!!!!!!!!!!!!!#########|
#..#.#!#*#####!#*##*!*!*!*!*!*!#.#!!#.###!!#!*#|###*##!#!!###!#########..##!##!#.####.#...###.#|##*****##!#!##**###**##.#.#.#.#.#.#..#!########|
####.##!#*#####!#*##*#*#*#*#*#*#.##!!##.####!##|##*##!#*##!!####.......##!!###!#.#####..###.#.#|#****##!!!!#!#**#!###...............#!#**##..##|
#..###!#!#*#####!#*###*#*#*#*#*#.###!!!###.#!*#|#*##!###*.##!!!########!!###*#!#.####!#..#.##.#|#**##!!!!####!###!#...###########..#!#!#**##.##|
####**#!###!#####!#*##*#*#*#*#*#.##.##!!!###!##|###!##*##*.####!!!!!!!!##!##*#!##.##!!##..#.#.#|#*#!!!!######!#.#!#.##!!!!!!!!!!#.#!##*!#**####|
#.##.*#!#!!#*#####!#*##*!*!*!*!#.##.#.##!!!#!*#|##!##!#*##*.*#!########!!!##*.#!###!!####.#.#.#|##!!!#####.##!###!##!!########!#.#!#!!#*!#**###|
##!#***#!###*!#####!#*##*#*#*#*#.##.##!#####!##|#!###!##*#.*.##!#####!!##!##*.#!!#!!#.#.##.#..#|#!!!####...###!####!####****#!#..#!##!!#*!#**##|
##!#..*#!#!#*!*#####!#*###*#*#*#.##.####!#*#!*#|#.#.##!#*#*.*.#!#.*##!!!!!##*.*#!!!########...#|#!!#**###...##!###!###******#!#.#!####!########|
#*!#***#!###*!*!##.##!#*##*#*#*#.##.#!!#!#.#!##|######!#*#.*.##!#.*##!###!##*##*#!###.#.#.##..#|#!#*#**###..##!###!#########!#..#!#####*!#*!#*#|
##!#..*#!#!#*!*######*!#*##*!*!####.###!#**#!*#|#.#.#.#!##*.*.#!#.*##!!!!!###**#!##!#########.#|##!!*#**###.###!##!#*******#!#.#!####!#*!#*!#*#|
#*!#***#!###*!##.###!**!#*##*#*#####!!#!#*.#!##|#######!#*.*.##!##########***!*#!#*#!##.#.#.###|##*!!*#**###.##!##!########!#..#!##**!#*#######|
##!#..*#!#!#*######*#!**!#*##*##.#####!#***#!*#|#.#.#.##!#*.*.#!#*********!!!*#!##.*#!#########|#**#*!!*###########!#.....#!###########*!!*#**#|
</CODE>
</DIV>

<!-- '---- Playing area -->
<DIV ID="divGameTable" STYLE="Width:100%; Height:100%; Background-Color:Green; Overflow:Hidden;">
</DIV>

<SCRIPT LANGUAGE="VBScript">

Option Explicit

'-------------------------------------- Globals -----------------------------------------

'---- Bitmap ----
Dim intGFXCard() 'An empty card pixel array that I draw to (71,96)

Dim intGFXNums() 'Number definitions
Dim intGFXSmallSuit() 'Small suit symbols under number
Dim intGFXLargeSuit() 'Large suit symbols for inner card
Dim intGFXAceSpades() 'Ace of Spades
Dim intGFXBack() 'Small repeating pattern for card back
Dim intGFXRoyal() '12 Half-royals (uses reverse to plot bottom half)

Dim intSymPos 'Position array for card symbols 2-10
Dim strGFXPath 'Where to save\load the cards

'---- Gameplay ----
Dim Card(52) '52 <IMGs> setup as game-play like objects (with attributes)
Dim intMouseDragX, intMouseDragY 'For card movement
Dim strSuitName, strNumName, strColName 'Card info in English


'-------------------------------------- Start up -----------------------------------------
Sub Window_OnLoad()

 '---- Set some game texts
 strSuitName = Array("","Spade","Club","Heart","Diamond")
 strNumName = Array("","Ace",2,3,4,5,6,7,8,9,10,"Jack","Queen","King")
 strColName = Array("","Black","Red")

 '---- Build images (only if they don't exist)
 BuildAllCardBitmaps

 '---- Build card objects
 BuildAllCards
 
 '---- Demo of attribute logic. This flips the 8 of clubs if all are true.....
 'If Card(20).Suit=2 And Card(20).Color=1 And Card(20).Number<9 Then Card_Flip Card(20), 1 
End Sub


'--------------------------------- Bitmap creation subs ------------------------------------

'---- Build all the card bitmaps
Sub BuildAllCardBitmaps()
 Dim objFSO, intIndex

 '---- Convert ASCII data to byte arrays (banks)
 GetCardParts cdeNumbers, 7, 2, 11, 14, intGFXNums
 GetCardParts cdeSSuit, 4, 1, 9, 10, intGFXSmallSuit
 GetCardParts cdeLSuit, 4, 1, 15, 15, intGFXLargeSuit
 GetCardParts cdeBack, 1, 1, 7, 7, intGFXBack
 GetCardParts cdeAOS, 1, 1, 39, 39, intGFXAceSpades
 GetCardParts cdeRoyal, 3, 4, 47, 37, intGFXRoyal

 '---- Position table for inner suit symbols, cards 2-10 (1st set of numbers are data pointers)
 intSymPos = Array(9,13,19,27,37,49,63,79,97, _
 28,10, 28,71, _
 28,10, 28,41, 28,71, _
 15,10, 15,71, 41,10, 41,71, _
 15,10, 15,71, 41,10, 41,71, 28,41, _
 15,10, 15,41, 15,71, 41,10, 41,41, 41,71, _
 15,10, 15,41, 15,71, 41,10, 41,41, 41,71, 28,27, _
 15,10, 15,31, 15,50, 15,71, 41,10, 41,31, 41,50, 41,71, _
 15,10, 15,31, 15,50, 15,71, 41,10, 41,31, 41,50, 41,71, 28,39, _
 15,10, 15,31, 15,50, 15,71, 41,10, 41,31, 41,50, 41,71, 28,21, 28,60 )

 '---- Get your temp folder
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 strGFXPath = objFSO.GetSpecialFolder(2) & "\"

 '---- Make 52 card bitmaps and one card back
 For intIndex = 0 To 51 + 1
 If Not objFSO.FileExists(strGFXPath & "HTACards_" & intIndex & ".bmp") Then
 BuildCard intIndex
 SaveCard strGFXPath & "HTACards_" & intIndex & ".bmp"
 End If
 Next
End Sub

'---- Convert string grids to different sized byte arrays
Sub GetCardParts(objBank, intGridXSize, intGridYSize, intWidth, intHeight, intArray)
 Dim intGridX, intGridY, intX, intY, intNext, strLines

 strLines=Split(Replace(objBank.Innertext, " ", ""),"|") '<CODE> boxes replace CR\LF with spaces, nice hur?
 ReDim intArray ((intGridYSize*intGridXSize)-1, intWidth-1, intHeight-1) ' Redim to:- Array(ShapeNumber,X,Y)
 For intGridY=0 To intGridYSize-1
 For intGridX=0 To intGridXSize-1
 For intY=0 To intHeight-1
 For intX=1 To intWidth
 Select Case Mid(strLines((intGridY*intGridXSize*intHeight)+(intY*intGridXSize)+intGridX), intX, 1)
 Case "." : intArray(intNext, intX-1, intY)=0 'White (transparent)
 Case "#" : intArray(intNext, intX-1, intY)=1 'Black
 Case "*" : intArray(intNext, intX-1, intY)=2 'Red
 Case "!" : intArray(intNext, intX-1, intY)=3 'Yellow
 End Select
 Next
 Next
 intNext=intNext+1
 Next
 Next
End Sub

'---- Plot a block of graphics with optional colour override
Sub CardPlot(intBankArray, intShape, intPlotX, intPlotY, intOverrideColor)
 Dim intX, intY, intPX, intPY
 Dim intFlipX1, intFlipX2, intFlipY1, intFlipY2 , intFlipStep

 '---- Always inverse the shape if it's in the bottom half of the card (big time saver)
 If intPlotY>47 Then
 intFlipX1=UBound(intBankArray,2) : intFlipX2=0 'Mirror+flip plot
 intFlipY1=UBound(intBankArray,3) : intFlipY2=0
 intFlipStep=-1
 Else
 intFlipX1=0 : intFlipX2=UBound(intBankArray,2) 'Normal plot
 intFlipY1=0 : intFlipY2=UBound(intBankArray,3)
 intFlipStep=1
 End If

 '---- Start plotting
 For intY=intFlipY1 To intFlipY2 Step intFlipStep
 For intX=intFlipX1 To intFlipX2 Step intFlipStep

 '---- Don't plot colour 0 (white) for semi-transparancy (for overlapping middle symbols in cards 9+10)
 If intBankArray(intShape,intX,intY) Then

 '---- Multi-colour or overide with black\red?
 If intOverrideColor Then
 intGFXCard(intPX+intPlotX, intPY+intPlotY)=intOverrideColor
 Else
 intGFXCard(intPX+intPlotX, intPY+intPlotY)=intBankArray(intShape,intX,intY)
 End If
 End If
 intPX=intPX+1
 Next
 intPX=0 : intPY=intPY+1
 Next
End Sub

'---- Build a full single card bitmap
Sub BuildCard(intCard)
 Dim intSuit, intNum, intColor, intIndex, intX, intY

 '---- Work out suit,suit number and colour from number 0-51
 intSuit = Int(intCard / 13) : intNum = intCard Mod 13
 intColor=1 : If intSuit>1 Then intColor=2 'I know it should be red,black,red,black. Doesn't matter for creation
 
 ReDim intGFXCard(70,95) 'Clear card for drawing (white=0)

 '---- Card front
 If intCard < 52 Then

 '---- Corner numbers & small suit symbols
 CardPlot intGFXNums,intNum,2,4,intColor : CardPlot intGFXSmallSuit,intSuit,2,19,intColor
 CardPlot intGFXNums,intNum,58,78,intColor : CardPlot intGFXSmallSuit,intSuit,60,67,intColor

 '---- Different types of inner-card
 Select Case intNum

 '---- Ace of spades and the other 3
 Case 0
 If intSuit Then
 CardPlot intGFXLargeSuit, intSuit, 28,40, intColor
 Else
 CardPlot intGFXAceSpades, 0, 17,25, 0
 End If
 
 '---- Royals
 Case 10, 11, 12
 intIndex = (intNum-10)+(intSuit*3)
 CardPlot intGFXRoyal, intIndex, 12,11, 0 'Top half
 CardPlot intGFXRoyal, intIndex, 12,48, 0 'Bottom half
 
 '---- All inner-card suit symbols, using position table (cards 2-10)
 Case Else
 For intIndex = 0 To intNum*2 Step 2
 CardPlot intGFXLargeSuit, intSuit, intSymPos(intSymPos(intNum-1)+intIndex), _
 intSymPos(intSymPos(intNum-1)+intIndex+1), intColor
 Next
 End Select

 '---- Or card back (simple repeating pattern)
 ElseIf intCard = 52 Then
 For intY = 0 to 11
 For intX = 0 to 8
 CardPlot intGFXBack, 0, 4+intX*7,  6+intY*7, 0
 Next
 Next
 
 '---- Room for Joker here (next free card = 53)
 End If
End Sub

'---- Save card array as a bitmap
Sub SaveCard(strFilename)
 Dim objFSO, objBMPFile, intIndex, intX, intY, strBMP, strLine

 '---- OS2 1.x BMP header (OS2 is smaller and easier than Windows BMP)
 strBMP="424D00000000000000004A0000000C0000004700600001000400" 
 
 '---- Palette in easy edit format. Uses BGR not RGB! (only 4 colours used, rest are pink)
 strBMP=strBMP & Replace("FFFFFF 000000 0000FF 00FFFF FF00FF FF00FF FF00FF FF00FF" & _
 "FF00FF FF00FF FF00FF FF00FF FF00FF FF00FF FF00FF FF00FF"," ","")
 
 '---- Add card array in hex (upside down)
 For intY=95 To 0 Step-1
 strLine=""
 For intX=0 To 70
 strLine=strLine & Hex(intGFXCard(intX, intY))
 Next
 strBMP=strBMP & strLine & "0" 'Pad out odd sized width with a 0
 Next

 '---- Write strBMP in binary
 Set objFSO=CreateObject("Scripting.FileSystemObject")
 Set objBMPFile=objFSO.OpenTextFile(strFilename, 2, True)
 For intIndex=1 to Len(strBMP) Step 2
 objBMPFile.Write Chr(CLng("&H" & Mid(strBMP, intIndex, 2)))
 Next
 objBMPFile.Close
End Sub

'--------------------------------- Card object subs (Gameplay) ------------------------------------

'---- Create 52 <IMG> objects
Sub BuildAllCards
 Dim intSuit, intNum, intColor, intIndex

 For intIndex = 0 to 51

 '---- Work out suit\number\colour
 intSuit = Int(intIndex / 13) : intNum = intIndex Mod 13
 intColor=1 : If intSuit>1 Then intColor=2

 '---- Create an <IMG>
 Set Card(intIndex)=Document.CreateElement("IMG") : divGameTable.AppendChild Card(intIndex)
 With Card(intIndex)

 '---- Load bitmap
 .SRC = strGFXPath & "HTACards_" & intIndex & ".bmp"

 '---- Positioning
 With .Style
 .Position = "Absolute" : .Width = 71 : .Height = 96
 .Border = "1 Solid Black" 'Saves drawing it in the bitmap (which it used to do)

 '---- Zindex. This will change drastically depending on group movement (not done)
 .Zindex = intIndex + 1 'Make 1-52 for now

 '---- Position using card number and suit as X+Y :-)
 .Left = intNum * 71 : .Top = intSuit * 96
 End With

 '---- Game attributes, all now use proper 1-# instead of 0-#
 .SetAttribute "Deck", intIndex + 1 '1-52, Array index, and needed to reload the bitmap after a flip
 .SetAttribute "Number", intNum + 1 '1-13
 .SetAttribute "Suit", intSuit + 1 '1-4
 .SetAttribute "Color", intColor '1=Black, 2=Red (color not colour, because I'm user friendly)
 .SetAttribute "Flip", 0 '0=Facing up, 1=down
 .SetAttribute "Locked", False

 '---- Debug:- Put the above attribs in the card tooltip
 .Title = "Deck = " & intIndex + 1 & VBCRLF & "Number = " & strNumName(intNum+1) & _
 VBCRLF & "Suit = " & strSuitName(intSuit+1) & VBCRLF & "Color = " & strColName(intColor)

 '---- Events (see below)
 Set .OnDragStart = GetRef("Card_Grab")
 Set .OnDrag = GetRef("Card_Drag")
 Set .OnDragEnd = GetRef("Card_Drop")
 Set .OnDblClick = GetRef("Card_DoubleClick") '<-- Demo flip card
 End With
 Next
End Sub

'---- Set a card facing side (0=face up, 1=face down)
Sub Card_Flip(objCard, intSide)
 If Not objCard.Locked Then '<---- Not needed?
 objCard.Flip = intSide
 If objCard.Flip Then
 objCard.SRC = strGFXPath & "HTACards_52.bmp" 'Face down image
 Else
 objCard.SRC = strGFXPath & "HTACards_" & objCard.Deck-1 & ".bmp" 'Or reload original card
 End If
 End If
End Sub

'------------- Events -------------

'---- Start card drag (if possible)
'This event fires only once before a card drag attempt, so it's a good idea to put any CPU
'intensive card scans, zindex sorting and special-FX here.
Sub Card_Grab()
 If Not Me.Locked Then

 '---- Store mouse coords offset for proper dragging (used in Card_Drag below)
 intMouseDragX=Window.Event.X-Me.Style.PixelLeft
 intMouseDragY=Window.Event.Y-Me.Style.PixelTop

 '---- Store card's original position here!
 'if you make an illegal move then return the card to oldX,oldY (with group?)
 
 '---- Pop card to the front....Doesn't work! ;-)
 'Note:- Needs a full deck zIndex sort, and this would conflict with moving groups of cards....
 'Using a global Zindex and setting it to +1 every time you dragged a card would work, but it
 'would overflow eventually...
 Me.Style.ZIndex = 52

 '---- Add a DX alpha shadow. Much faster than adding it to every card on initialise
 Me.Style.Filter = "ProgID:DXImageTransform.Microsoft.DropShadow"
 Me.Filters(0).Color="#5A000000" 'alpha + Pure black
 Me.Filters(0).OffX = 10 : Me.Filters(0).OffY = 10 'Shadow offset
 End If
End Sub

'---- Drag a single card around the table
Sub Card_Drag()
 If Not Me.Locked Then
 Me.Style.Left = Window.Event.X-intMouseDragX
 Me.Style.Top = Window.Event.Y-intMouseDragY
 End If
End Sub

'---- Drop a card
Sub Card_Drop()

 '---- Now check for:-
 '    Any special "drop zones"
 '    Out-off-bounds areas
 '    Another card you dropped it on

 'Note:- If you open MSPaint you can drop a card into it and edit it! :-D
 '(not sure how to stop this?)
 
 '---- Destroy DX alpha shadow
 Me.Style.Filter = ""
End Sub

'---- Card double-click demo (keep flipping the card)
Sub Card_DoubleClick()
 If Not Me.Locked Then
 If Me.Flip Then
 Card_Flip Me, 0
 Else
 Card_Flip Me, 1
 End If
 End If
End Sub
 

'*** Good luck! (and have fun!) ***

</SCRIPT>
</BODY>
</HTML> 

 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9