diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 47545a2..c8c0fa7 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -19,3 +19,12 @@ add_subdirectory(vga_monoscope) add_subdirectory(vga_oscilloscope) add_subdirectory(vga_pacman) add_subdirectory(vga_pi) +add_subdirectory(vga_pixels) +add_subdirectory(vga_raytrace) +add_subdirectory(vga_sokoban) +add_subdirectory(vga_spheres) +add_subdirectory(vga_spots) +add_subdirectory(vga_tetris) +add_subdirectory(vga_train) +add_subdirectory(vga_twister) +add_subdirectory(vga_watersurface) diff --git a/examples/vga_pixels/CMakeLists.txt b/examples/vga_pixels/CMakeLists.txt index a3cbe19..116f486 100644 --- a/examples/vga_pixels/CMakeLists.txt +++ b/examples/vga_pixels/CMakeLists.txt @@ -1,22 +1,16 @@ -add_executable(vga_balloons +add_executable(vga_pixels src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_pixels) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_pixels PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_pixels) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +# pico_enable_stdio_usb(vga_pixels 1) \ No newline at end of file diff --git a/examples/vga_pixels/Makefile b/examples/vga_pixels/Makefile deleted file mode 100644 index 87b6ac1..0000000 --- a/examples/vga_pixels/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_pixels/src/include.h b/examples/vga_pixels/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_pixels/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_pixels/src/main.cpp b/examples/vga_pixels/src/main.cpp index 272eee7..7a56d0d 100644 --- a/examples/vga_pixels/src/main.cpp +++ b/examples/vga_pixels/src/main.cpp @@ -6,6 +6,7 @@ // **************************************************************************** #include "main.h" +#include "picovga.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_raytrace/CMakeLists.txt b/examples/vga_raytrace/CMakeLists.txt index a3cbe19..6a2c4ce 100644 --- a/examples/vga_raytrace/CMakeLists.txt +++ b/examples/vga_raytrace/CMakeLists.txt @@ -1,22 +1,17 @@ -add_executable(vga_balloons +add_executable(vga_raytrace src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp + src/render.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_raytrace) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_raytrace PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_raytrace) # Allow stdio to USB # pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_raytrace/src/include.h b/examples/vga_raytrace/src/include.h deleted file mode 100644 index 3d87564..0000000 --- a/examples/vga_raytrace/src/include.h +++ /dev/null @@ -1,21 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -typedef float real; - -// main -#include "vector.h" // 3D vector -#include "sphere.h" // 3D sphere object -#include "render.h" // ray-trace rendering -#include "main.h" // main code diff --git a/examples/vga_raytrace/src/main.cpp b/examples/vga_raytrace/src/main.cpp index a398f9c..4846329 100644 --- a/examples/vga_raytrace/src/main.cpp +++ b/examples/vga_raytrace/src/main.cpp @@ -6,6 +6,7 @@ // **************************************************************************** #include "main.h" +#include "render.h" // Draw box u8 Box[WIDTHBYTE*HEIGHT] __attribute__ ((aligned(4))); diff --git a/examples/vga_raytrace/src/main.h b/examples/vga_raytrace/src/main.h index 7c1d810..97f78b5 100644 --- a/examples/vga_raytrace/src/main.h +++ b/examples/vga_raytrace/src/main.h @@ -8,6 +8,10 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + +typedef float real; + // screen resolution #define WIDTH 512 // screen width #define HEIGHT 400 // screen height diff --git a/examples/vga_raytrace/src/render.cpp b/examples/vga_raytrace/src/render.cpp index 6f1ef30..8ae8645 100644 --- a/examples/vga_raytrace/src/render.cpp +++ b/examples/vga_raytrace/src/render.cpp @@ -5,7 +5,10 @@ // // **************************************************************************** +#include "render.h" #include "main.h" +#include "vector.h" +#include "sphere.h" // list of spheres Sphere Spheres[] = { @@ -33,7 +36,7 @@ void Trace(V3* rgb, V3 &orig, V3 &dir, int depth, Sphere* disable) real t1best = TOOFAR, t2best = TOOFAR; Sphere* sbest = NULL; real t1, t2; - int i; + uint i; for (i = 0; i < OBJNUM; i++) { if (&Spheres[i] == disable) continue; diff --git a/examples/vga_raytrace/src/render.h b/examples/vga_raytrace/src/render.h index a131982..f978573 100644 --- a/examples/vga_raytrace/src/render.h +++ b/examples/vga_raytrace/src/render.h @@ -8,6 +8,8 @@ #ifndef _RENDER_H #define _RENDER_H +#include "picovga.h" + // render image fast void Render3DFast(); diff --git a/examples/vga_raytrace/src/sphere.h b/examples/vga_raytrace/src/sphere.h index aa1ceab..de2e3b7 100644 --- a/examples/vga_raytrace/src/sphere.h +++ b/examples/vga_raytrace/src/sphere.h @@ -8,6 +8,8 @@ #ifndef _SPHERE_H #define _SPHERE_H +#include "main.h" + // sphere object class Sphere { diff --git a/examples/vga_raytrace/src/vector.h b/examples/vga_raytrace/src/vector.h index 316e308..9887d35 100644 --- a/examples/vga_raytrace/src/vector.h +++ b/examples/vga_raytrace/src/vector.h @@ -8,6 +8,8 @@ #ifndef _VECTOR_H #define _VECTOR_H +#include "main.h" + // 3D vector class V3 { diff --git a/examples/vga_sokoban/CMakeLists.txt b/examples/vga_sokoban/CMakeLists.txt index a3cbe19..61bff2d 100644 --- a/examples/vga_sokoban/CMakeLists.txt +++ b/examples/vga_sokoban/CMakeLists.txt @@ -1,22 +1,42 @@ -add_executable(vga_balloons +add_executable(vga_sokoban src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp + src/game.cpp + src/select.cpp + + src/levels.cpp + src/levels_rabbit.cpp + src/levels_peloux.cpp + src/levels_murase.cpp + src/levels_martel.cpp + src/levels_grigor.cpp + src/levels_haywood.cpp + src/levels_holland.cpp + src/levels_skinner.cpp + src/levels_sladkey.cpp + src/levels_damgaard.cpp + src/levels_loma.cpp + src/levels_domenech.cpp + src/levels_dzekic.cpp + + img/tiles8.cpp + img/tiles12.cpp + img/tiles16.cpp + img/tiles20.cpp + img/tiles24.cpp + img/tiles28.cpp + img/tiles32.cpp + snd/yippee.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_sokoban) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_sokoban PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_sokoban) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +pico_enable_stdio_usb(vga_sokoban 1) \ No newline at end of file diff --git a/examples/vga_sokoban/Makefile b/examples/vga_sokoban/Makefile deleted file mode 100644 index 1234c61..0000000 --- a/examples/vga_sokoban/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += src/game.cpp -SRC += src/select.cpp - -SRC += src/levels.cpp -SRC += src/levels_rabbit.cpp -SRC += src/levels_peloux.cpp -SRC += src/levels_murase.cpp -SRC += src/levels_martel.cpp -SRC += src/levels_grigor.cpp -SRC += src/levels_haywood.cpp -SRC += src/levels_holland.cpp -SRC += src/levels_skinner.cpp -SRC += src/levels_sladkey.cpp -SRC += src/levels_damgaard.cpp -SRC += src/levels_loma.cpp -SRC += src/levels_domenech.cpp -SRC += src/levels_dzekic.cpp - -SRC += img/tiles8.cpp -SRC += img/tiles12.cpp -SRC += img/tiles16.cpp -SRC += img/tiles20.cpp -SRC += img/tiles24.cpp -SRC += img/tiles28.cpp -SRC += img/tiles32.cpp -SRC += snd/yippee.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_sokoban/src/game.cpp b/examples/vga_sokoban/src/game.cpp index 4017731..dce70f8 100644 --- a/examples/vga_sokoban/src/game.cpp +++ b/examples/vga_sokoban/src/game.cpp @@ -5,7 +5,15 @@ // // **************************************************************************** +#include "game.h" #include "main.h" +#include "levels.h" +#include "select.h" + +#include +#include "hardware/sync.h" +#include "hardware/clocks.h" +#include "pico/printf.h" // buffers u8 Board[MAPWMAX*MAPHMAX]; // game board diff --git a/examples/vga_sokoban/src/game.h b/examples/vga_sokoban/src/game.h index 219587c..5233f87 100644 --- a/examples/vga_sokoban/src/game.h +++ b/examples/vga_sokoban/src/game.h @@ -8,6 +8,8 @@ #ifndef _GAME_H #define _GAME_H +#include "picovga.h" + //#define AUTOMODE // automode - autorun all levels to check solutions #ifdef AUTOMODE // automode - autorun all levels to check solutions diff --git a/examples/vga_sokoban/src/include.h b/examples/vga_sokoban/src/include.h deleted file mode 100644 index 85ea412..0000000 --- a/examples/vga_sokoban/src/include.h +++ /dev/null @@ -1,19 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "game.h" // game engine -#include "levels.h" // game levels -#include "select.h" // select -#include "main.h" // main code diff --git a/examples/vga_sokoban/src/levels.cpp b/examples/vga_sokoban/src/levels.cpp index d5bda81..3e5ea49 100644 --- a/examples/vga_sokoban/src/levels.cpp +++ b/examples/vga_sokoban/src/levels.cpp @@ -17,7 +17,8 @@ // @ or p = player // + or P = player on mark -#include "main.h" +#include "levels.h" +#include "picovga.h" // intro level (tiles 32x32, board 20x15) const char* IntroLevel[] = { diff --git a/examples/vga_sokoban/src/levels_damgaard.cpp b/examples/vga_sokoban/src/levels_damgaard.cpp index 078d31e..16df349 100644 --- a/examples/vga_sokoban/src/levels_damgaard.cpp +++ b/examples/vga_sokoban/src/levels_damgaard.cpp @@ -8,7 +8,8 @@ // Copyright: Copyright (c) 2003 Brian Damgaard // These levels may be freely distributed provided they are credited with the author's name. -#include "main.h" +#include "levels.h" +#include "picovga.h" // The YASGen Collection, (c) Brian Damgaard const char* DamgaardCol1[] = { diff --git a/examples/vga_sokoban/src/levels_domenech.cpp b/examples/vga_sokoban/src/levels_domenech.cpp index 13b3c05..2822f6d 100644 --- a/examples/vga_sokoban/src/levels_domenech.cpp +++ b/examples/vga_sokoban/src/levels_domenech.cpp @@ -17,7 +17,8 @@ // License: Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported // http://creativecommons.org/licenses/by-nc-nd/3.0/ -#include "main.h" +#include "levels.h" +#include "picovga.h" // Original remixed, (c) Jordi Domenech const char* DomenechCol1[] = { diff --git a/examples/vga_sokoban/src/levels_dzekic.cpp b/examples/vga_sokoban/src/levels_dzekic.cpp index 3491b07..2649b06 100644 --- a/examples/vga_sokoban/src/levels_dzekic.cpp +++ b/examples/vga_sokoban/src/levels_dzekic.cpp @@ -5,8 +5,8 @@ // // **************************************************************************** -#include "main.h" - +#include "levels.h" +#include "picovga.h" // Galadriel, (c) Marko Dzekic const char* DzekicCol1[] = { diff --git a/examples/vga_sokoban/src/levels_grigor.cpp b/examples/vga_sokoban/src/levels_grigor.cpp index 44c1ec6..c4d6a86 100644 --- a/examples/vga_sokoban/src/levels_grigor.cpp +++ b/examples/vga_sokoban/src/levels_grigor.cpp @@ -20,7 +20,8 @@ // I shall be pleased, if you place them in the program or on the site. // Do not ask me the sanction. -#include "main.h" +#include "levels.h" +#include "picovga.h" // Grigr 2001 const char* GrigorCol1[] = { diff --git a/examples/vga_sokoban/src/levels_haywood.cpp b/examples/vga_sokoban/src/levels_haywood.cpp index 4228120..d3bed5f 100644 --- a/examples/vga_sokoban/src/levels_haywood.cpp +++ b/examples/vga_sokoban/src/levels_haywood.cpp @@ -29,7 +29,8 @@ // The later puzzles are extremely difficult. // The SokHard puzzles are sorted in release order. -#include "main.h" +#include "levels.h" +#include "picovga.h" // SokEvo, (c) Lee J. Haywood const char* HaywoodCol1[] = { diff --git a/examples/vga_sokoban/src/levels_holland.cpp b/examples/vga_sokoban/src/levels_holland.cpp index 6651121..6dc3f5e 100644 --- a/examples/vga_sokoban/src/levels_holland.cpp +++ b/examples/vga_sokoban/src/levels_holland.cpp @@ -24,7 +24,8 @@ // kind, but are nevertheless quite varied. The puzzles are in roughly ascending // order of difficulty. -#include "main.h" +#include "levels.h" +#include "picovga.h" // DH1, (c) David Holland const char* HollandCol1[] = { diff --git a/examples/vga_sokoban/src/levels_loma.cpp b/examples/vga_sokoban/src/levels_loma.cpp index 92e9d20..3ad9ee0 100644 --- a/examples/vga_sokoban/src/levels_loma.cpp +++ b/examples/vga_sokoban/src/levels_loma.cpp @@ -8,7 +8,8 @@ // Authors: Aymeric du Peloux, Francois Marques, David Skinner, Sven Egevad, Victor Kindermans, // Michael Steins, Frantisek Pokorny, Arpad Fekete, Roger Delaporte -#include "main.h" +#include "levels.h" +#include "picovga.h" // Loma const char* LomaCol1[] = { diff --git a/examples/vga_sokoban/src/levels_martel.cpp b/examples/vga_sokoban/src/levels_martel.cpp index 12f0848..3a5577b 100644 --- a/examples/vga_sokoban/src/levels_martel.cpp +++ b/examples/vga_sokoban/src/levels_martel.cpp @@ -15,7 +15,8 @@ // Send comments and best solutions to : // sokomonk@laposte.net -#include "main.h" +#include "levels.h" +#include "picovga.h" const char* MartelCol1[] = { diff --git a/examples/vga_sokoban/src/levels_murase.cpp b/examples/vga_sokoban/src/levels_murase.cpp index 7506b16..789bb77 100644 --- a/examples/vga_sokoban/src/levels_murase.cpp +++ b/examples/vga_sokoban/src/levels_murase.cpp @@ -7,7 +7,8 @@ // Copyright (c) by Yoshio Murase. // Original level website: http://www.ne.jp/asahi/ai/yoshio/sokoban/ -#include "main.h" +#include "levels.h" +#include "picovga.h" // Hand-Made, (c) Yoshio Murase const char* MuraseCol1[] = { diff --git a/examples/vga_sokoban/src/levels_peloux.cpp b/examples/vga_sokoban/src/levels_peloux.cpp index bd3933b..c1146f3 100644 --- a/examples/vga_sokoban/src/levels_peloux.cpp +++ b/examples/vga_sokoban/src/levels_peloux.cpp @@ -11,7 +11,8 @@ // distributed for non-commercial use provided they remain unchanged, credited // with the author's name and original web site, and provided the author is notified. -#include "main.h" +#include "levels.h" +#include "picovga.h" // MiniCosmos, (c) Aymeric du Peloux const char* PelouxCol1[] = { diff --git a/examples/vga_sokoban/src/levels_rabbit.cpp b/examples/vga_sokoban/src/levels_rabbit.cpp index 4046148..3f7e531 100644 --- a/examples/vga_sokoban/src/levels_rabbit.cpp +++ b/examples/vga_sokoban/src/levels_rabbit.cpp @@ -6,7 +6,8 @@ // **************************************************************************** // (c) Thinking Rabbit -#include "main.h" +#include "levels.h" +#include "picovga.h" // XSokoban, Original Levels & extras, (c) Thinking Rabbit const char* RabbitCol1[] = { diff --git a/examples/vga_sokoban/src/levels_skinner.cpp b/examples/vga_sokoban/src/levels_skinner.cpp index 9c71ecf..b47637c 100644 --- a/examples/vga_sokoban/src/levels_skinner.cpp +++ b/examples/vga_sokoban/src/levels_skinner.cpp @@ -11,7 +11,8 @@ // These levels may be freely distributed provided they are credited // with the author's name and e-mail address. -#include "main.h" +#include "levels.h" +#include "picovga.h" // Sasquatch, (c) David W. Skinner const char* SkinnerCol1[] = { diff --git a/examples/vga_sokoban/src/levels_sladkey.cpp b/examples/vga_sokoban/src/levels_sladkey.cpp index 586bd84..a6ed0af 100644 --- a/examples/vga_sokoban/src/levels_sladkey.cpp +++ b/examples/vga_sokoban/src/levels_sladkey.cpp @@ -29,7 +29,8 @@ // so that they can be played on a display with the size and aspect ratio of // a typical mobile phone without rotation. -#include "main.h" +#include "levels.h" +#include "picovga.h" // The Warehouse Volume I - Vertical Mobility 1, (c) Rick Sladkey const char* SladkeyCol1[] = { diff --git a/examples/vga_sokoban/src/main.cpp b/examples/vga_sokoban/src/main.cpp index 837d610..62a46d1 100644 --- a/examples/vga_sokoban/src/main.cpp +++ b/examples/vga_sokoban/src/main.cpp @@ -6,6 +6,13 @@ // **************************************************************************** #include "main.h" +#include "game.h" +#include "levels.h" +#include "select.h" + +#include +#include "pico/printf.h" +#include "hardware/sync.h" // copy of tiles images ALIGNED u8 TilesImg_Copy[sizeof(Tiles32Img)]; diff --git a/examples/vga_sokoban/src/main.h b/examples/vga_sokoban/src/main.h index 5c37d42..c661421 100644 --- a/examples/vga_sokoban/src/main.h +++ b/examples/vga_sokoban/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // program version and copyright #define VERSION "1.0" #define COPYRIGHT "(c) 2021 Miroslav Nemecek" diff --git a/examples/vga_sokoban/src/select.cpp b/examples/vga_sokoban/src/select.cpp index 5e5c6c8..68e53a9 100644 --- a/examples/vga_sokoban/src/select.cpp +++ b/examples/vga_sokoban/src/select.cpp @@ -5,7 +5,11 @@ // // **************************************************************************** +#include "select.h" +#include "pico/printf.h" #include "main.h" +#include "levels.h" +#include "game.h" // print position //u8 PrintX, PrintY, PrintCol; diff --git a/examples/vga_sokoban/src/select.h b/examples/vga_sokoban/src/select.h index 77d23f8..b0949b8 100644 --- a/examples/vga_sokoban/src/select.h +++ b/examples/vga_sokoban/src/select.h @@ -8,6 +8,8 @@ #ifndef _SELECT_H #define _SELECT_H +#include "picovga.h" + extern const char SelAuthor[]; extern const char SelColl[]; diff --git a/examples/vga_spheres/CMakeLists.txt b/examples/vga_spheres/CMakeLists.txt index a3cbe19..a5be1c1 100644 --- a/examples/vga_spheres/CMakeLists.txt +++ b/examples/vga_spheres/CMakeLists.txt @@ -1,22 +1,16 @@ -add_executable(vga_balloons +add_executable(vga_spheres src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_spheres) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_spheres PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_spheres) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +# pico_enable_stdio_usb(vga_spheres 1) \ No newline at end of file diff --git a/examples/vga_spheres/src/include.h b/examples/vga_spheres/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_spheres/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_spheres/src/main.cpp b/examples/vga_spheres/src/main.cpp index 868edf6..628eb42 100644 --- a/examples/vga_spheres/src/main.cpp +++ b/examples/vga_spheres/src/main.cpp @@ -6,6 +6,7 @@ // **************************************************************************** #include "main.h" +#include "picovga.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_spots/CMakeLists.txt b/examples/vga_spots/CMakeLists.txt index a3cbe19..2465314 100644 --- a/examples/vga_spots/CMakeLists.txt +++ b/examples/vga_spots/CMakeLists.txt @@ -1,22 +1,16 @@ -add_executable(vga_balloons +add_executable(vga_spots src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_spots) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_spots PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_spots) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +# pico_enable_stdio_usb(vga_spots 1) \ No newline at end of file diff --git a/examples/vga_spots/Makefile b/examples/vga_spots/Makefile deleted file mode 100644 index 87b6ac1..0000000 --- a/examples/vga_spots/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_spots/src/include.h b/examples/vga_spots/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_spots/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_spots/src/main.cpp b/examples/vga_spots/src/main.cpp index 758681b..c30dcd7 100644 --- a/examples/vga_spots/src/main.cpp +++ b/examples/vga_spots/src/main.cpp @@ -6,6 +6,7 @@ // **************************************************************************** #include "main.h" +#include "picovga.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_tetris/CMakeLists.txt b/examples/vga_tetris/CMakeLists.txt index a3cbe19..42d4f2f 100644 --- a/examples/vga_tetris/CMakeLists.txt +++ b/examples/vga_tetris/CMakeLists.txt @@ -1,22 +1,21 @@ -add_executable(vga_balloons +add_executable(vga_tetris src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp + img/tiles.cpp + snd/brick.cpp + snd/gameover.cpp + snd/levelup.cpp + snd/line.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_tetris) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_tetris PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_tetris) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +pico_enable_stdio_usb(vga_tetris 1) diff --git a/examples/vga_tetris/Makefile b/examples/vga_tetris/Makefile deleted file mode 100644 index e3ecfcb..0000000 --- a/examples/vga_tetris/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/tiles.cpp -SRC += snd/brick.cpp -SRC += snd/gameover.cpp -SRC += snd/levelup.cpp -SRC += snd/line.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_tetris/src/include.h b/examples/vga_tetris/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_tetris/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_tetris/src/main.cpp b/examples/vga_tetris/src/main.cpp index 784c898..b216c54 100644 --- a/examples/vga_tetris/src/main.cpp +++ b/examples/vga_tetris/src/main.cpp @@ -6,6 +6,8 @@ // **************************************************************************** #include "main.h" +#include "pico/printf.h" +#include #define BASEBRICKNUM 7 // number of basebricks #define BRICKTEMPNUM 19 // number of brick templates diff --git a/examples/vga_tetris/src/main.h b/examples/vga_tetris/src/main.h index 3499d69..f15d956 100644 --- a/examples/vga_tetris/src/main.h +++ b/examples/vga_tetris/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + //#define DRV VideoVGA // timings #define WIDTH 640 // screen width #define HEIGHT 480 // screen height diff --git a/examples/vga_train/CMakeLists.txt b/examples/vga_train/CMakeLists.txt index a3cbe19..5515e15 100644 --- a/examples/vga_train/CMakeLists.txt +++ b/examples/vga_train/CMakeLists.txt @@ -1,22 +1,25 @@ -add_executable(vga_balloons +add_executable(vga_train src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp + src/levels.cpp + src/game.cpp + + img/tiles.cpp + + snd/collect.cpp + snd/crash.cpp + snd/step.cpp + snd/success.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_train) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_train PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_train) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +pico_enable_stdio_usb(vga_train 1) diff --git a/examples/vga_train/Makefile b/examples/vga_train/Makefile deleted file mode 100644 index 7913ff5..0000000 --- a/examples/vga_train/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += src/levels.cpp -SRC += src/game.cpp - -SRC += img/tiles.cpp - -SRC += snd/collect.cpp -SRC += snd/crash.cpp -SRC += snd/step.cpp -SRC += snd/success.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_train/src/game.cpp b/examples/vga_train/src/game.cpp index ad5d02e..684e079 100644 --- a/examples/vga_train/src/game.cpp +++ b/examples/vga_train/src/game.cpp @@ -6,6 +6,11 @@ // **************************************************************************** #include "main.h" +#include "game.h" +#include "levels.h" + +#include +#include "pico/printf.h" // buffers u8 Board[MAPSIZE]; // game board diff --git a/examples/vga_train/src/game.h b/examples/vga_train/src/game.h index 48a5f16..4d430c3 100644 --- a/examples/vga_train/src/game.h +++ b/examples/vga_train/src/game.h @@ -8,6 +8,8 @@ #ifndef _GAME_H #define _GAME_H +#include "picovga.h" + //#define AUTOMODE // automode - autorun all levels to check solutions #define LEVFIRST 1 // first level diff --git a/examples/vga_train/src/include.h b/examples/vga_train/src/include.h deleted file mode 100644 index 220f01a..0000000 --- a/examples/vga_train/src/include.h +++ /dev/null @@ -1,18 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "game.h" // game engine -#include "levels.h" // game levels -#include "main.h" // main code diff --git a/examples/vga_train/src/levels.cpp b/examples/vga_train/src/levels.cpp index f77174c..e9daddb 100644 --- a/examples/vga_train/src/levels.cpp +++ b/examples/vga_train/src/levels.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "main.h" +#include "levels.h" +#include "game.h" +#include "picovga.h" // level scenes const u8 Levels[(LEVNUM+1)*MAPSIZE] = { diff --git a/examples/vga_train/src/levels.h b/examples/vga_train/src/levels.h index b7a90f3..c2f6a1c 100644 --- a/examples/vga_train/src/levels.h +++ b/examples/vga_train/src/levels.h @@ -8,6 +8,9 @@ #ifndef _LEVELS_H #define _LEVELS_H +#include "picovga.h" +#include "game.h" + #define LEVNUM 50 // number of levels (without demo scene) // Item indices (symbols used in level definitions) diff --git a/examples/vga_train/src/main.cpp b/examples/vga_train/src/main.cpp index 824b8e0..9a78946 100644 --- a/examples/vga_train/src/main.cpp +++ b/examples/vga_train/src/main.cpp @@ -6,6 +6,10 @@ // **************************************************************************** #include "main.h" +#include "game.h" // game engine +#include "levels.h" // game levels +#include +#include "pico/printf.h" u8 Text[TEXTMAX*2]; // 2 rows of text (2nd row is empty, it is used to center line vertically) u8 TextCol[TEXTMAX*2*8] __attribute__ ((aligned(4))); // text color gradient diff --git a/examples/vga_train/src/main.h b/examples/vga_train/src/main.h index 513ef54..92129ef 100644 --- a/examples/vga_train/src/main.h +++ b/examples/vga_train/src/main.h @@ -8,6 +8,9 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" +#include "game.h" + // Define screen #define TILESIZE 32 // tile size in number of pixels #define TILEW (MAPW*TILESIZE) // tiles width (20*32 = 640) diff --git a/examples/vga_twister/CMakeLists.txt b/examples/vga_twister/CMakeLists.txt index a3cbe19..4e2e0da 100644 --- a/examples/vga_twister/CMakeLists.txt +++ b/examples/vga_twister/CMakeLists.txt @@ -1,22 +1,21 @@ -add_executable(vga_balloons +add_executable(vga_twister + img/CobbleStone.cpp + img/Fabric.cpp + img/Soil.cpp + img/Wood.cpp + src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_twister) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_twister PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_twister) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +# pico_enable_stdio_usb(vga_twister 1) \ No newline at end of file diff --git a/examples/vga_twister/Makefile b/examples/vga_twister/Makefile deleted file mode 100644 index d8f1289..0000000 --- a/examples/vga_twister/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += img/CobbleStone.cpp -SRC += img/Fabric.cpp -SRC += img/Soil.cpp -SRC += img/Wood.cpp - -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_twister/src/include.h b/examples/vga_twister/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_twister/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_twister/src/main.cpp b/examples/vga_twister/src/main.cpp index 7565aee..9e5416f 100644 --- a/examples/vga_twister/src/main.cpp +++ b/examples/vga_twister/src/main.cpp @@ -6,6 +6,7 @@ // **************************************************************************** #include "main.h" +#include // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_twister/src/main.h b/examples/vga_twister/src/main.h index 1a950bd..f4678aa 100644 --- a/examples/vga_twister/src/main.h +++ b/examples/vga_twister/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // canvas format #define FORMAT CANVAS_8 // 8-bit pixels diff --git a/examples/vga_watersurface/CMakeLists.txt b/examples/vga_watersurface/CMakeLists.txt index a3cbe19..da7fcac 100644 --- a/examples/vga_watersurface/CMakeLists.txt +++ b/examples/vga_watersurface/CMakeLists.txt @@ -1,22 +1,19 @@ -add_executable(vga_balloons +add_executable(vga_watersurface src/main.cpp - img/clouds.cpp - img/hotair.cpp - img/blue.cpp - img/green.cpp - img/red.cpp - img/yellow.cpp + img/forest.cpp + img/duck.cpp + snd/river.cpp ) -add_picovga(vga_balloons) +add_picovga(vga_watersurface) # for vga_config.h include -target_include_directories(vga_balloons PRIVATE +target_include_directories(vga_watersurface PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) # create map/bin/hex file etc. -pico_add_extra_outputs(vga_balloons) +pico_add_extra_outputs(vga_watersurface) # Allow stdio to USB -# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file +# pico_enable_stdio_usb(vga_watersurface 1) diff --git a/examples/vga_watersurface/Makefile b/examples/vga_watersurface/Makefile deleted file mode 100644 index e1a5ba1..0000000 --- a/examples/vga_watersurface/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/forest.cpp -SRC += img/duck.cpp -SRC += snd/river.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_watersurface/src/include.h b/examples/vga_watersurface/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_watersurface/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_watersurface/src/main.cpp b/examples/vga_watersurface/src/main.cpp index b480da2..c4ee88b 100644 --- a/examples/vga_watersurface/src/main.cpp +++ b/examples/vga_watersurface/src/main.cpp @@ -6,6 +6,7 @@ // **************************************************************************** #include "main.h" +#include // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_watersurface/src/main.h b/examples/vga_watersurface/src/main.h index 65d1cc8..47998fb 100644 --- a/examples/vga_watersurface/src/main.h +++ b/examples/vga_watersurface/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 512 // screen width #define HEIGHT 400 // screen height