Author Topic: Re: Playing Card Clock  (Read 672 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« on: June 09, 2019, 05:27:24 pm »
Clever, takes awhile to see the time.

Just what I needed some playing card images!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Playing Card Clock
« Reply #1 on: June 09, 2019, 06:09:54 pm »
Hey, who gave [banned user] permission to use my image in his app?

Pete
« Last Edit: June 09, 2019, 09:04:00 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Playing Card Clock
« Reply #2 on: June 09, 2019, 06:54:06 pm »
I am using the 64 bit Linux version of QB64 (1.3). Cut and paste code into IDE. Downloaded and moved card image file into the same directory as the "bas" file. (noted case of the filename). Ran the programme and it crashed. Message "Title": Unhandled Error #258. Message: Line: 14 (in main module) - new line - Invalid handle - new line - Continue? Yes No.

Checked QB64 wiki for error codes. #258 Invalid handle. I rechecked the case of the filename and rechecked to make sure the image file was in the same directory. I made sure that the file can be accessed using a graphics editor - file opened, viewed and closed fine - cute Jokers by the way... lol

Is the problem me or is my machine plotting against me?

J
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Playing Card Clock
« Reply #3 on: June 09, 2019, 08:00:25 pm »
I just had a thought about the question being raised,"... to use my image in his app?"

I hope that I am not opening a can-of-worms but... In most cases forums of this type generally assume that all media submitted, unless otherwise stated by the user, would be that all media is at least public domain. As such are free to be used by one and all. If the user submitting the media explicitly does not give permission to use said media, then permission 'must' be sought and the appropriate credit is added to the intended program. If tyhe answer is still, "No." then end of story. Look for public domain media or make it yourself.

Regardless of whether the media is public or owned the best thing to do would be to simply ask if the media can be used.

Please don't shoot the messenger....
Logic is the beginning of wisdom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Playing Card Clock
« Reply #4 on: June 09, 2019, 09:13:30 pm »
It worked for me on 1.3. Are you sure you saved the file with the same file name?

What's interesting is the code can cut the images out and align them. That's really cool.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« Reply #5 on: June 09, 2019, 09:18:29 pm »
I am using the 64 bit Linux version of QB64 (1.3). Cut and paste code into IDE. Downloaded and moved card image file into the same directory as the "bas" file. (noted case of the filename). Ran the programme and it crashed. Message "Title": Unhandled Error #258. Message: Line: 14 (in main module) - new line - Invalid handle - new line - Continue? Yes No.

Checked QB64 wiki for error codes. #258 Invalid handle. I rechecked the case of the filename and rechecked to make sure the image file was in the same directory. I made sure that the file can be accessed using a graphics editor - file opened, viewed and closed fine - cute Jokers by the way... lol

Is the problem me or is my machine plotting against me?

J

Hi Johnno,

With your brand new QB64 v1.3, you might have to put a bullet by "Output EXE to Source Folder"

Menu > Run >  "Output EXE to Source Folder"   or    Alt + R + F


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« Reply #6 on: June 09, 2019, 09:24:47 pm »
I just had a thought about the question being raised,"... to use my image in his app?"

I hope that I am not opening a can-of-worms but... In most cases forums of this type generally assume that all media submitted, unless otherwise stated by the user, would be that all media is at least public domain. As such are free to be used by one and all. If the user submitting the media explicitly does not give permission to use said media, then permission 'must' be sought and the appropriate credit is added to the intended program. If tyhe answer is still, "No." then end of story. Look for public domain media or make it yourself.

Regardless of whether the media is public or owned the best thing to do would be to simply ask if the media can be used.

Please don't shoot the messenger....

Hi Johnno,

I don't think this a problem if you use sources for your entertainment only and the stuff is posted publically on a forum without mentioning restrictions.

I am planning on using [banned user]'s deck image unless he objects or unless you have better :)

BTW I used your name in a certain Blackjack game, do you want royalties? OK, Sir Johhno!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« Reply #7 on: June 09, 2019, 11:22:24 pm »
Here is some code I setup to use [banned user]'s image, preparing for Blackjack mod:
Code: QB64: [Select]
  1. _TITLE "Deck Images" 'B+ 2019-06-09 using [banned user]'s Deck Image code
  2.  
  3. CONST xmax = 1000, ymax = 600
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5.  
  6. TYPE CardType
  7.     ID AS INTEGER
  8.     cname AS STRING
  9.     value AS INTEGER
  10.     suit AS INTEGER
  11.     points AS INTEGER
  12. DIM SHARED Deck(1 TO 52) AS CardType
  13. DIM SHARED CardDeck AS LONG
  14.  
  15. loaded = loadCardImages
  16. IF loaded = 0 THEN PRINT "PlayingCards.png failed to load, bye!": END
  17.  
  18. initDeck
  19. shuffle
  20. FOR suit = 0 TO 3
  21.     FOR v = 1 TO 13
  22.         i = i + 1
  23.         ShowCard (v - 1) * 76 + 5, suit * 100 + 10, Deck(i).value - 1, Deck(i).suit
  24.     NEXT
  25.  
  26. FOR i = 1 TO 5
  27.     deckIndex = deckIndex + 1
  28.     showCardDI i * 150 + 20, 420, deckIndex
  29.     _PRINTSTRING (i * 150 + 20, 530), Deck(deckIndex).cname
  30.     _PRINTSTRING (i * 150 + 20, 550), STR$(Deck(deckIndex).points)
  31.  
  32.  
  33. SUB initDeck
  34.     DIM suit$(3)
  35.     suit$(0) = "Hearts": suit$(1) = "Clubs": suit$(2) = "Diamonds": suit$(3) = "Spades"
  36.     DIM v$(1 TO 13)
  37.     v$(1) = "Ace": v$(11) = "Jack": v$(12) = "Queen": v$(13) = "King"
  38.     FOR i = 2 TO 10
  39.         v$(i) = _TRIM$(STR$(i))
  40.     NEXT
  41.     i = 0
  42.     FOR s = 0 TO 3
  43.         FOR v = 1 TO 13
  44.             i = i + 1
  45.             Deck(i).ID = i
  46.             Deck(i).cname = v$(v) + " of " + suit$(s)
  47.             Deck(i).value = v
  48.             Deck(i).suit = s
  49.             IF v < 11 THEN Deck(i).points = v ELSE Deck(i).points = 10
  50.         NEXT
  51.     NEXT
  52.  
  53. SUB shuffle
  54.     FOR i = 52 TO 2 STEP -1
  55.         r = INT(i * RND) + 1
  56.         SWAP Deck(i), Deck(r)
  57.     NEXT
  58.  
  59. SUB showCardDI (x AS INTEGER, y AS INTEGER, deckI AS INTEGER)
  60.     ShowCard x, y, Deck(deckI).value - 1, Deck(deckI).suit
  61.  
  62. 'at scale = 2 need screen space of 76 x 100 for one card
  63. SUB ShowCard (ScrnX, ScrnY, imageCol, imageRow) 'screen x, y  h= horizontal  , v =vertical  image h, v
  64.     ch = 38 * imageCol + 1: cv = 51 * imageRow + 1: scale = 2
  65.     _PUTIMAGE (ScrnX, ScrnY)-STEP(38 * scale, 50 * scale), CardDeck, 0, (ch, cv)-(ch + 37, cv + 50)
  66.  
  67. FUNCTION loadCardImages%
  68.     CardDeck = _LOADIMAGE("PlayingCards.png")
  69.     IF CardDeck = -1 THEN EXIT FUNCTION
  70.     _SOURCE CardDeck
  71.     _CLEARCOLOR POINT(0, 0), CardDeck
  72.     _SOURCE 0
  73.     loadCardImages% = -1
  74.  


Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Playing Card Clock
« Reply #8 on: June 10, 2019, 02:06:00 am »
Bplus... Yeah... You were right... I forgot to tag the 'output exe'... again...

J

ps: Royalties are not required... lol
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« Reply #9 on: June 10, 2019, 09:31:27 am »
Hi [banned user],

Clock 2 much more readable, maybe the back of a card for colons to distinguish from Jokers = 0, those card backs are nice! Particularly the ones with suit symbol outlines. Also I would put the 0's - Joker on the left of the 1 digit numbers.
« Last Edit: June 10, 2019, 10:03:27 am by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Playing Card Clock
« Reply #10 on: June 10, 2019, 12:24:02 pm »
Hi [banned user],

Clock 2 much more readable, maybe the back of a card for colons to distinguish from Jokers = 0, those card backs are nice! Particularly the ones with suit symbol outlines. Also I would put the 0's - Joker on the left of the 1 digit numbers.

No, no, no! It goes, "Clowns to the left of me, jokers to the right!"

How about a screen shot? I'm just not into downloading folders right now.

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« Reply #11 on: June 10, 2019, 01:48:06 pm »
The time is wrong to show 0 = joker but it is in code when there is a zero call ShowCard last parameter is 4, suits go 0 to 3, so 4 is the joker row.

I thought I saw jokers on left side for a 1 digit hour or minute ?? It might have been my damaged brain acting up again from using BASIC.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Playing Card Clock
« Reply #12 on: June 10, 2019, 02:02:22 pm »
Well, no matter. I don't think I'll be "dealing" with a card clock anytime, soon.

Pete :D
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Playing Card Clock
« Reply #13 on: June 10, 2019, 05:57:20 pm »
Hi [banned user],

How about a Card Playing Clock?

:)

Offline keybone

  • Forum Regular
  • Posts: 116
  • My name a Nursultan Tulyakbay.
    • View Profile
Re: Playing Card Clock
« Reply #14 on: June 13, 2019, 12:53:44 pm »
Very nicely done, maybe next time you can try UNO cards. haha
I am from a Kazakhstan, we follow the hawk.