The BCX Aquarium by MrBcx

Started by MrBcx, September 06, 2023, 11:44:37 PM

Previous topic - Next topic

MrBcx

This graphics example took me about a week to program but also in
that time, I needed to work on BCX 8.0.5, BED, and BINBAS for BCX.

This app requires BCX Version 8.0.5 to correctly translate. 

It compiles as a GUI with all the usual compilers.  It is dead simple in BED.

I wrote it as a kind of stress test for the new BCX_BLIT commands
that I added to BCX 8.0.5.

Everyone has seen programs like this, most better than mine, but
mine compiles to about 350 kb using Pelles C v12. That size includes
five embedded bmp files and one embedded jpg file.
  So, not too shabby.

Also, this program's source code is unusually large in size (1.3M).  That's
because I wanted to stress test and showcase one of my other new
programs, BINBAS for BCX.  BINBAS will convert -any-
file to an embeddable hex file with a re-assembler that you can use in your
own programs.  It too is dead simple.  BINBAS provides a way to reduce the
need for linking resource files.  All of the graphics used in BCX Aquarium are
inside this one BCX Basic source file.

You do not need BINBAS to build and run this file.

I hope everyone takes some time to download, translate, compile,
and run this example program.  If you use BED, you can literally
download just one file, load it into BED, and compile it as a GUI
and run it.

Do yourself a favor and check out the source code.
You might find something that inspires you to make something new.

The BCX Aquarium starts off in 1024 x 720 but you can stretch the sides
and double click to go full screen and back to windowed.  The source file
has a good amount of comments and is organized in a way that should be
easy to understand. 

Programming can still be fun but you have to keep your chops up and practice.

~MrBcx~


MrBcx

#1
Here is a video overview of the BCX Aquarium:

https://bcxbasiccoders.com/bcxusers/mrbcx/Aquarium.mp4

The recording software degrades the video slightly, but if you build and
run it on your computer, it will look a lot better than this video.

Have fun!

-----------------------------------------------------------------------------
Here is a minor update to the bubble machine that uses the TIMER function
which should give a consistent response on slow and fast CPU's alike:

        '======================================================================
        '                          Bubble Simulation Loop
        '======================================================================
        CONST IMPEDENCE = 0.04
        STATIC AS SINGLE sngStart
        sngStart = TIMER

        FOR INT i = 1 TO 100
            DIM RAW BubbleX AS INTEGER
            DIM RAW BubbleY AS INTEGER
            DIM RAW BubbleRadius AS INTEGER
            BubbleX = RND2(MAXX-100, MAXX)          ' Adjust WindowWidth with your aquarium's width
            BubbleY = RND2(10, MAXY)                ' Fixed height of the aquarium window
            BubbleRadius = RND2(1, 11)              ' Adjust the range for bubble size
            DrawBubble(BubbleX,   BubbleY, BubbleRadius)
            DrawBubble(BubbleX-1, BubbleY, BubbleRadius)
            DrawBubble(BubbleX+1, BubbleY, BubbleRadius)
            WHILE (TIMER < (sngStart + IMPEDENCE)) AND (TIMER >= sngStart) ' Slow the bubbles a bit
            WEND

        NEXT
        BCX_BUFFER_STOP(Form1)
        SLEEP(20)
    LOOP
END SUB



MrBcx

Hard to believe it's been a year since I first wrote this.

Today I added smooth background scrolling to the aquarium with only 5 new lines of code.

I added a new 2K background image (jpg), so the resulting exe will be a little larger when you compile this.


MrBcx

#3
For those who prefer plants instead of coral, here's another version ...


dragon57

I thought scientists said we need all the coral we can get. (jk)

Great stuff!