Author Topic: 🎄🎁✨ Holiday Season - are you ready to code?  (Read 39121 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #45 on: December 10, 2020, 09:31:06 pm »
Thanks, @Petr.  Nice spinning Star, @OldMoses.  I like the your spinning ornaments, @SierraKen.  Hey, I like everything posted here. Nice tree up there especially, @bplus.

I'm trying to come up with a way to make mine a folded card at the beginning, then when you click on it to open, it unfolds like a card showing the drawing screen and plays - like those store bought cards do.

- Dav

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #46 on: December 10, 2020, 11:48:32 pm »
Yeah Ken yours is super, fun to compare to your first :)

Old Moses, I am glad someone thought to bring in a star!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #47 on: December 13, 2020, 01:05:22 pm »
Hi guys, and here is my output. It is bigger source code and forum can not load it. It is my Christmas 2020 theme program.

* Holidays2020-2.bas (Filesize: 1.9 MB, Downloads: 316)
« Last Edit: December 13, 2020, 01:59:01 pm by Petr »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #48 on: December 13, 2020, 01:44:39 pm »
Hi Petr,

The program downloaded fine but did not run. It was expecting 'mp3' and 'font' files...

J
Logic is the beginning of wisdom.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #49 on: December 13, 2020, 01:48:24 pm »
OK. Source code upgraded, font is now in the source code.  Try it again, please.  It is running correctly under Windows. (previous version also)
« Last Edit: December 13, 2020, 02:07:55 pm by Petr »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #50 on: December 13, 2020, 02:53:31 pm »
Petr, that's totally amazing. I never knew so many sounds can be put into one program like that. And your 3D is always incredible. Great job!

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #51 on: December 13, 2020, 05:10:56 pm »
Well done, @Petr!   Enjoyable.  I like the screen fading, and the audio fading with the scene makes it more realistic.  I never get tired of listening to Silent Night.  And the cracking firewood sound in background gives the scene a warmer feeling.

For some reason the program crashes for me during Silent night playback, I get this error alert message: gluBuild2DMipmaps failed.  So I haven't made it through the whole program, but what I can see I like very much.

I'm using Windows7-32bit, QB64-GL v1.4 32bit.

- Dav

« Last Edit: December 13, 2020, 05:11:57 pm by Dav »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #52 on: December 13, 2020, 06:04:32 pm »
+1 Wow nice production Petr!

My system played Silent Night at least 3 times, Windows laptop 64 bit QB64 v1.4 stable.

Feliz Navidad :)

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #53 on: December 13, 2020, 09:33:57 pm »
Petr
Excellent!!!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #54 on: December 14, 2020, 12:48:17 pm »
Hi i find memory leak in my program. Please goto row 1192 and find "_FREEIMAGE virt" on row 1197. Add to row 1198 this:  _FREEIMAGE Ve(TVO_S + 13).T    so  as in this short program list:


    TeVe(4).T = 0
    TeVe(4).T = _COPYIMAGE(virt, 33)
    TeVe(4).S = 1

    _DEST pred
    _FREEIMAGE virt
   
_FREEIMAGE Ve(TVO_S + 13).T
    Cube3D -.5, 0, 2.8, .7, .5, .1, 0, TeVe(), coordinates()
    INARR coordinates(), Ve(), TVO_S

END SUB

SUB Krb
    FOR S = 1 TO 6
        Sofa(S).T = KRB_textura&



memory usage now is cca 206 megabytes. I find no more bugs (just chaotic programming).
« Last Edit: December 14, 2020, 12:53:03 pm by Petr »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #55 on: December 14, 2020, 01:04:02 pm »
I fixed it Petr, thanks.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #56 on: December 14, 2020, 04:04:53 pm »
Here is another one from me. It shows snow falling on a hill that piles up a bit, and also onto a Christmas Tree on top of the hill.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. DIM sx(600), sy(600), rr(600)
  3. DIM stackx(2000), stacky(2000), stackr(2000)
  4. size = 1
  5. _TITLE "Merry Christmas!!!"
  6.     _LIMIT 100
  7.     cx = 400: cy = 1100: r = 700: c = _RGB32(127, 255, 127)
  8.     fillCircle cx, cy, r, c
  9.     'Christmas Tree
  10.     tx = 390: ty = 400: r = 10: c = _RGB32(255, 0, 0)
  11.     LINE (tx, ty)-(tx + 20, ty - 75), _RGB32(183, 127, 127), BF
  12.     'left side
  13.     LINE (tx, ty - 75)-(tx - 150, ty - 75), _RGB32(127, 255, 127)
  14.     LINE (tx - 150, ty - 75)-(tx, ty - 150), _RGB32(127, 255, 127)
  15.     cx = tx - 150: cy = ty - 75
  16.     fillCircle cx, cy, r, c
  17.     LINE (tx, ty - 150)-(tx - 100, ty - 150), _RGB32(127, 255, 127)
  18.     LINE (tx - 100, ty - 150)-(tx, ty - 200), _RGB32(127, 255, 127)
  19.     cx = tx - 100: cy = ty - 150
  20.     fillCircle cx, cy, r, c
  21.     LINE (tx, ty - 200)-(tx - 50, ty - 200), _RGB32(127, 255, 127)
  22.     LINE (tx - 50, ty - 200)-(tx + 5, ty - 250), _RGB32(127, 255, 127)
  23.     cx = tx - 50: cy = ty - 200
  24.     fillCircle cx, cy, r, c
  25.     'right side
  26.     LINE (tx + 20, ty - 75)-(tx + 170, ty - 75), _RGB32(127, 255, 127)
  27.     LINE (tx + 170, ty - 75)-(tx + 20, ty - 150), _RGB32(127, 255, 127)
  28.     cx = tx + 170: cy = ty - 75
  29.     fillCircle cx, cy, r, c
  30.     LINE (tx + 20, ty - 150)-(tx + 120, ty - 150), _RGB32(127, 255, 127)
  31.     LINE (tx + 120, ty - 150)-(tx + 20, ty - 200), _RGB32(127, 255, 127)
  32.     cx = tx + 120: cy = ty - 150
  33.     fillCircle cx, cy, r, c
  34.     LINE (tx + 20, ty - 200)-(tx + 70, ty - 200), _RGB32(127, 255, 127)
  35.     LINE (tx + 70, ty - 200)-(tx + 5, ty - 250), _RGB32(127, 255, 127)
  36.     cx = tx + 70: cy = ty - 200
  37.     fillCircle cx, cy, r, c
  38.     cx = tx + 5: cy = ty - 260
  39.     r = 10
  40.     c = _RGB32(255, 255, 127)
  41.     fillCircle cx, cy, r, c
  42.     tt = INT(RND * 100) + 1
  43.     IF tt > 95 THEN
  44.         a = a + 1
  45.         IF a > 500 THEN a = 1
  46.         sx(a) = RND * _WIDTH
  47.         sy(a) = 1
  48.         rr(a) = RND * 5
  49.     END IF
  50.     FOR t = 1 TO 500
  51.         sy(t) = sy(t) + 1
  52.         cx = sx(t): cy = sy(t)
  53.         r = rr(t)
  54.         c = _RGB32(255, 255, 255)
  55.         fillCircle cx, cy, r, c
  56.         IF POINT(sx(t), sy(t) + rr(t) + 1) = _RGB32(127, 255, 127) THEN GOTO stacked:
  57.         IF POINT(sx(t), sy(t) + rr(t) + 1) = _RGB32(255, 255, 127) THEN GOTO stacked:
  58.         IF POINT(sx(t), sy(t) + rr(t) + 1) = _RGB32(255, 0, 0) THEN GOTO stacked:
  59.     NEXT t
  60.     nex:
  61.     IF snow <> 0 THEN
  62.         FOR sn = 1 TO snow
  63.             cx = stackx(sn)
  64.             cy = stacky(sn)
  65.             r = stackr(sn)
  66.             c = _RGB32(252, 252, 252)
  67.             fillCircle cx, cy, r, c
  68.         NEXT sn
  69.     END IF
  70.     _DISPLAY
  71.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0), BF
  72.  
  73. stacked:
  74. snow = snow + 1
  75. IF snow > 1800 THEN snow = 1: size = 1
  76. IF snow / 200 = INT(snow / 200) THEN size = size * 1.4
  77. stackx(snow) = sx(t)
  78. stacky(snow) = sy(t) - (size / 2)
  79. stackr(snow) = rr(t) + size
  80. sx(t) = -200: sy(t) = 800
  81. GOTO nex:
  82.  
  83. 'from Steve Gold standard
  84. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  85.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  86.     DIM X AS INTEGER, Y AS INTEGER
  87.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  88.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  89.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  90.     WHILE X > Y
  91.         RadiusError = RadiusError + Y * 2 + 1
  92.         IF RadiusError >= 0 THEN
  93.             IF X <> Y + 1 THEN
  94.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  95.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  96.             END IF
  97.             X = X - 1
  98.             RadiusError = RadiusError - X * 2
  99.         END IF
  100.         Y = Y + 1
  101.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  102.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  103.     WEND
  104.  

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #57 on: December 14, 2020, 04:34:46 pm »
Nice one, @SierraKen.

@Petr: That fixed it for me.  Nice Christmas demo you made.

- Dav

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #58 on: December 14, 2020, 05:02:37 pm »
@SierraKen Nice work!
@Dav I'm glad it's okay now :)

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #59 on: December 14, 2020, 05:20:15 pm »
Made a little ornament thing.  Draws random color ornament balls like you see on Christmas trees around here.  Nothing great, I just felt like making something.

- Dav

Code: QB64: [Select]
  1. '=============
  2. 'Ornaments.bas
  3. '=============
  4. 'Draws random Christmas ornaments
  5. 'Coded by Dav, DEC/2020
  6.  
  7. SCREEN _NEWIMAGE(600, 600, 32)
  8.  
  9.     x = RND * _WIDTH: y = RND * _HEIGHT 'random x/y
  10.     size = 50 + RND * 50 'random size ornament
  11.  
  12.     'select random ornament color,red,greem or blue
  13.     SELECT CASE INT(RND * 3) + 1
  14.         CASE 1: r = (RND * 100) + 155: g = 100: b = 100 'red
  15.         CASE 2: g = (RND * 100) + 155: r = 100: b = 100 'green
  16.         CASE 3: b = (RND * 100) + 155: r = 100: g = 100 'blue
  17.     END SELECT
  18.  
  19.     ball x, y, size, r, g, b
  20.  
  21.     _LIMIT 30
  22.  
  23.  
  24. SUB ball (x, y, size, r, g, b)
  25.     'draws a gradient ball
  26.     FOR s = 1 TO size STEP .5
  27.         CIRCLE (x, y), s, _RGB(r, g, b)
  28.         r = r - 1: g = g - 1: b = b - 1
  29.     NEXT
  30.     'Draw top of ornament
  31.     LINE (x - 10, y - size - 10)-(x + 10, y - size), _RGB(r, g, b), BF
  32.