realbasic-games
[Top] [All Lists]

Re: [Ann] Making a Card Game with Cards.dll

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: [Ann] Making a Card Game with Cards.dll
From: Barry Traver <rb at ix dot netcom dot com>
Date: Tue, 15 Nov 2005 23:16:03 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <4379669E dot 3070301 at realsoftware dot com>
Aaron,

I've run into one small problem (probably because I don't really understand how graphics work).

I've figured out how to use x, y, cx, cy, md, bk, CardNumber, Rank, Suit, etc., etc., in your sample War card game program, but what I can't figure out is how to handle the hdc (handle for device context) <sigh>.

What I want to do is something very simple: someone clicks on a PushButton, and the Ace of Spades appears in a certain location on the screen. If I can figure out how to do that much, I can do anything else I need to do at this point to port over the card trick program and to write some other fun programs (including some simple solitaire programs)..

I'm not sure which "Draw" method to use, but whichever one it is, it will involve passing a value for hdc. I've figured out that I need to use Hacks.HDCFromGraphics(g) to get a value for hdc, but I don't know what to do about the "g." How do I get a value for "g"?? In the program, I note that it always seems to come into a Sub as a passed parameter, but I can't seem to see anything on the outside of the Sub that is passing anything in. Example: the Paint event handler. The Paint event isn't called by code; it "just happens."

I'm probably missing something very fundamental here. I panic over graphics. Other types of things that you mentioned in your article I can do. For example, I didn't understand the graphics in William Yu's addictive Shisen-So either, but that didn't stop me from adding a high score feature, the ability to save and reload games, the ability to go back a step at a time (all the way to the beginning, if desired) or, having gone back, to go forward again, etc.

But I have trouble following what's going on with "g for graphics," partly because when you see changes on the screen, often the code that caused the changes really was executed a while back, often in a totally different Method. Thus stepping through the code one step of time, watching to see what happens when a particular line is executed, often doesn't reveal much. (And "refresh"? Sometimes it apparently erases the screen, whereas at other times it makes visible things that have already been prepared. I don't get it.)

But I can get a lot of mileage out of knowing how to do relatively simple things, such as making a particular card visible at a particular location. Any assistance toward that end - from you or from any others here - will be much appreciated. It's probably pretty elementary stuff to many here, but not so for me.

Barry Traver


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>