Hello, I am currently working on a Blackjack game for class, and it has gone smoothly up until now. I am having troubles with "Me.Creategraphics", as when I try to draw a card to the screen, it only draws a portion, no matter what I set the destination rectangle size to. I must be overlooking something, because I tried a to draw a card to the screen using the same exact code as I was using in my game with another project, and it worked fine. Below is my code for drawing the cards:
I know the dRect points are a little sloppy, but they still do lie on the screen. So what is my error? What am I missing? I have attatched the project in a .zip file if you want to take a look at that too, but I'm pretty sure this is all that needs to be looked at.
Also, it only seems to draw the portion of the card for player 3 (cpu 2), and I'm completely unsure as to why.
Thanks in advance,
- Dinosaurus
Code:
Dim cardSiz as New Size(168, 243)
Private Sub placeCard(ByVal plr As Short)
Dim pnt As New Point
Select Case plr
Case 1 'PLAYER
pnt = New Point((Me.Width / 2 - cardWid) + ((plr1Crd) * (cardWid / 2)), (Me.Height / 4) * 3)
dRect = New Rectangle(pnt, cardSiz)
Case 2 'CPU1, LEFT SIDE
pnt = New Point(20 + ((cpu1Crd) * (cardWid / 4)), (Me.Height / 4) * 3)
dRect = New Rectangle(pnt, cardSiz)
Case 3 'CPU2, TOP
pnt = New Point((Me.Width / 2 - cardWid) + ((cpu2Crd) * (cardWid / 4)), (Me.Height / 4))
dRect = New Rectangle(pnt, cardSiz)
Case 4 'CPU3, RIGHT SIDE
pnt = New Point((Me.Width - 20) - ((cpu3Crd) * (cardWid / 4)), (Me.Height / 4) * 3)
dRect = New Rectangle(pnt, cardSiz)
End Select
End Sub
Private Sub drawCard(ByVal plr As Short, ByVal num As Short, ByVal suit As Short)
Select Case plr
Case 1
Dim pnt As New Point(num * cardWid, suit * cardHgt)
sRect = New Rectangle(pnt, cardSiz)
Case Else
Dim pnt As New Point(2 * cardWid, 4 * cardHgt)
sRect = New Rectangle(pnt, cardSiz)
End Select
G.DrawImage(cardsImg, dRect, sRect, GraphicsUnit.Pixel)
End Sub
Also, it only seems to draw the portion of the card for player 3 (cpu 2), and I'm completely unsure as to why.
Thanks in advance,
- Dinosaurus