Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 18, 2019 8:17 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Making a Card Game with Cards.dll
PostPosted: Mon Nov 14, 2005 11:42 pm 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
Have you ever found yourself wondering how to make a card game, but don't want to go through all the hassles of making the graphics and putting all the logic into drawing cards? Then you're a lot like me! There are a lot of fun card games out there that I want to make (because I never seem to find them in commercial products -- like War and Pyramid Solitaire), but I'm a terrible artist. However, I've always found that it's better to avoid reinventing the wheel whenever possible -- and Microsoft has been kind enough to put all the legwork into card games for you!

I've concocted a tutorial on how to implement the graphics for a card game using Microsoft's Cards.dll file (installed already on every version of Windows that REALbasic supports). Additionally, I've created an example project that takes this knowledge and puts it to use by making the game "War." You can find the project on my website:

http://www.aaronballman.com/programming/REALbasic/Cards.php

Enjoy!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 16, 2005 7:53 pm 
Offline

Joined: Thu Oct 06, 2005 7:56 pm
Posts: 66
So how does it work? Is it compiled into your project standalone or does the Cards.dll file need to be installed on the users computer already?

You can just scan a 2-10 card and just edit in new text and then scan the 18 cards for aces and royalty. The whole thing can be done with just two scans. I think I'll put my trust in those rather than in some Microsoft gobbledegook.

_________________
Its not about dying for your country, its about making the other guy die for his!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 17, 2005 5:45 pm 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
The cards.dll file is already installed on every version of Windows that REALbasic compiles for. You're certainly welcome to scan in your own graphics and use those -- this is simply using the system facilities.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 17, 2005 10:08 pm 
Offline

Joined: Sun Nov 06, 2005 9:53 am
Posts: 35
While a good idea for Windows users, it won't, as far as I know, cross-compile to Mac and Linux.

Quote:
and Microsoft has been kind enough

Haha. I love that! But you always do such quality work, Aaron. Nice job with that tutorial.

I'm writing a Poker game in Java in my spare time, just to get a feel for the language. I like the idea of scanning cards. And I was going to go try to draw them. Wow. You just saved me a ton of time. Thanks Jarab.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Nov 18, 2005 1:01 am 
Offline

Joined: Mon Oct 03, 2005 11:53 pm
Posts: 670
Location: Loves Park, IL
Yeah it could - you'd just have to supply some other means to get the same stuff the particular .DLL has.

Wayne C. Winquist

_________________
Wayne C. Winquist

Not Wayne's World Wordpress
Not Wayne's World MySpace!
Not Wayne's World Yahoo! 360


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Nov 26, 2005 10:20 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Windows Users Only! Download REALbasic source code for a simple card trick program accessing the Windows file cards.dll. This program "piggy-backs" on the cards.rbp program by Aaron Ballman. His program is based on the card game "War," as he said, whereas my adaptation of his code is a simple card trick described in a chapter in Martin Gardner's book Magic, Mathematics, and Mystery.

It's a simple trick. Twenty-seven cards are dealt face-up into three columns. The spectator is asked to secretly select a card and then to indicate the column in which the card appears. The cards are picked up and re-dealt into three columns. The spectator is asked in which column his card appears now. The cards are dealt a third time with the same question, and then the computer reveals the selected card. Not a very spectacular trick, but the source code does show how one person's code might be adapted for a rather different purpose. Perhaps it may inspire you to write a much better program than mine. You may even learn something from this sample program (even if it's how NOT to code). Who knows? Try it out and see!

P.S. Here's where you can find the original project by Aaron Ballman:

http://www.aaronballman.com/programming/REALbasic/Cards.php

Here's basically where to go for my simple card trick program in RB:

http://traver.org/rb/cardtrick/

Here's the REALbasic source code for my simple card trick, if you want it:

http://traver.org/rb/cardtrick/cardtrick.rbp (77 KB)

Here's the card trick as a Windows executable program if you want to avoid having to compile it:

http://traver.org/rb/cardtrick/cardtrick.exe (2,491 KB)

And here's the card trick as a Windows executable program in zip format:

http://traver.org/rb/cardtrick/cardtrick.zip (825 KB)

Enjoy!

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 20, 2006 4:30 pm 
Offline

Joined: Mon Nov 20, 2006 4:16 pm
Posts: 1
stratus wrote:
While a good idea for Windows users, it won't, as far as I know, cross-compile to Mac and Linux.


I'm writing a Poker game in Java in my spare time, just to get a feel for the language. I like the idea of scanning cards. And I was going to go try to draw them. Wow. You just saved me a ton of time. Thanks Jarab.



still sounds complicated! do you have to invest lots of time?

i for myself am very happy for being able to play poker via internet, hence otherwise very unskillfull with the pc :oops:
my favorite site at the moment is http://www.pokerstrategy.org.uk

dont know what i would do without :wink:


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 21, 2008 7:36 pm 
Offline

Joined: Fri Oct 28, 2005 1:03 pm
Posts: 243
Bringing this back from the dead . . .

I've been working on a card game in RB, but it would play better with Jokers. Any idea how to add them in? Thanks.

_________________
RS2012r2 on Windows 7.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 22, 2008 5:20 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:53 pm
Posts: 3261
Location: England
No idea I'm afraid.

I don't know if cards.dll has gone missing from Vista but if I run this
if System.IsFunctionAvailable( "cdtInit", "Cards" ) then
MsgBox "cards available"
else
MsgBox "not available"
end if
I get "not available"

_________________
Steve Garman
Using REALbasic 2008r2 Professional on Windows Vista Ultimate
and REALbasic 2009r5.1 Professional on Linux Ubuntu 9.04 Desktop
and REAL Studio 2010r1 Personal on Linux Ubuntu 9.10 Desktop
Occasional blog


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 22, 2008 2:57 pm 
Offline

Joined: Fri Oct 28, 2005 1:03 pm
Posts: 243
Interesting. I'm still using XP, so I haven't run into this issue. Is Aaron around and still reading this forums? If not, I may try to drop him a line and see if he has any ideas.

I have .png of the jokers, but I don't know how to work them into the deck.

_________________
RS2012r2 on Windows 7.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 22, 2008 3:18 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
He does read from time to time

Does the GetDeck function return a deck that includes jokers at all ?


Oh ... and the DLL does not seem to exist on Vista


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 22, 2008 7:36 pm 
Offline

Joined: Fri Oct 28, 2005 1:03 pm
Posts: 243
No, it just builds a deck by suit and number. It does not include the jokers. There are decks online that contain jokers, but I'm not quite sure how to implement them. I can always create a fake card that refers to the joker, but I don't know how to take the joker.png and have the card draw correctly without doing some nasty workaround hacks that would take forever.

_________________
RS2012r2 on Windows 7.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 23, 2008 5:34 pm 
Offline

Joined: Fri Oct 28, 2005 1:03 pm
Posts: 243
I think I'm gonna go with Plan B: I'll download pngs of all the cards (including jokers) and just build my own classes for this. I may have to rewrite some of the code, but hopefully this shouldn't take too long.

_________________
RS2012r2 on Windows 7.


Top
 Profile  
Reply with quote  
 Post subject: Re: Making a Card Game with Cards.dll
PostPosted: Tue Feb 17, 2009 12:16 pm 
Offline

Joined: Thu Feb 28, 2008 7:44 pm
Posts: 52
Hello,

I hate to ask such a question, but newbies must be allowed to ask. Is a dll only able to be utilized with the operating system on which it was developed??

I was thinking dlls were machine code binaries, that as long as the software calling to the dll used the proper syntax, the code would function, provided the hardware could handle it. By that I mean, no call to the OS by the dll, only lower level BIOS type calls. I thought these things were supposed to be fast machine language subroutines??

Next question: If one owns a copy of XP. And if, the dll can be called and used separate of the operating system, is this legal to use on ones own machine?

Last question, and I don't want anyone in legal land to go nuts, but, I take it that dlls are fully copyrighted material and can not be disseminated?

Thanks for any opinions and thoughts.

Dan


Top
 Profile  
Reply with quote  
 Post subject: Re: Making a Card Game with Cards.dll
PostPosted: Tue Feb 17, 2009 1:22 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
astrodan wrote:
Hello,

I hate to ask such a question, but newbies must be allowed to ask.

You bet!

Quote:
Is a dll only able to be utilized with the operating system on which it was developed??

That is correct. dll's are dependent on the OS. You can look at them as snippets of .EXE code that have been packaged separately and that you can interact with. But a Windows .exe will not run on a Mac or on Linux, so neither will a Windows .dll. Same goes for the other platforms. Library code is OS specific. Now, some dll's will run on multiple versions of Windows (98, NT, XP), but others will not. It depends on what features of the OS they use.

Quote:
I was thinking dlls were machine code binaries, that as long as the software calling to the dll used the proper syntax, the code would function, provided the hardware could handle it. By that I mean, no call to the OS by the dll, only lower level BIOS type calls. I thought these things were supposed to be fast machine language subroutines??

No, dll's call through to the OS, not the BIOS, in almost all cases. The OS is there to be the intermediary between user code and the hardware. dll's are more like user code in this regard.

Quote:
Next question: If one owns a copy of XP. And if, the dll can be called and used separate of the operating system, is this legal to use on ones own machine?

Last question, and I don't want anyone in legal land to go nuts, but, I take it that dlls are fully copyrighted material and can not be disseminated?

You should treat them like any .exe; the same rules apply. They are licensed by somebody, and that license dictates how they can be used.

Tim


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group