├── Cheat sheet on Porting ConsoleGameEngine 20220713.pdf ├── Engine3DMeshes ├── VideoShip.obj ├── axis.obj ├── mountains.obj └── teapot.obj ├── Engine3DSprites ├── Jario.png └── jario.spr ├── FPSSprites ├── fps_fireball1.png ├── fps_fireball1.spr ├── fps_lamp1.png ├── fps_lamp1.spr ├── fps_wall1.png └── fps_wall1.spr ├── FroggerSprites ├── bus.png ├── bus.spr ├── car1.png ├── car1.spr ├── car2.png ├── car2.spr ├── frog.png ├── frog.spr ├── frog_purple.cnv.png ├── home.png ├── home.spr ├── log.png ├── log.spr ├── pavement.png ├── pavement.spr ├── wall.png ├── wall.spr ├── water.png └── water.spr ├── JarioSprites ├── leveljario.png ├── leveljario.spr ├── minijario.png └── minijario.spr ├── Mode7Sprites ├── mariokart.png ├── mariokart.spr ├── sky1.png └── sky1.spr ├── OneLoneCoder_Asteroids.CGE.cpp ├── OneLoneCoder_Asteroids.PGE.cpp ├── OneLoneCoder_Asteroids.SGE.cpp ├── OneLoneCoder_Balls1.CGE.cpp ├── OneLoneCoder_Balls1.PGE.cpp ├── OneLoneCoder_Balls1.SGE.cpp ├── OneLoneCoder_Balls2.CGE.cpp ├── OneLoneCoder_Balls2.PGE.cpp ├── OneLoneCoder_Balls2.SGE.cpp ├── OneLoneCoder_CaveDiver.CGE.cpp ├── OneLoneCoder_CaveDiver.CON.cpp ├── OneLoneCoder_CaveDiver.PGE.cpp ├── OneLoneCoder_CaveDiver.SGE.cpp ├── OneLoneCoder_ComandLineFPS_2.CGE.cpp ├── OneLoneCoder_ComandLineFPS_2.PGE.cpp ├── OneLoneCoder_ComandLineFPS_2.SGE.cpp ├── OneLoneCoder_CommandLineFPS.CGE.cpp ├── OneLoneCoder_CommandLineFPS.CON.cpp ├── OneLoneCoder_CommandLineFPS.PGE.cpp ├── OneLoneCoder_CommandLineFPS.SGE.cpp ├── OneLoneCoder_Fireworks_10KSubSpecial.CGE.cpp ├── OneLoneCoder_Fireworks_10KSubSpecial.PGE.cpp ├── OneLoneCoder_Fireworks_10KSubSpecial.SGE.cpp ├── OneLoneCoder_FlappyBird.CGE.cpp ├── OneLoneCoder_FlappyBird.PGE.cpp ├── OneLoneCoder_FlappyBird.SGE.cpp ├── OneLoneCoder_Frogger.CGE.cpp ├── OneLoneCoder_Frogger.PGE.cpp ├── OneLoneCoder_Frogger.SGE.cpp ├── OneLoneCoder_GameOfLife.CGE.cpp ├── OneLoneCoder_GameOfLife.PGE.cpp ├── OneLoneCoder_GameOfLife.SGE.cpp ├── OneLoneCoder_LudumDare42.CGE.cpp ├── OneLoneCoder_LudumDare42.PGE.cpp ├── OneLoneCoder_LudumDare42.SGE.cpp ├── OneLoneCoder_MatchingGems_50KSubSpecial.CGE.cpp ├── OneLoneCoder_MatchingGems_50KSubSpecial.PGE.cpp ├── OneLoneCoder_MatchingGems_50KSubSpecial.SGE.cpp ├── OneLoneCoder_Matrix.CGE.cpp ├── OneLoneCoder_Matrix.PGE.cpp ├── OneLoneCoder_Matrix.SGE.cpp ├── OneLoneCoder_Mazes.CGE.cpp ├── OneLoneCoder_Mazes.PGE.cpp ├── OneLoneCoder_Mazes.SGE.cpp ├── OneLoneCoder_PanAndZoom.CGE.cpp ├── OneLoneCoder_PanAndZoom.PGE.cpp ├── OneLoneCoder_PanAndZoom.SGE.cpp ├── OneLoneCoder_PathFinding_AStar.CGE.cpp ├── OneLoneCoder_PathFinding_AStar.PGE.cpp ├── OneLoneCoder_PathFinding_AStar.SGE.cpp ├── OneLoneCoder_PerlinNoise.CGE.cpp ├── OneLoneCoder_PerlinNoise.PGE.cpp ├── OneLoneCoder_PerlinNoise.SGE.cpp ├── OneLoneCoder_PlatformGame1.CGE.cpp ├── OneLoneCoder_PlatformGame1.PGE.cpp ├── OneLoneCoder_PlatformGame1.SGE.cpp ├── OneLoneCoder_Pseudo3DPlanesMode7.CGE.cpp ├── OneLoneCoder_Pseudo3DPlanesMode7.PGE.cpp ├── OneLoneCoder_Pseudo3DPlanesMode7.SGE.cpp ├── OneLoneCoder_RacingLines.CGE.cpp ├── OneLoneCoder_RacingLines.PGE.cpp ├── OneLoneCoder_RacingLines.SGE.cpp ├── OneLoneCoder_RetroArcadeRacer.CGE.cpp ├── OneLoneCoder_RetroArcadeRacer.PGE.cpp ├── OneLoneCoder_RetroArcadeRacer.SGE.cpp ├── OneLoneCoder_Snake.CGE.cpp ├── OneLoneCoder_Snake.CON.cpp ├── OneLoneCoder_Snake.PGE.cpp ├── OneLoneCoder_Snake.SGE.cpp ├── OneLoneCoder_Splines1.CGE.cpp ├── OneLoneCoder_Splines1.PGE.cpp ├── OneLoneCoder_Splines1.SGE.cpp ├── OneLoneCoder_Splines2.CGE.cpp ├── OneLoneCoder_Splines2.PGE.cpp ├── OneLoneCoder_Splines2.SGE.cpp ├── OneLoneCoder_SpriteEditor.CGE.cpp ├── OneLoneCoder_SpriteEditor.PGE.cpp ├── OneLoneCoder_Tetris.CGE.cpp ├── OneLoneCoder_Tetris.CON.cpp ├── OneLoneCoder_Tetris.PGE.cpp ├── OneLoneCoder_Tetris.SGE.cpp ├── OneLoneCoder_Worms1.CGE.cpp ├── OneLoneCoder_Worms1.PGE.cpp ├── OneLoneCoder_Worms1.SGE.cpp ├── OneLoneCoder_Worms2.CGE.cpp ├── OneLoneCoder_Worms2.PGE.cpp ├── OneLoneCoder_Worms2.SGE.cpp ├── OneLoneCoder_Worms3.CGE.cpp ├── OneLoneCoder_Worms3.PGE.cpp ├── OneLoneCoder_Worms3.SGE.cpp ├── OneLoneCoder_olcEngine3D_Part1.CGE.cpp ├── OneLoneCoder_olcEngine3D_Part1.PGE.cpp ├── OneLoneCoder_olcEngine3D_Part1.SGE.cpp ├── OneLoneCoder_olcEngine3D_Part2.CGE.cpp ├── OneLoneCoder_olcEngine3D_Part2.PGE.cpp ├── OneLoneCoder_olcEngine3D_Part2.SGE.cpp ├── OneLoneCoder_olcEngine3D_Part3.CGE.cpp ├── OneLoneCoder_olcEngine3D_Part3.PGE.cpp ├── OneLoneCoder_olcEngine3D_Part3.SGE.cpp ├── OneLoneCoder_olcEngine3D_Part4.CGE.cpp ├── OneLoneCoder_olcEngine3D_Part4.PGE.cpp ├── OneLoneCoder_olcEngine3D_Part4.SGE.cpp ├── README.md ├── WormsSprites ├── worms.png ├── worms.spr ├── worms1.png └── worms1.spr ├── olcRolePlayingGame - CGE ├── RPG_Assets.cpp ├── RPG_Assets.h ├── RPG_Commands.cpp ├── RPG_Commands.h ├── RPG_Dynamics.cpp ├── RPG_Dynamics.h ├── RPG_Engine.cpp ├── RPG_Engine.h ├── RPG_Items.cpp ├── RPG_Items.h ├── RPG_Main.cpp ├── RPG_Maps.cpp ├── RPG_Maps.h ├── RPG_Quests.cpp ├── RPG_Quests.h ├── main.cpp ├── olcConsoleGameEngineOOP.cpp ├── olcConsoleGameEngineOOP.h └── rpgdata │ ├── gfx │ ├── Sword.png │ ├── Sword.spr │ ├── balloon1.png │ ├── balloon1.spr │ ├── item_health.png │ ├── item_health.spr │ ├── item_healthboost.png │ ├── item_healthboost.spr │ ├── javidx9_nesfont8x8.png │ ├── javidx9_nesfont8x8.spr │ ├── sky1.png │ ├── sky1.spr │ ├── title3.png │ ├── title3.spr │ ├── toml_CharacterSprites.png │ ├── toml_CharacterSprites.spr │ ├── toml_char001.png │ ├── toml_char001.spr │ ├── toml_modernish.png │ ├── toml_modernish.spr │ ├── toml_purple.png │ ├── toml_purple.spr │ ├── toml_spritesheetdark.png │ ├── toml_spritesheetdark.spr │ ├── weapon_basic_sword.png │ ├── weapon_basic_sword.spr │ ├── worldmap1.png │ └── worldmap1.spr │ └── map │ ├── home.lvl │ ├── introduction.lvl │ ├── loz_dungeon.lvl │ └── village1.lvl └── olcRolePlayingGame - PGE ├── RPG_Assets.cpp ├── RPG_Assets.h ├── RPG_Commands.cpp ├── RPG_Commands.h ├── RPG_Dynamics.cpp ├── RPG_Dynamics.h ├── RPG_Engine.cpp ├── RPG_Engine.h ├── RPG_Items.cpp ├── RPG_Items.h ├── RPG_Main.cpp ├── RPG_Maps.cpp ├── RPG_Maps.h ├── RPG_Quests.cpp ├── RPG_Quests.h ├── main.cpp └── rpgdata ├── gfx ├── Sword.png ├── Sword.spr ├── balloon1.png ├── balloon1.spr ├── item_health.png ├── item_health.spr ├── item_healthboost.png ├── item_healthboost.spr ├── javidx9_nesfont8x8.png ├── javidx9_nesfont8x8.spr ├── sky1.png ├── sky1.spr ├── title3.png ├── title3.spr ├── toml_CharacterSprites.png ├── toml_CharacterSprites.spr ├── toml_char001.png ├── toml_char001.spr ├── toml_modernish.png ├── toml_modernish.spr ├── toml_purple.png ├── toml_purple.spr ├── toml_spritesheetdark.png ├── toml_spritesheetdark.spr ├── weapon_basic_sword.png ├── weapon_basic_sword.spr ├── worldmap1.png └── worldmap1.spr └── map ├── home.lvl ├── introduction.lvl ├── loz_dungeon.lvl └── village1.lvl /Cheat sheet on Porting ConsoleGameEngine 20220713.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Cheat sheet on Porting ConsoleGameEngine 20220713.pdf -------------------------------------------------------------------------------- /Engine3DMeshes/VideoShip.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.79 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | v 1.000000 -1.000000 -1.000000 4 | v 1.000000 1.000000 -1.000000 5 | v 1.000000 -1.000000 1.000000 6 | v 1.000000 1.000000 1.000000 7 | v -1.000000 -1.000000 -1.000000 8 | v -1.000000 1.000000 -1.000000 9 | v -1.000000 -1.000000 1.000000 10 | v -1.000000 1.000000 1.000000 11 | v -0.720000 0.120000 -1.400000 12 | v 0.300000 0.000000 5.000000 13 | v -0.600000 -0.600000 -1.400000 14 | v -0.300000 0.000000 5.000000 15 | v -1.200000 0.200000 1.000000 16 | v -0.600000 0.600000 -1.400000 17 | v -1.200000 -0.200000 -1.000000 18 | v -1.200000 0.200000 -1.000000 19 | v 1.200000 -0.200000 1.000000 20 | v 1.200000 -0.200000 -1.000000 21 | v 1.200000 0.200000 -1.000000 22 | v 1.200000 0.200000 1.000000 23 | v -1.200000 -0.200000 1.000000 24 | v 0.600000 0.600000 -1.400000 25 | v 0.600000 -0.600000 -1.400000 26 | v -4.200000 0.060000 1.000000 27 | v -4.200000 -0.060000 1.000000 28 | v -4.200000 -0.060000 -1.000000 29 | v -4.200000 0.060000 -1.000000 30 | v 4.200000 -0.060000 1.000000 31 | v 4.200000 -0.060000 -1.000000 32 | v 4.200000 0.060000 -1.000000 33 | v 4.200000 0.060000 1.000000 34 | v 4.200000 -0.180000 1.000000 35 | v 4.200000 -0.180000 -1.000000 36 | v 4.200000 0.180000 -1.000000 37 | v 4.200000 0.180000 1.000000 38 | v 4.500000 -0.180000 1.000000 39 | v 4.500000 -0.180000 -1.000000 40 | v 4.500000 0.180000 -1.000000 41 | v 4.500000 0.180000 1.000000 42 | v -4.200000 0.180000 1.000000 43 | v -4.200000 -0.180000 1.000000 44 | v -4.200000 -0.180000 -1.000000 45 | v -4.200000 0.180000 -1.000000 46 | v -4.500000 0.180000 1.000000 47 | v -4.500000 -0.180000 1.000000 48 | v -4.500000 -0.180000 -1.000000 49 | v -4.500000 0.180000 -1.000000 50 | v 4.350000 -0.180000 3.000000 51 | v 4.350000 0.180000 3.000000 52 | v -4.350000 0.180000 3.000000 53 | v -4.350000 -0.180000 3.000000 54 | v 0.000000 -0.700000 3.000000 55 | v -0.720000 -0.120000 -1.400000 56 | v 0.720000 -0.120000 -1.400000 57 | v 0.720000 0.120000 -1.400000 58 | s off 59 | f 21 52 12 60 | f 6 13 8 61 | f 5 23 1 62 | f 7 1 3 63 | f 4 6 8 64 | f 4 12 10 65 | f 17 20 10 66 | f 20 4 10 67 | f 17 52 3 68 | f 7 3 52 69 | f 16 14 9 70 | f 7 15 5 71 | f 20 30 19 72 | f 18 23 54 73 | f 4 19 2 74 | f 1 17 3 75 | f 13 25 21 76 | f 13 21 12 77 | f 12 52 10 78 | f 8 13 12 79 | f 27 42 43 80 | f 15 27 16 81 | f 21 26 15 82 | f 16 24 13 83 | f 31 34 30 84 | f 18 28 17 85 | f 17 31 20 86 | f 19 29 18 87 | f 32 49 35 88 | f 29 32 28 89 | f 31 32 35 90 | f 29 34 33 91 | f 38 36 37 92 | f 34 37 33 93 | f 35 38 34 94 | f 33 36 32 95 | f 43 44 40 96 | f 25 42 26 97 | f 27 40 24 98 | f 25 40 41 99 | f 44 46 45 100 | f 40 44 50 101 | f 42 47 43 102 | f 41 46 42 103 | f 44 47 46 104 | f 32 36 48 105 | f 39 35 49 106 | f 39 48 36 107 | f 45 51 50 108 | f 40 51 41 109 | f 45 41 51 110 | f 45 50 44 111 | f 18 29 28 112 | f 17 28 31 113 | f 4 2 6 114 | f 18 55 19 115 | f 15 11 5 116 | f 19 22 2 117 | f 2 14 6 118 | f 16 53 15 119 | f 53 9 54 120 | f 19 30 29 121 | f 15 26 27 122 | f 16 27 24 123 | f 13 24 25 124 | f 21 25 26 125 | f 7 21 15 126 | f 7 5 1 127 | f 21 7 52 128 | f 1 18 17 129 | f 17 10 52 130 | f 4 20 19 131 | f 20 31 30 132 | f 4 8 12 133 | f 43 47 44 134 | f 6 16 13 135 | f 40 50 51 136 | f 41 45 46 137 | f 42 46 47 138 | f 2 22 14 139 | f 19 55 22 140 | f 18 54 55 141 | f 18 1 23 142 | f 5 11 23 143 | f 15 53 11 144 | f 16 9 53 145 | f 16 6 14 146 | f 9 14 22 147 | f 22 55 9 148 | f 55 54 9 149 | f 54 23 11 150 | f 11 53 54 151 | f 34 38 37 152 | f 38 39 36 153 | f 39 49 48 154 | f 35 39 38 155 | f 33 37 36 156 | f 25 41 42 157 | f 27 43 40 158 | f 31 35 34 159 | f 29 33 32 160 | f 32 48 49 161 | f 27 26 42 162 | f 31 28 32 163 | f 29 30 34 164 | f 25 24 40 165 | -------------------------------------------------------------------------------- /Engine3DMeshes/axis.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.79 (sub 0) OBJ File: 'axis.blend' 2 | # www.blender.org 3 | v -11.748000 -0.360000 1.268000 4 | v -11.276000 -0.360000 1.268000 5 | v -10.424000 -0.360000 0.228000 6 | v -9.568000 -0.360000 1.268000 7 | v -9.092000 -0.360000 1.268000 8 | v -10.184000 -0.360000 -0.048000 9 | v -9.008000 -0.360000 -1.460000 10 | v -9.484000 -0.360000 -1.460000 11 | v -10.424000 -0.360000 -0.332000 12 | v -11.352000 -0.360000 -1.460000 13 | v -11.824000 -0.360000 -1.460000 14 | v -10.660000 -0.360000 -0.048000 15 | v -9.484000 0.373033 -1.460000 16 | v -10.424000 0.373033 -0.332000 17 | v -11.748000 0.373033 1.268000 18 | v -10.660000 0.373033 -0.048000 19 | v -9.568000 0.373033 1.268000 20 | v -10.184000 0.373033 -0.048000 21 | v -11.824000 0.373033 -1.460000 22 | v -9.008000 0.373033 -1.460000 23 | v -10.424000 0.373033 0.228000 24 | v -11.352000 0.373033 -1.460000 25 | v -9.092000 0.373033 1.268000 26 | v -11.276000 0.373033 1.268000 27 | v -0.620000 -0.380000 11.376000 28 | v 1.116000 -0.380000 9.000000 29 | v -1.344000 -0.380000 9.000000 30 | v -1.344000 -0.380000 9.352000 31 | v 0.392000 -0.380000 9.352000 32 | v -1.344000 -0.380000 11.728000 33 | v 1.008000 -0.380000 11.728000 34 | v 1.008000 -0.380000 11.376000 35 | v 0.392000 0.384923 9.352000 36 | v -1.344000 0.384923 11.728000 37 | v -0.620000 0.384923 11.376000 38 | v -1.344000 0.384923 9.352000 39 | v 1.116000 0.384923 9.000000 40 | v 1.008000 0.384923 11.728000 41 | v 1.008000 0.384923 11.376000 42 | v -1.344000 0.384923 9.000000 43 | v -0.250000 10.788000 0.104000 44 | v -0.250000 11.728000 -0.628000 45 | v -0.250000 11.728000 -1.100000 46 | v -0.250000 10.444000 -0.088000 47 | v -0.250000 9.000000 -0.088000 48 | v -0.250000 9.000000 0.304000 49 | v -0.250000 10.440000 0.304000 50 | v -0.250000 11.728000 1.316000 51 | v -0.250000 11.728000 0.844000 52 | v 0.304321 9.000000 -0.088000 53 | v 0.304321 9.000000 0.304000 54 | v 0.304321 10.440000 0.304000 55 | v 0.304321 10.444000 -0.088000 56 | v 0.304321 11.728000 1.316000 57 | v 0.304321 10.788000 0.104000 58 | v 0.304321 11.728000 -0.628000 59 | v 0.304321 11.728000 -1.100000 60 | v 0.304321 11.728000 0.844000 61 | v 0.500000 -0.500000 -0.500000 62 | v 0.500000 0.500000 -0.500000 63 | v 0.500000 -0.500000 0.500000 64 | v 0.500000 0.500000 0.500000 65 | v -0.500000 -0.500000 -0.500000 66 | v -0.500000 0.500000 -0.500000 67 | v -0.500000 -0.500000 0.500000 68 | v -0.500000 0.500000 0.500000 69 | v -8.500000 0.500000 0.500000 70 | v -8.500000 -0.500000 0.500000 71 | v -8.500000 -0.500000 -0.500000 72 | v -8.500000 0.500000 -0.500000 73 | v 0.500000 8.500000 -0.500000 74 | v 0.500000 8.500000 0.500000 75 | v -0.500000 8.500000 0.500000 76 | v -0.500000 8.500000 -0.500000 77 | v 0.500000 0.500000 8.500000 78 | v 0.500000 -0.500000 8.500000 79 | v -0.500000 -0.500000 8.500000 80 | v -0.500000 0.500000 8.500000 81 | s off 82 | f 6 5 4 83 | f 6 4 3 84 | f 3 2 1 85 | f 3 1 12 86 | f 6 3 12 87 | f 7 6 12 88 | f 7 12 9 89 | f 9 12 11 90 | f 7 9 8 91 | f 10 9 11 92 | f 18 17 23 93 | f 18 21 17 94 | f 21 15 24 95 | f 21 16 15 96 | f 18 16 21 97 | f 20 16 18 98 | f 20 14 16 99 | f 14 19 16 100 | f 20 13 14 101 | f 22 19 14 102 | f 6 23 5 103 | f 9 13 8 104 | f 10 14 9 105 | f 7 18 6 106 | f 1 16 12 107 | f 11 22 10 108 | f 2 15 1 109 | f 5 17 4 110 | f 4 21 3 111 | f 3 24 2 112 | f 8 20 7 113 | f 12 19 11 114 | f 32 31 30 115 | f 32 30 25 116 | f 25 30 29 117 | f 26 25 29 118 | f 26 29 28 119 | f 26 28 27 120 | f 39 34 38 121 | f 39 35 34 122 | f 35 33 34 123 | f 37 33 35 124 | f 37 36 33 125 | f 37 40 36 126 | f 28 40 27 127 | f 25 39 32 128 | f 32 38 31 129 | f 26 35 25 130 | f 29 36 28 131 | f 30 33 29 132 | f 27 37 26 133 | f 31 34 30 134 | f 44 42 43 135 | f 44 41 42 136 | f 41 48 49 137 | f 41 47 48 138 | f 44 47 41 139 | f 45 47 44 140 | f 45 46 47 141 | f 53 57 56 142 | f 53 56 55 143 | f 55 58 54 144 | f 55 54 52 145 | f 53 55 52 146 | f 50 53 52 147 | f 50 52 51 148 | f 58 41 49 149 | f 50 46 45 150 | f 55 42 41 151 | f 54 49 48 152 | f 51 47 46 153 | f 52 48 47 154 | f 56 43 42 155 | f 57 44 43 156 | f 53 45 44 157 | f 60 61 59 158 | f 65 78 66 159 | f 66 68 65 160 | f 64 59 63 161 | f 65 59 61 162 | f 60 72 62 163 | f 67 69 68 164 | f 63 70 64 165 | f 65 69 63 166 | f 64 67 66 167 | f 72 74 73 168 | f 64 71 60 169 | f 62 73 66 170 | f 66 74 64 171 | f 75 77 76 172 | f 61 77 65 173 | f 66 75 62 174 | f 62 76 61 175 | f 6 18 23 176 | f 9 14 13 177 | f 10 22 14 178 | f 7 20 18 179 | f 1 15 16 180 | f 11 19 22 181 | f 2 24 15 182 | f 5 23 17 183 | f 4 17 21 184 | f 3 21 24 185 | f 8 13 20 186 | f 12 16 19 187 | f 28 36 40 188 | f 25 35 39 189 | f 32 39 38 190 | f 26 37 35 191 | f 29 33 36 192 | f 30 34 33 193 | f 27 40 37 194 | f 31 38 34 195 | f 58 55 41 196 | f 50 51 46 197 | f 55 56 42 198 | f 54 58 49 199 | f 51 52 47 200 | f 52 54 48 201 | f 56 57 43 202 | f 57 53 44 203 | f 53 50 45 204 | f 60 62 61 205 | f 65 77 78 206 | f 66 67 68 207 | f 64 60 59 208 | f 65 63 59 209 | f 60 71 72 210 | f 67 70 69 211 | f 63 69 70 212 | f 65 68 69 213 | f 64 70 67 214 | f 72 71 74 215 | f 64 74 71 216 | f 62 72 73 217 | f 66 73 74 218 | f 75 78 77 219 | f 61 76 77 220 | f 66 78 75 221 | f 62 75 76 222 | -------------------------------------------------------------------------------- /Engine3DSprites/Jario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Engine3DSprites/Jario.png -------------------------------------------------------------------------------- /Engine3DSprites/jario.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Engine3DSprites/jario.spr -------------------------------------------------------------------------------- /FPSSprites/fps_fireball1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FPSSprites/fps_fireball1.png -------------------------------------------------------------------------------- /FPSSprites/fps_fireball1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FPSSprites/fps_fireball1.spr -------------------------------------------------------------------------------- /FPSSprites/fps_lamp1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FPSSprites/fps_lamp1.png -------------------------------------------------------------------------------- /FPSSprites/fps_lamp1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FPSSprites/fps_lamp1.spr -------------------------------------------------------------------------------- /FPSSprites/fps_wall1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FPSSprites/fps_wall1.png -------------------------------------------------------------------------------- /FPSSprites/fps_wall1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FPSSprites/fps_wall1.spr -------------------------------------------------------------------------------- /FroggerSprites/bus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/bus.png -------------------------------------------------------------------------------- /FroggerSprites/bus.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/bus.spr -------------------------------------------------------------------------------- /FroggerSprites/car1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/car1.png -------------------------------------------------------------------------------- /FroggerSprites/car1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/car1.spr -------------------------------------------------------------------------------- /FroggerSprites/car2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/car2.png -------------------------------------------------------------------------------- /FroggerSprites/car2.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/car2.spr -------------------------------------------------------------------------------- /FroggerSprites/frog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/frog.png -------------------------------------------------------------------------------- /FroggerSprites/frog.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/frog.spr -------------------------------------------------------------------------------- /FroggerSprites/frog_purple.cnv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/frog_purple.cnv.png -------------------------------------------------------------------------------- /FroggerSprites/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/home.png -------------------------------------------------------------------------------- /FroggerSprites/home.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/home.spr -------------------------------------------------------------------------------- /FroggerSprites/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/log.png -------------------------------------------------------------------------------- /FroggerSprites/log.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/log.spr -------------------------------------------------------------------------------- /FroggerSprites/pavement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/pavement.png -------------------------------------------------------------------------------- /FroggerSprites/pavement.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/pavement.spr -------------------------------------------------------------------------------- /FroggerSprites/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/wall.png -------------------------------------------------------------------------------- /FroggerSprites/wall.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/wall.spr -------------------------------------------------------------------------------- /FroggerSprites/water.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/water.png -------------------------------------------------------------------------------- /FroggerSprites/water.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/FroggerSprites/water.spr -------------------------------------------------------------------------------- /JarioSprites/leveljario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/JarioSprites/leveljario.png -------------------------------------------------------------------------------- /JarioSprites/leveljario.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/JarioSprites/leveljario.spr -------------------------------------------------------------------------------- /JarioSprites/minijario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/JarioSprites/minijario.png -------------------------------------------------------------------------------- /JarioSprites/minijario.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/JarioSprites/minijario.spr -------------------------------------------------------------------------------- /Mode7Sprites/mariokart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Mode7Sprites/mariokart.png -------------------------------------------------------------------------------- /Mode7Sprites/mariokart.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Mode7Sprites/mariokart.spr -------------------------------------------------------------------------------- /Mode7Sprites/sky1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Mode7Sprites/sky1.png -------------------------------------------------------------------------------- /Mode7Sprites/sky1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/Mode7Sprites/sky1.spr -------------------------------------------------------------------------------- /OneLoneCoder_CaveDiver.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - MicroGame1 - Cave Diver 3 | "Err..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | Background 31 | ~~~~~~~~~~ 32 | Often as an exercise, I'll try to write code where every byte of source code 33 | should count. I feel that this is an excellent way to practice logic, code 34 | comprehension and smarmy arrogance. 35 | 36 | 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/oJGx8cqaJLc 46 | 47 | Last Updated: 16/10/2017 48 | */ 49 | 50 | /* Alterations to original (console) code - Joseph21 - 2022-11-18 51 | * - removed "using namespace std" and added explicit scope resolution operator where needed 52 | * - same for "using namespace chrono" 53 | * Port to ConsoleGameEngine - 2022-11-18 54 | * - removed a number of include directives since they are already done in olcConsoleGameEngine.h 55 | * - Created a class CaveDiver_CGE and put most of the before global variables in it as class variables 56 | * - Added empty OnUserCreate() 57 | * - Added OnUserUpdate() and put all user interaction in it (calls to GetAsyncKeyState() rewritten 58 | * to calls to GetKey(), applied in a little lambda key_touched()) 59 | * - Replaced the calls to printf() with DrawString() or Draw() calls with the same (score) information 60 | * - Rewrote main() to construct and start the console game engine 61 | */ 62 | 63 | #include 64 | 65 | #include "olcConsoleGameEngine.h" 66 | 67 | #define PIX_X 8 68 | #define PIX_Y 16 69 | 70 | int nScreenWidth = 80; 71 | int nScreenHeight = 30; 72 | 73 | class CaveDiver_CGE : public olcConsoleGameEngine { 74 | public: 75 | CaveDiver_CGE() 76 | { 77 | m_sAppName = L"CaveDiver_CGE"; 78 | } 79 | 80 | private: 81 | char s[80 * 30] = {'\0'}; 82 | char n[10]; 83 | 84 | float t = 0.0f, tt = 0.0f; // Timing Variables 85 | float w = 20.0f, m = 40.0f, tw = 20.0f, tm = 40.0f; // World Shape Variables 86 | float e = 1.0f, c = 40.0f; // Difficulty, Player Position 87 | int r = 0, h = 1000; // Player Score 88 | 89 | protected: 90 | virtual bool OnUserCreate() 91 | { 92 | return true; 93 | } 94 | 95 | virtual bool OnUserUpdate( float f ) 96 | { 97 | t += f; 98 | tt += f; 99 | 100 | // little lambda to set char c into screen array s at position (x, y) 101 | auto sbxy = [&](int x, int y, char c) { s[y * 80 + x] = c; }; 102 | 103 | // Timing ======================= 104 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 105 | 106 | // Input ======================== 107 | 108 | // little lambda to combine pressing and holding of a key 109 | auto key_touched = [=]( int nKey ) { 110 | return (GetKey( nKey ).bPressed || GetKey( nKey ).bHeld); 111 | }; 112 | 113 | if (key_touched( VK_LEFT )) c -= 40.0f * f; 114 | if (key_touched( VK_RIGHT )) c += 40.0f * f; 115 | 116 | // Update World 117 | if (t >= 1.5f) 118 | { 119 | t -= 1.5f; 120 | tw = rand() % 10 + 10; 121 | tm = rand() % (76 - ((int)tw >> 1)) + 4; 122 | } 123 | e += f * 0.001f; 124 | w += (tw - w) * e * f; 125 | m += (tm - m) * e * f; 126 | float p = sin(tt * e) * m / 2.0f + 40.0f; 127 | 128 | // Fill Row 129 | for (int x = 0; x < 79; x++) 130 | if (x + 1 < p - w / 2 || x > p + w / 2) 131 | sbxy(x, r, L'.'); 132 | else if (x == (int)(p - (w / 2)) || x == (int)(p + (w / 2))) 133 | sbxy(x, r, L'#'); 134 | else 135 | sbxy(x, r, L' '); 136 | 137 | // Scrolling Effect 138 | r += 1; 139 | r %= 28; 140 | 141 | // Draw To Screen 142 | for (int y = 1; y < 28; y++) { 143 | for (int x = 0; x < 79; x++) { 144 | Draw( x, y, s[((y + 28 + r) % 28) * 80 + x] ); 145 | } 146 | } 147 | DrawString( c - 2, 2, L"O-V-O", FG_RED ); 148 | DrawString( c - 2, 3, L" O-O ", FG_RED ); 149 | DrawString( c - 2, 4, L" V ", FG_RED ); 150 | 151 | // Collision Checking & Health Update 152 | h -= s[((4 + r) % 28) * 80 + ((int)c - 2)] == L'.'; 153 | 154 | // Draw HUD 155 | DrawString( 0, 27, L"===============================================================================", FG_YELLOW ); 156 | DrawString( 2, 28, L"Cave Diver - www.onelonecoder.com - Left Arrow / Right Arrow - Survive!", FG_YELLOW ); 157 | DrawString( 2, 29, L"Distance Fallen: " + std::to_wstring( (int)(tt * 100.0f)), FG_YELLOW ); 158 | DrawString( 40, 29, L"Health: " + std::to_wstring( h ), FG_YELLOW ); 159 | 160 | if (h <= 0) 161 | Fill( 0, 0, nScreenWidth, nScreenHeight, PIXEL_SOLID, FG_BLACK ); 162 | 163 | return h > 0; 164 | } 165 | }; 166 | 167 | 168 | int main() 169 | { 170 | // use olcConsoleGameEngine derived app 171 | CaveDiver_CGE game; 172 | game.ConstructConsole( nScreenWidth, nScreenHeight, PIX_X, PIX_Y ); 173 | game.Start(); 174 | 175 | // Oh Dear - game over! 176 | std::cout << "Dead..." << std::endl; 177 | 178 | return 0; 179 | } 180 | -------------------------------------------------------------------------------- /OneLoneCoder_CaveDiver.CON.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - MicroGame1 - Cave Diver 3 | "Err..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | Background 31 | ~~~~~~~~~~ 32 | Often as an exercise, I'll try to write code where every byte of source code 33 | should count. I feel that this is an excellent way to practice logic, code 34 | comprehension and smarmy arrogance. 35 | 36 | 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/oJGx8cqaJLc 46 | 47 | Last Updated: 16/10/2017 48 | */ 49 | 50 | /* Alterations to original (console) code - Joseph21 - 2022-11-18 51 | * - removed "using namespace std" and added explicit scope resolution operator where needed 52 | * - same for "using namespace chrono" 53 | */ 54 | 55 | #include 56 | #include 57 | #include 58 | //using namespace std; 59 | //using namespace chrono; 60 | 61 | // NOTE!! WILL ONLY WORK WITH UPDATED WINDOWS 10 62 | #include 63 | 64 | int main() 65 | { 66 | DWORD d = 0; 67 | GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &d); 68 | SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), d | 0x0004); // ??? Mystery Console Mode Feature! 69 | GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &d); 70 | SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), d | 0x0200); 71 | 72 | auto tp1 = std::chrono::system_clock::now(); auto tp2 = tp1; 73 | char s[80 * 30] = {'\0'}; 74 | char n[10]; 75 | 76 | auto pfxy = [](const char* b, int x, int y) {printf("\x1B[%d;%dH%s", y, x, b);}; 77 | auto sbxy = [&](int x, int y, char c){s[y * 80 + x] = c; }; 78 | 79 | float t = 0.0f, f = 0.0f, tt = 0.0f; // Timing Variables 80 | float w = 20.0f, m = 40.0f, tw = 20.0f, tm = 40.0f; // World Shape Variables 81 | float e = 1.0f, c = 40.0f; // Difficulty, Player Position 82 | int r = 0, h = 1000; // Player Score 83 | 84 | while (h>0) 85 | { 86 | // Timing 87 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 88 | tp2 = std::chrono::system_clock::now(); 89 | std::chrono::duration elapsedTime = tp2 - tp1; tp1 = tp2; 90 | t+=(f=elapsedTime.count()); tt += f; 91 | 92 | // Get and Handle Input 93 | for (int i = 0; i < 2; i++) if (GetAsyncKeyState("\x25\x27"[i])!= 0) c += (i?1:-1) * 40.0f * f; 94 | 95 | // Update World 96 | if (t >= 1.5f){ t -= 1.5f; tw = rand() % 10 + 10; tm = rand() % (76 - ((int)tw >> 1)) + 4; } 97 | e += f*0.001f; w += (tw - w) * e * f; m += (tm - m) * e * f; 98 | float p = sin(tt * e) * m / 2.0f + 40.0f; 99 | 100 | // Fill Row 101 | for (int x = 0; x < 79; x++) 102 | if (x+1 < p-w/2 || x> p+w/2) sbxy(x,r,'.'); 103 | else if (x == (int)(p - (w / 2)) || x== (int)(p + (w / 2))) sbxy(x, r, '#'); 104 | else sbxy(x,r,' '); 105 | 106 | // Scrolling Effect 107 | sbxy(79, r, '\0'); (r += 1) %= 28; 108 | 109 | // Draw To Screen 110 | for (int y = 1; y < 28; y++) pfxy(&s[((y+28+r)%28) * 80], 0, y); 111 | pfxy("O-V-O", c - 2, 2); pfxy(" O-O ", c - 2, 3); pfxy(" V ", c - 2, 4); 112 | 113 | // Collision Checking & Health Update 114 | h -= s[((4 + r) % 28) * 80 + ((int)c - 2)] == '.'; 115 | 116 | // Draw HUD 117 | pfxy("===============================================================================", 0, 28); 118 | pfxy("Cave Diver - www.onelonecoder.com - Left Arrow / Right Arrow - Survive!", 2, 29); 119 | _itoa_s((int)(tt * 100.0f), n, 10, 10); 120 | pfxy("Distance Fallen: ", 2, 30); pfxy(n, 19, 30); 121 | 122 | _itoa_s(h, n, 10, 10); 123 | pfxy("Health: ", 40, 30); pfxy(n, 48, 30); 124 | } 125 | 126 | pfxy("Dead...\n", 70, 30); 127 | system("pause"); // :-P 128 | return 0; 129 | } 130 | -------------------------------------------------------------------------------- /OneLoneCoder_CaveDiver.PGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - MicroGame1 - Cave Diver 3 | "Err..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | Background 31 | ~~~~~~~~~~ 32 | Often as an exercise, I'll try to write code where every byte of source code 33 | should count. I feel that this is an excellent way to practice logic, code 34 | comprehension and smarmy arrogance. 35 | 36 | 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/oJGx8cqaJLc 46 | 47 | Last Updated: 16/10/2017 48 | */ 49 | 50 | /* Alterations to original (console) code - Joseph21 - 2022-11-18 51 | * - removed "using namespace std" and added explicit scope resolution operator where needed 52 | * - same for "using namespace chrono" 53 | * Port to ConsoleGameEngine - 2022-11-18 54 | * - removed a number of include directives since they are already done in olcConsoleGameEngine.h 55 | * - Created a class CaveDiver_CGE and put most of the before global variables in it as class variables 56 | * - Added empty OnUserCreate() 57 | * - Added OnUserUpdate() and put all user interaction in it (calls to GetAsyncKeyState() rewritten 58 | * to calls to GetKey(), applied in a little lambda key_touched()) 59 | * - Replaced the calls to printf() with DrawString() or Draw() calls with the same (score) information 60 | * - Rewrote main() to construct and start the console game engine 61 | * Port to PixelGameEngine - 2022-11-18 62 | * - standard porting stuff - see cheat sheet for generic adaptations needed for port 63 | * - Introduced a lambda CGE_Draw() to emulate the Draw() of one glyph CGE style 64 | * - Similarly for CGE_DrawString() as wrapper around DrawString() 65 | * - Adapted screen resolution 66 | */ 67 | 68 | #include 69 | 70 | #define OLC_PGE_APPLICATION 71 | #include "olcPixelGameEngine.h" 72 | 73 | #define PIX_X 1 74 | #define PIX_Y 2 75 | 76 | int nScreenWidth = 80; 77 | int nScreenHeight = 30; 78 | 79 | class CaveDiver_PGE : public olc::PixelGameEngine { 80 | public: 81 | CaveDiver_PGE() 82 | { 83 | sAppName = "CaveDiver_PGE"; 84 | } 85 | 86 | private: 87 | char s[80 * 30] = { '\0' }; 88 | char n[10]; 89 | 90 | float t = 0.0f, tt = 0.0f; // Timing Variables 91 | float w = 20.0f, m = 40.0f, tw = 20.0f, tm = 40.0f; // World Shape Variables 92 | float e = 1.0f, c = 40.0f; // Difficulty, Player Position 93 | int r = 0, h = 1000; // Player Score 94 | 95 | protected: 96 | virtual bool OnUserCreate() 97 | { 98 | return true; 99 | } 100 | 101 | virtual bool OnUserUpdate( float f ) 102 | { 103 | t += f; 104 | tt += f; 105 | 106 | // little lambda to set char c into screen array s at position (x, y) 107 | auto sbxy = [&](int x, int y, char c) { s[y * 80 + x] = c; }; 108 | 109 | // Timing ======================= 110 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 111 | 112 | // Input ======================== 113 | 114 | // little lambda to combine pressing and holding of a key 115 | auto key_touched = [=]( olc::Key nKey ) { 116 | return (GetKey( nKey ).bPressed || GetKey( nKey ).bHeld); 117 | }; 118 | 119 | if (key_touched( olc::Key::LEFT )) c -= 40.0f * f; 120 | if (key_touched( olc::Key::RIGHT )) c += 40.0f * f; 121 | 122 | // Update World 123 | if (t >= 1.5f) 124 | { 125 | t -= 1.5f; 126 | tw = rand() % 10 + 10; 127 | tm = rand() % (76 - ((int)tw >> 1)) + 4; 128 | } 129 | e += f * 0.001f; 130 | w += (tw - w) * e * f; 131 | m += (tm - m) * e * f; 132 | float p = sin(tt * e) * m / 2.0f + 40.0f; 133 | 134 | // Fill Row 135 | for (int x = 0; x < 79; x++) 136 | if (x + 1 < p - w / 2 || x > p + w / 2) 137 | sbxy(x, r, '.'); 138 | else if (x == (int)(p - (w / 2)) || x == (int)(p + (w / 2))) 139 | sbxy(x, r, '#'); 140 | else 141 | sbxy(x, r, ' '); 142 | 143 | // Scrolling Effect 144 | r += 1; 145 | r %= 28; 146 | 147 | // Display ====================== 148 | Clear( olc::BLACK ); 149 | 150 | // little lambda to emulate CGE's Draw() call 151 | auto CGE_Draw = [=]( int x, int y, char c ) { 152 | DrawString( x * 8, y * 8, std::string( 1, c )); 153 | }; 154 | auto CGE_DrawString = [=]( int x, int y, std::string s, olc::Pixel col ) { 155 | DrawString( x * 8, y * 8, s, col ); 156 | }; 157 | 158 | // Draw To Screen 159 | for (int y = 1; y < 27; y++) { 160 | for (int x = 0; x < 80; x++) { 161 | CGE_Draw( x, y, s[((y + 28 + r) % 28) * 80 + x] ); 162 | } 163 | } 164 | CGE_DrawString( c - 2, 2, "O-V-O", olc::RED ); 165 | CGE_DrawString( c - 2, 3, " O-O ", olc::RED ); 166 | CGE_DrawString( c - 2, 4, " V ", olc::RED ); 167 | 168 | // Collision Checking & Health Update 169 | h -= s[((4 + r) % 28) * 80 + ((int)c - 2)] == '.'; 170 | 171 | // Draw HUD 172 | CGE_DrawString( 0, 27, "===============================================================================", olc::YELLOW ); 173 | CGE_DrawString( 2, 28, "Cave Diver - www.onelonecoder.com - Left Arrow / Right Arrow - Survive!", olc::YELLOW ); 174 | CGE_DrawString( 2, 29, "Distance Fallen: " + std::to_string( (int)(tt * 100.0f)), olc::YELLOW ); 175 | CGE_DrawString( 40, 29, "Health: " + std::to_string( h ), olc::YELLOW ); 176 | 177 | if (h <= 0) 178 | Clear( olc::BLACK ); 179 | 180 | return h > 0; 181 | } 182 | }; 183 | 184 | 185 | int main() 186 | { 187 | // use olcConsoleGameEngine derived app 188 | CaveDiver_PGE game; 189 | if (game.Construct( nScreenWidth * 8, nScreenHeight * 8, PIX_X, PIX_Y )) 190 | game.Start(); 191 | 192 | // Oh Dear - game over! 193 | std::cout << "Dead..." << std::endl; 194 | 195 | return 0; 196 | } 197 | -------------------------------------------------------------------------------- /OneLoneCoder_CaveDiver.SGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - MicroGame1 - Cave Diver 3 | "Err..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | Background 31 | ~~~~~~~~~~ 32 | Often as an exercise, I'll try to write code where every byte of source code 33 | should count. I feel that this is an excellent way to practice logic, code 34 | comprehension and smarmy arrogance. 35 | 36 | 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/oJGx8cqaJLc 46 | 47 | Last Updated: 16/10/2017 48 | */ 49 | 50 | /* Alterations to original (console) code - Joseph21 - 2022-11-18 51 | * - removed "using namespace std" and added explicit scope resolution operator where needed 52 | * - same for "using namespace chrono" 53 | * Port to ConsoleGameEngine - 2022-11-18 54 | * - removed a number of include directives since they are already done in flcConsoleGameEngine.h 55 | * - Created a class CaveDiver_CGE and put most of the before global variables in it as class variables 56 | * - Added empty OnUserCreate() 57 | * - Added OnUserUpdate() and put all user interaction in it (calls to GetAsyncKeyState() rewritten 58 | * to calls to GetKey(), applied in a little lambda key_touched()) 59 | * - Replaced the calls to printf() with DrawString() or Draw() calls with the same (score) information 60 | * - Rewrote main() to construct and start the console game engine 61 | * Port to PixelGameEngine - 2022-11-18 62 | * - standard porting stuff - see cheat sheet for generic adaptations needed for port 63 | * - Introduced a lambda CGE_Draw() to emulate the Draw() of one glyph CGE style 64 | * - Similarly for CGE_DrawString() as wrapper around DrawString() 65 | * - Adapted screen resolution 66 | */ 67 | 68 | #include 69 | 70 | #include "SGE\SGE_Core.h" 71 | 72 | #define PIX_X 1 73 | #define PIX_Y 2 74 | 75 | int nScreenWidth = 80; 76 | int nScreenHeight = 30; 77 | 78 | class CaveDiver_SGE : public flc::SDL_GameEngine { 79 | public: 80 | CaveDiver_SGE() 81 | { 82 | sAppName = "CaveDiver_SGE"; 83 | } 84 | 85 | private: 86 | char s[80 * 30] = { '\0' }; 87 | char n[10]; 88 | 89 | float t = 0.0f, tt = 0.0f; // Timing Variables 90 | float w = 20.0f, m = 40.0f, tw = 20.0f, tm = 40.0f; // World Shape Variables 91 | float e = 1.0f, c = 40.0f; // Difficulty, Player Position 92 | int r = 0, h = 1000; // Player Score 93 | 94 | protected: 95 | virtual bool OnUserCreate() 96 | { 97 | return true; 98 | } 99 | 100 | virtual bool OnUserUpdate( float f ) 101 | { 102 | t += f; 103 | tt += f; 104 | 105 | // little lambda to set char c into screen array s at position (x, y) 106 | auto sbxy = [&](int x, int y, char c) { s[y * 80 + x] = c; }; 107 | 108 | // Timing ======================= 109 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 110 | 111 | // Input ======================== 112 | 113 | // little lambda to combine pressing and holding of a key 114 | auto key_touched = [=]( flc::Key nKey ) { 115 | return (GetKey( nKey ).bPressed || GetKey( nKey ).bHeld); 116 | }; 117 | 118 | if (key_touched( flc::Key::LEFT )) c -= 40.0f * f; 119 | if (key_touched( flc::Key::RIGHT )) c += 40.0f * f; 120 | 121 | // Update World 122 | if (t >= 1.5f) 123 | { 124 | t -= 1.5f; 125 | tw = rand() % 10 + 10; 126 | tm = rand() % (76 - ((int)tw >> 1)) + 4; 127 | } 128 | e += f * 0.001f; 129 | w += (tw - w) * e * f; 130 | m += (tm - m) * e * f; 131 | float p = sin(tt * e) * m / 2.0f + 40.0f; 132 | 133 | // Fill Row 134 | for (int x = 0; x < 79; x++) 135 | if (x + 1 < p - w / 2 || x > p + w / 2) 136 | sbxy(x, r, '.'); 137 | else if (x == (int)(p - (w / 2)) || x == (int)(p + (w / 2))) 138 | sbxy(x, r, '#'); 139 | else 140 | sbxy(x, r, ' '); 141 | 142 | // Scrolling Effect 143 | r += 1; 144 | r %= 28; 145 | 146 | // Display ====================== 147 | Clear( flc::BLACK ); 148 | 149 | // little lambda to emulate CGE's Draw() call 150 | auto CGE_Draw = [=]( int x, int y, char c ) { 151 | DrawString( x * 8, y * 8, std::string( 1, c )); 152 | }; 153 | auto CGE_DrawString = [=]( int x, int y, std::string s, flc::Pixel col ) { 154 | DrawString( x * 8, y * 8, s, col ); 155 | }; 156 | 157 | // Draw To Screen 158 | for (int y = 1; y < 27; y++) { 159 | for (int x = 0; x < 80; x++) { 160 | CGE_Draw( x, y, s[((y + 28 + r) % 28) * 80 + x] ); 161 | } 162 | } 163 | CGE_DrawString( c - 2, 2, "O-V-O", flc::RED ); 164 | CGE_DrawString( c - 2, 3, " O-O ", flc::RED ); 165 | CGE_DrawString( c - 2, 4, " V ", flc::RED ); 166 | 167 | // Collision Checking & Health Update 168 | h -= s[((4 + r) % 28) * 80 + ((int)c - 2)] == '.'; 169 | 170 | // Draw HUD 171 | CGE_DrawString( 0, 27, "===============================================================================", flc::YELLOW ); 172 | CGE_DrawString( 2, 28, "Cave Diver - www.onelonecoder.com - Left Arrow / Right Arrow - Survive!", flc::YELLOW ); 173 | CGE_DrawString( 2, 29, "Distance Fallen: " + std::to_string( (int)(tt * 100.0f)), flc::YELLOW ); 174 | CGE_DrawString( 40, 29, "Health: " + std::to_string( h ), flc::YELLOW ); 175 | 176 | if (h <= 0) 177 | Clear( flc::BLACK ); 178 | 179 | return h > 0; 180 | } 181 | }; 182 | 183 | 184 | int main( int argc, char *argv[] ) 185 | { 186 | // use SDL_GameEngine derived app 187 | CaveDiver_SGE game; 188 | if (game.Construct( nScreenWidth * 8, nScreenHeight * 8, PIX_X, PIX_Y )) 189 | game.Start(); 190 | 191 | // Oh Dear - game over! 192 | std::cout << "Dead..." << std::endl; 193 | 194 | return 0; 195 | } 196 | -------------------------------------------------------------------------------- /OneLoneCoder_Fireworks_10KSubSpecial.CGE.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/OneLoneCoder_Fireworks_10KSubSpecial.CGE.cpp -------------------------------------------------------------------------------- /OneLoneCoder_Fireworks_10KSubSpecial.PGE.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/OneLoneCoder_Fireworks_10KSubSpecial.PGE.cpp -------------------------------------------------------------------------------- /OneLoneCoder_Fireworks_10KSubSpecial.SGE.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/OneLoneCoder_Fireworks_10KSubSpecial.SGE.cpp -------------------------------------------------------------------------------- /OneLoneCoder_FlappyBird.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Code-It-Yourself! Flappy Bird 3 | "You asked for it... wait, no one did, ever..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | Background 31 | ~~~~~~~~~~ 32 | Look it's Flappy Bird, OK? Press Space Bar to Flap. Get a high score. 33 | 34 | Author 35 | ~~~~~~ 36 | Twitter: @javidx9 37 | Blog: www.onelonecoder.com 38 | 39 | Video: 40 | ~~~~~~ 41 | https://youtu.be/b6A4XHkTjs8 42 | 43 | Last Updated: 05/11/2017 44 | */ 45 | 46 | 47 | /* Alterations Joseph21 - 20220716 48 | * - removed "using namespace std" and added explicit scope resolution operator where needed 49 | */ 50 | 51 | #include 52 | #include 53 | //using namespace std; 54 | 55 | #include "olcConsoleGameEngine.h" 56 | 57 | 58 | class OneLoneCoder_FlappyBird : public olcConsoleGameEngine 59 | { 60 | public: 61 | OneLoneCoder_FlappyBird() 62 | { 63 | m_sAppName = L"Flappy Bird"; 64 | } 65 | 66 | private: 67 | 68 | float fBirdPosition = 0.0f; 69 | float fBirdVelocity = 0.0f; 70 | float fBirdAcceleration = 0.0f; 71 | float fGravity = 100.0f; 72 | float fLevelPosition = 0.0f; 73 | 74 | float fSectionWidth; 75 | std::list listSection; 76 | 77 | bool bHasCollided = false; 78 | bool bResetGame = false; 79 | 80 | int nAttemptCount = 0; 81 | int nFlapCount = 0; 82 | int nMaxFlapCount = 0; 83 | 84 | 85 | protected: 86 | // Called by olcConsoleGameEngine 87 | virtual bool OnUserCreate() 88 | { 89 | listSection = { 0, 0, 0, 0 }; 90 | bResetGame = true; 91 | fSectionWidth = (float)ScreenWidth() / (float)(listSection.size() - 1); 92 | return true; 93 | } 94 | 95 | // Called by olcConsoleGameEngine 96 | virtual bool OnUserUpdate(float fElapsedTime) 97 | { 98 | if (bResetGame) 99 | { 100 | bHasCollided = false; 101 | bResetGame = false; 102 | listSection = { 0, 0, 0, 0 }; 103 | fBirdAcceleration = 0.0f; 104 | fBirdVelocity = 0.0f; 105 | fBirdPosition = ScreenHeight() / 2.0f; 106 | nFlapCount = 0; 107 | nAttemptCount++; 108 | } 109 | 110 | // Game 111 | if (bHasCollided) 112 | { 113 | // Do nothing until user releases space 114 | if (m_keys[VK_SPACE].bReleased) 115 | bResetGame = true; 116 | } 117 | else 118 | { 119 | 120 | if (m_keys[VK_SPACE].bPressed && fBirdVelocity >= fGravity / 10.0f) 121 | { 122 | fBirdAcceleration = 0.0f; 123 | fBirdVelocity = -fGravity / 4.0f; 124 | nFlapCount++; 125 | if (nFlapCount > nMaxFlapCount) 126 | nMaxFlapCount = nFlapCount; 127 | } 128 | else 129 | fBirdAcceleration += fGravity * fElapsedTime; 130 | 131 | if (fBirdAcceleration >= fGravity) 132 | fBirdAcceleration = fGravity; 133 | 134 | fBirdVelocity += fBirdAcceleration * fElapsedTime; 135 | fBirdPosition += fBirdVelocity * fElapsedTime; 136 | fLevelPosition += 14.0f * fElapsedTime; 137 | 138 | if (fLevelPosition > fSectionWidth) 139 | { 140 | fLevelPosition -= fSectionWidth; 141 | listSection.pop_front(); 142 | int i = rand() % (ScreenHeight() - 20); 143 | if (i <= 10) i = 0; 144 | listSection.push_back(i); 145 | } 146 | 147 | // Display 148 | Fill(0, 0, ScreenWidth(), ScreenHeight(), L' '); 149 | 150 | // Draw Sections 151 | int nSection = 0; 152 | for (auto s : listSection) 153 | { 154 | if (s != 0) 155 | { 156 | Fill(nSection * fSectionWidth + 10 - fLevelPosition, ScreenHeight() - s, nSection * fSectionWidth + 15 - fLevelPosition, ScreenHeight(), PIXEL_SOLID, FG_GREEN); 157 | Fill(nSection * fSectionWidth + 10 - fLevelPosition, 0, nSection * fSectionWidth + 15 - fLevelPosition, ScreenHeight() - s - 15, PIXEL_SOLID, FG_GREEN); 158 | } 159 | nSection++; 160 | } 161 | 162 | int nBirdX = (int)(ScreenWidth() / 3.0f); 163 | 164 | // Collision Detection 165 | bHasCollided = fBirdPosition < 2 || fBirdPosition > ScreenHeight() - 2 || 166 | m_bufScreen[(int)(fBirdPosition + 0) * ScreenWidth() + nBirdX].Char.UnicodeChar != L' ' || 167 | m_bufScreen[(int)(fBirdPosition + 1) * ScreenWidth() + nBirdX].Char.UnicodeChar != L' ' || 168 | m_bufScreen[(int)(fBirdPosition + 0) * ScreenWidth() + nBirdX + 6].Char.UnicodeChar != L' ' || 169 | m_bufScreen[(int)(fBirdPosition + 1) * ScreenWidth() + nBirdX + 6].Char.UnicodeChar != L' '; 170 | 171 | // Draw Bird 172 | if (fBirdVelocity > 0) 173 | { 174 | DrawString(nBirdX, fBirdPosition + 0, L"\\\\\\"); 175 | DrawString(nBirdX, fBirdPosition + 1, L"<\\\\\\=Q"); 176 | } 177 | else 178 | { 179 | DrawString(nBirdX, fBirdPosition + 0, L" 58 | #include 59 | //using namespace std; 60 | 61 | #define OLC_PGE_APPLICATION 62 | #include "olcPixelGameEngine.h" 63 | 64 | 65 | class OneLoneCoder_FlappyBird : public olc::PixelGameEngine 66 | { 67 | public: 68 | OneLoneCoder_FlappyBird() 69 | { 70 | sAppName = "Flappy Bird"; 71 | } 72 | 73 | private: 74 | 75 | float fBirdPosition = 0.0f; 76 | float fBirdVelocity = 0.0f; 77 | float fBirdAcceleration = 0.0f; 78 | float fGravity = 100.0f * 8.0f; 79 | float fLevelPosition = 0.0f; 80 | 81 | float fSectionWidth; 82 | std::list listSection; 83 | 84 | bool bHasCollided = false; 85 | bool bResetGame = false; 86 | 87 | int nAttemptCount = 0; 88 | int nFlapCount = 0; 89 | int nMaxFlapCount = 0; 90 | 91 | 92 | protected: 93 | // Called by olcConsoleGameEngine 94 | virtual bool OnUserCreate() 95 | { 96 | listSection = { 0, 0, 0, 0 }; 97 | bResetGame = true; 98 | fSectionWidth = (float)ScreenWidth() / (float)(listSection.size() - 1); 99 | return true; 100 | } 101 | 102 | // Called by olcConsoleGameEngine 103 | virtual bool OnUserUpdate(float fElapsedTime) 104 | { 105 | if (bResetGame) 106 | { 107 | bHasCollided = false; 108 | bResetGame = false; 109 | listSection = { 0, 0, 0, 0 }; 110 | fBirdAcceleration = 0.0f; 111 | fBirdVelocity = 0.0f; 112 | fBirdPosition = ScreenHeight() / 2.0f; 113 | nFlapCount = 0; 114 | nAttemptCount++; 115 | } 116 | 117 | // Game 118 | if (bHasCollided) 119 | { 120 | // Do nothing until user releases space 121 | if (GetKey(olc::Key::SPACE).bReleased) 122 | bResetGame = true; 123 | } 124 | else 125 | { 126 | 127 | if (GetKey(olc::Key::SPACE).bPressed && fBirdVelocity >= fGravity / 10.0f) 128 | { 129 | fBirdAcceleration = 0.0f; 130 | fBirdVelocity = -fGravity * 0.25f; 131 | nFlapCount++; 132 | if (nFlapCount > nMaxFlapCount) 133 | nMaxFlapCount = nFlapCount; 134 | } 135 | else 136 | fBirdAcceleration += fGravity * fElapsedTime; 137 | 138 | if (fBirdAcceleration >= fGravity) 139 | fBirdAcceleration = fGravity; 140 | 141 | fBirdVelocity += fBirdAcceleration * fElapsedTime; 142 | fBirdPosition += fBirdVelocity * fElapsedTime; 143 | fLevelPosition += 14.0f * 8.0f * fElapsedTime; 144 | 145 | if (fLevelPosition > fSectionWidth) 146 | { 147 | fLevelPosition -= fSectionWidth; 148 | listSection.pop_front(); 149 | int i = rand() % (ScreenHeight() - 20 * 8); 150 | if (i <= 10 * 8) i = 0; 151 | listSection.push_back(i); 152 | } 153 | 154 | // Display 155 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), olc::BLACK); 156 | 157 | // Draw Sections 158 | int nSection = 0; 159 | for (auto s : listSection) 160 | { 161 | if (s != 0) 162 | { 163 | FillRect(nSection * fSectionWidth + 10 * 8 - fLevelPosition, ScreenHeight() - s, 5 * 8, s, olc::GREEN); 164 | FillRect(nSection * fSectionWidth + 10 * 8 - fLevelPosition, 0, 5 * 8, ScreenHeight() - s - (15 * 8), olc::GREEN ); 165 | } 166 | nSection++; 167 | } 168 | 169 | int nBirdX = (int)(ScreenWidth() / 3.0f); 170 | 171 | // Collision detection 172 | 173 | // grab screen sprite pointer 174 | olc::Sprite *screenSprite = GetDrawTarget(); 175 | // work out bird collision box 176 | int nLt = nBirdX - 1; 177 | int nRt = nBirdX + 6 * 8; 178 | int nUp = (int)(fBirdPosition + 0); 179 | int nDn = (int)(fBirdPosition + 16); 180 | // check against screen boundaries and against non black pixels 181 | bHasCollided = fBirdPosition < 16 || fBirdPosition > ScreenHeight() - 16 || 182 | screenSprite->GetPixel( nLt, nUp ) != olc::BLACK || 183 | screenSprite->GetPixel( nLt, nDn ) != olc::BLACK || 184 | screenSprite->GetPixel( nRt, nUp ) != olc::BLACK || 185 | screenSprite->GetPixel( nRt, nDn ) != olc::BLACK ; 186 | 187 | // Draw Bird 188 | if (fBirdVelocity > 0) 189 | { 190 | DrawString(nBirdX, fBirdPosition + 0, "\\\\\\"); 191 | DrawString(nBirdX, fBirdPosition + 8, "<\\\\\\=Q"); 192 | } 193 | else 194 | { 195 | DrawString(nBirdX, fBirdPosition + 0, " 60 | #include 61 | #include 62 | 63 | #include "SGE/SGE_Core.h" 64 | 65 | 66 | class OneLoneCoder_FlappyBird : public flc::SDL_GameEngine 67 | { 68 | public: 69 | OneLoneCoder_FlappyBird() 70 | { 71 | sAppName = "Flappy Bird"; 72 | } 73 | 74 | private: 75 | 76 | float fBirdPosition = 0.0f; 77 | float fBirdVelocity = 0.0f; 78 | float fBirdAcceleration = 0.0f; 79 | float fGravity = 100.0f * 8.0f; 80 | float fLevelPosition = 0.0f; 81 | 82 | float fSectionWidth; 83 | std::list listSection; 84 | 85 | bool bHasCollided = false; 86 | bool bResetGame = false; 87 | 88 | int nAttemptCount = 0; 89 | int nFlapCount = 0; 90 | int nMaxFlapCount = 0; 91 | 92 | 93 | protected: 94 | // Called by olcConsoleGameEngine 95 | virtual bool OnUserCreate() 96 | { 97 | listSection = { 0, 0, 0, 0 }; 98 | bResetGame = true; 99 | fSectionWidth = (float)ScreenWidth() / (float)(listSection.size() - 1); 100 | return true; 101 | } 102 | 103 | // Called by olcConsoleGameEngine 104 | virtual bool OnUserUpdate(float fElapsedTime) 105 | { 106 | if (bResetGame) 107 | { 108 | bHasCollided = false; 109 | bResetGame = false; 110 | listSection = { 0, 0, 0, 0 }; 111 | fBirdAcceleration = 0.0f; 112 | fBirdVelocity = 0.0f; 113 | fBirdPosition = ScreenHeight() / 2.0f; 114 | nFlapCount = 0; 115 | nAttemptCount++; 116 | } 117 | 118 | // Game 119 | if (bHasCollided) 120 | { 121 | // Do nothing until user releases space 122 | if (GetKey(flc::Key::SPACE).bReleased) 123 | bResetGame = true; 124 | } 125 | else 126 | { 127 | 128 | if (GetKey(flc::Key::SPACE).bPressed && fBirdVelocity >= fGravity / 10.0f) 129 | { 130 | fBirdAcceleration = 0.0f; 131 | fBirdVelocity = -fGravity * 0.25f; 132 | nFlapCount++; 133 | if (nFlapCount > nMaxFlapCount) 134 | nMaxFlapCount = nFlapCount; 135 | } 136 | else 137 | fBirdAcceleration += fGravity * fElapsedTime; 138 | 139 | if (fBirdAcceleration >= fGravity) 140 | fBirdAcceleration = fGravity; 141 | 142 | fBirdVelocity += fBirdAcceleration * fElapsedTime; 143 | fBirdPosition += fBirdVelocity * fElapsedTime; 144 | fLevelPosition += 14.0f * 8.0f * fElapsedTime; 145 | 146 | if (fLevelPosition > fSectionWidth) 147 | { 148 | fLevelPosition -= fSectionWidth; 149 | listSection.pop_front(); 150 | int i = rand() % (ScreenHeight() - 20 * 8); 151 | if (i <= 10 * 8) i = 0; 152 | listSection.push_back(i); 153 | } 154 | 155 | // Display 156 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), flc::BLACK); 157 | 158 | // Draw Sections 159 | int nSection = 0; 160 | for (auto s : listSection) 161 | { 162 | if (s != 0) 163 | { 164 | FillRect(nSection * fSectionWidth + 10 * 8 - fLevelPosition, ScreenHeight() - s, 5 * 8, s, flc::GREEN); 165 | FillRect(nSection * fSectionWidth + 10 * 8 - fLevelPosition, 0, 5 * 8, ScreenHeight() - s - (15 * 8), flc::GREEN ); 166 | } 167 | nSection++; 168 | } 169 | 170 | int nBirdX = (int)(ScreenWidth() / 3.0f); 171 | 172 | // Collision detection 173 | 174 | // grab screen sprite pointer 175 | flc::Sprite *screenSprite = GetDrawTarget(); 176 | // work out bird collision box 177 | int nLt = nBirdX - 1; 178 | int nRt = nBirdX + 6 * 8; 179 | int nUp = (int)(fBirdPosition + 0); 180 | int nDn = (int)(fBirdPosition + 16); 181 | // check against screen boundaries and against non black pixels 182 | bHasCollided = fBirdPosition < 16 || fBirdPosition > ScreenHeight() - 16 || 183 | screenSprite->GetPixel( nLt, nUp ) != flc::BLACK || 184 | screenSprite->GetPixel( nLt, nDn ) != flc::BLACK || 185 | screenSprite->GetPixel( nRt, nUp ) != flc::BLACK || 186 | screenSprite->GetPixel( nRt, nDn ) != flc::BLACK ; 187 | 188 | // Draw Bird 189 | if (fBirdVelocity > 0) 190 | { 191 | DrawString(nBirdX, fBirdPosition + 0, "\\\\\\"); 192 | DrawString(nBirdX, fBirdPosition + 8, "<\\\\\\=Q"); 193 | } 194 | else 195 | { 196 | DrawString(nBirdX, fBirdPosition + 0, " 54 | //using namespace std; 55 | 56 | #include "olcConsoleGameEngine.h" 57 | 58 | class OneLoneCoder_GameOfLife : public olcConsoleGameEngine 59 | { 60 | public: 61 | OneLoneCoder_GameOfLife() 62 | { 63 | m_sAppName = L"Game Of Life"; 64 | } 65 | 66 | private: 67 | int *m_output; 68 | int *m_state; 69 | 70 | 71 | 72 | protected: 73 | // Called by olcConsoleGameEngine 74 | virtual bool OnUserCreate() 75 | { 76 | m_output = new int[ScreenWidth() * ScreenHeight()]; 77 | m_state = new int[ScreenWidth() * ScreenHeight()]; 78 | 79 | memset(m_output, 0, ScreenWidth() * ScreenHeight() * sizeof(int)); 80 | memset(m_state, 0, ScreenWidth() * ScreenHeight() * sizeof(int)); 81 | 82 | for (int i = 0; i < ScreenWidth()*ScreenHeight(); i++) 83 | m_state[i] = rand() % 2; 84 | 85 | auto set = [&](int x, int y, std::wstring s) 86 | { 87 | int p = 0; 88 | for (auto c : s) 89 | { 90 | m_state[y*ScreenWidth() + x + p] = c == L'#' ? 1 : 0; 91 | p++; 92 | } 93 | }; 94 | 95 | /* 96 | // R-Pentomino 97 | set(80, 50, L" ## "); 98 | set(80, 51, L" ## "); 99 | set(80, 52, L" # "); 100 | 101 | // Gosper Glider Gun 102 | set(60, 45, L"........................#............"); 103 | set(60, 46, L"......................#.#............"); 104 | set(60, 47, L"............##......##............##."); 105 | set(60, 48, L"...........#...#....##............##."); 106 | set(60, 49, L"##........#.....#...##..............."); 107 | set(60, 50, L"##........#...#.##....#.#............"); 108 | set(60, 51, L"..........#.....#.......#............"); 109 | set(60, 52, L"...........#...#....................."); 110 | set(60, 53, L"............##......................."); 111 | 112 | // Infinite Growth 113 | set(20, 50, L"########.#####...###......#######.#####"); 114 | */ 115 | 116 | return true; 117 | } 118 | 119 | 120 | 121 | // Called by olcConsoleGameEngine 122 | virtual bool OnUserUpdate(float fElapsedTime) 123 | { 124 | //this_thread::sleep_for(50ms); 125 | 126 | //if (!m_keys[VK_SPACE].bReleased) 127 | // return true; 128 | 129 | auto cell = [&](int x, int y) 130 | { 131 | return m_output[y * ScreenWidth() + x]; 132 | }; 133 | 134 | // Store output state 135 | for (int i = 0; i < ScreenWidth()*ScreenHeight(); i++) 136 | m_output[i] = m_state[i]; 137 | 138 | for (int x = 1; x < ScreenWidth() - 1; x++) 139 | for (int y = 1; y < ScreenHeight() - 1; y++) 140 | { 141 | // The secret of artificial life ================================================= 142 | int nNeighbours = cell(x - 1, y - 1) + cell(x - 0, y - 1) + cell(x + 1, y - 1) + 143 | cell(x - 1, y + 0) + 0 + cell(x + 1, y + 0) + 144 | cell(x - 1, y + 1) + cell(x + 0, y + 1) + cell(x + 1, y + 1); 145 | 146 | if (cell(x, y) == 1) 147 | m_state[y*ScreenWidth() + x] = nNeighbours == 2 || nNeighbours == 3; 148 | else 149 | m_state[y*ScreenWidth() + x] = nNeighbours == 3; 150 | // =============================================================================== 151 | 152 | 153 | if (cell(x, y) == 1) 154 | Draw(x, y, PIXEL_SOLID, FG_WHITE); 155 | else 156 | Draw(x, y, PIXEL_SOLID, FG_BLACK); 157 | } 158 | 159 | return true; 160 | } 161 | }; 162 | 163 | 164 | int main() 165 | { 166 | // Seed random number generator 167 | srand(clock()); 168 | 169 | // Use olcConsoleGameEngine derived app 170 | OneLoneCoder_GameOfLife game; 171 | game.ConstructConsole(160, 100, 8, 8); 172 | game.Start(); 173 | 174 | return 0; 175 | } 176 | -------------------------------------------------------------------------------- /OneLoneCoder_GameOfLife.PGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - What are Cellular Automata? John Conway's Game Of Life 3 | "Get lost..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Sometimes, its worth reflecting on the fact that from simple things can emerge 34 | significant beauty. This is an implementaion of Game Of Life that runs in the console 35 | 36 | Author 37 | ~~~~~~ 38 | Twitter: @javidx9 39 | Blog: www.onelonecoder.com 40 | 41 | Video: 42 | ~~~~~~ 43 | https://youtu.be/E7CxMHsYzSs 44 | 45 | Last Updated: 14/07/2017 46 | */ 47 | 48 | 49 | /* Addition Joseph21 - 20220715 50 | * - removed "using namespace std" and added explicit scope resolution operator where needed 51 | * Port to PixelGameEngine - 20220715 52 | * - see cheat sheet for generic adaptations needed for port 53 | * - no specific 54 | */ 55 | 56 | #include 57 | //using namespace std; 58 | 59 | #define OLC_PGE_APPLICATION 60 | #include "olcPixelGameEngine.h" 61 | 62 | class OneLoneCoder_GameOfLife : public olc::PixelGameEngine 63 | { 64 | public: 65 | OneLoneCoder_GameOfLife() 66 | { 67 | sAppName = "Game Of Life"; 68 | } 69 | 70 | private: 71 | int *m_output; 72 | int *m_state; 73 | 74 | 75 | 76 | protected: 77 | // Called by olcConsoleGameEngine 78 | virtual bool OnUserCreate() 79 | { 80 | m_output = new int[ScreenWidth() * ScreenHeight()]; 81 | m_state = new int[ScreenWidth() * ScreenHeight()]; 82 | 83 | memset(m_output, 0, ScreenWidth() * ScreenHeight() * sizeof(int)); 84 | memset(m_state, 0, ScreenWidth() * ScreenHeight() * sizeof(int)); 85 | 86 | for (int i = 0; i < ScreenWidth()*ScreenHeight(); i++) 87 | m_state[i] = rand() % 2; 88 | 89 | auto set = [&](int x, int y, std::wstring s) 90 | { 91 | int p = 0; 92 | for (auto c : s) 93 | { 94 | m_state[y*ScreenWidth() + x + p] = c == '#' ? 1 : 0; 95 | p++; 96 | } 97 | }; 98 | 99 | /* 100 | // R-Pentomino 101 | set(80, 50, " ## "); 102 | set(80, 51, " ## "); 103 | set(80, 52, " # "); 104 | 105 | // Gosper Glider Gun 106 | set(60, 45, "........................#............"); 107 | set(60, 46, "......................#.#............"); 108 | set(60, 47, "............##......##............##."); 109 | set(60, 48, "...........#...#....##............##."); 110 | set(60, 49, "##........#.....#...##..............."); 111 | set(60, 50, "##........#...#.##....#.#............"); 112 | set(60, 51, "..........#.....#.......#............"); 113 | set(60, 52, "...........#...#....................."); 114 | set(60, 53, "............##......................."); 115 | 116 | // Infinite Growth 117 | set(20, 50, "########.#####...###......#######.#####"); 118 | */ 119 | 120 | return true; 121 | } 122 | 123 | 124 | 125 | // Called by olcConsoleGameEngine 126 | virtual bool OnUserUpdate(float fElapsedTime) 127 | { 128 | //this_thread::sleep_for(50ms); 129 | 130 | //if (!m_keys[VK_SPACE].bReleased) 131 | // return true; 132 | 133 | auto cell = [&](int x, int y) 134 | { 135 | return m_output[y * ScreenWidth() + x]; 136 | }; 137 | 138 | // Store output state 139 | for (int i = 0; i < ScreenWidth()*ScreenHeight(); i++) 140 | m_output[i] = m_state[i]; 141 | 142 | for (int x = 1; x < ScreenWidth() - 1; x++) 143 | for (int y = 1; y < ScreenHeight() - 1; y++) 144 | { 145 | // The secret of artificial life ================================================= 146 | int nNeighbours = cell(x - 1, y - 1) + cell(x - 0, y - 1) + cell(x + 1, y - 1) + 147 | cell(x - 1, y + 0) + 0 + cell(x + 1, y + 0) + 148 | cell(x - 1, y + 1) + cell(x + 0, y + 1) + cell(x + 1, y + 1); 149 | 150 | if (cell(x, y) == 1) 151 | m_state[y*ScreenWidth() + x] = nNeighbours == 2 || nNeighbours == 3; 152 | else 153 | m_state[y*ScreenWidth() + x] = nNeighbours == 3; 154 | // =============================================================================== 155 | 156 | 157 | if (cell(x, y) == 1) 158 | Draw(x, y, olc::WHITE); 159 | else 160 | Draw(x, y, olc::BLACK); 161 | } 162 | 163 | return true; 164 | } 165 | }; 166 | 167 | 168 | int main() 169 | { 170 | // Seed random number generator 171 | srand(clock()); 172 | 173 | // Use olc::PixelGameEngine derived app 174 | OneLoneCoder_GameOfLife game; 175 | if (game.Construct(160, 100, 8, 8)) 176 | game.Start(); 177 | 178 | return 0; 179 | } 180 | -------------------------------------------------------------------------------- /OneLoneCoder_GameOfLife.SGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - What are Cellular Automata? John Conway's Game Of Life 3 | "Get lost..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Sometimes, its worth reflecting on the fact that from simple things can emerge 34 | significant beauty. This is an implementaion of Game Of Life that runs in the console 35 | 36 | Author 37 | ~~~~~~ 38 | Twitter: @javidx9 39 | Blog: www.onelonecoder.com 40 | 41 | Video: 42 | ~~~~~~ 43 | https://youtu.be/E7CxMHsYzSs 44 | 45 | Last Updated: 14/07/2017 46 | */ 47 | 48 | 49 | /* Addition Joseph21 - 20220715 50 | * - removed "using namespace std" and added explicit scope resolution operator where needed 51 | * Port to PixelGameEngine - 20220715 52 | * - see cheat sheet for generic adaptations needed for port 53 | * - no specifics 54 | * Port to SDL-based GameEngine - 20221204 55 | * - generic port, no specifics 56 | */ 57 | 58 | #include 59 | 60 | #include "SGE/SGE_Core.h" 61 | 62 | class OneLoneCoder_GameOfLife : public flc::SDL_GameEngine 63 | { 64 | public: 65 | OneLoneCoder_GameOfLife() 66 | { 67 | sAppName = "Game Of Life"; 68 | } 69 | 70 | private: 71 | int *m_output; 72 | int *m_state; 73 | 74 | 75 | 76 | protected: 77 | // Called by olcConsoleGameEngine 78 | virtual bool OnUserCreate() 79 | { 80 | m_output = new int[ScreenWidth() * ScreenHeight()]; 81 | m_state = new int[ScreenWidth() * ScreenHeight()]; 82 | 83 | memset(m_output, 0, ScreenWidth() * ScreenHeight() * sizeof(int)); 84 | memset(m_state, 0, ScreenWidth() * ScreenHeight() * sizeof(int)); 85 | 86 | for (int i = 0; i < ScreenWidth()*ScreenHeight(); i++) 87 | m_state[i] = rand() % 2; 88 | 89 | auto set = [&](int x, int y, std::string s) 90 | { 91 | int p = 0; 92 | for (auto c : s) 93 | { 94 | m_state[y*ScreenWidth() + x + p] = c == '#' ? 1 : 0; 95 | p++; 96 | } 97 | }; 98 | 99 | /* 100 | // R-Pentomino 101 | set(80, 50, " ## "); 102 | set(80, 51, " ## "); 103 | set(80, 52, " # "); 104 | 105 | // Gosper Glider Gun 106 | set(60, 45, "........................#............"); 107 | set(60, 46, "......................#.#............"); 108 | set(60, 47, "............##......##............##."); 109 | set(60, 48, "...........#...#....##............##."); 110 | set(60, 49, "##........#.....#...##..............."); 111 | set(60, 50, "##........#...#.##....#.#............"); 112 | set(60, 51, "..........#.....#.......#............"); 113 | set(60, 52, "...........#...#....................."); 114 | set(60, 53, "............##......................."); 115 | 116 | // Infinite Growth 117 | set(20, 50, "########.#####...###......#######.#####"); 118 | */ 119 | 120 | return true; 121 | } 122 | 123 | 124 | 125 | // Called by olcConsoleGameEngine 126 | virtual bool OnUserUpdate(float fElapsedTime) 127 | { 128 | //this_thread::sleep_for(50ms); 129 | 130 | //if (!m_keys[VK_SPACE].bReleased) 131 | // return true; 132 | 133 | auto cell = [&](int x, int y) 134 | { 135 | return m_output[y * ScreenWidth() + x]; 136 | }; 137 | 138 | // Store output state 139 | for (int i = 0; i < ScreenWidth()*ScreenHeight(); i++) 140 | m_output[i] = m_state[i]; 141 | 142 | for (int x = 1; x < ScreenWidth() - 1; x++) 143 | for (int y = 1; y < ScreenHeight() - 1; y++) 144 | { 145 | // The secret of artificial life ================================================= 146 | int nNeighbours = cell(x - 1, y - 1) + cell(x - 0, y - 1) + cell(x + 1, y - 1) + 147 | cell(x - 1, y + 0) + 0 + cell(x + 1, y + 0) + 148 | cell(x - 1, y + 1) + cell(x + 0, y + 1) + cell(x + 1, y + 1); 149 | 150 | if (cell(x, y) == 1) 151 | m_state[y*ScreenWidth() + x] = nNeighbours == 2 || nNeighbours == 3; 152 | else 153 | m_state[y*ScreenWidth() + x] = nNeighbours == 3; 154 | // =============================================================================== 155 | 156 | 157 | if (cell(x, y) == 1) 158 | Draw(x, y, flc::WHITE); 159 | else 160 | Draw(x, y, flc::BLACK); 161 | } 162 | 163 | return true; 164 | } 165 | }; 166 | 167 | 168 | int main( int argc, char *argv[] ) 169 | { 170 | // Seed random number generator 171 | srand(clock()); 172 | 173 | // Use SDL-GameEngine derived app 174 | OneLoneCoder_GameOfLife game; 175 | if (game.Construct(160, 100, 8, 8)) 176 | game.Start(); 177 | 178 | return 0; 179 | } 180 | -------------------------------------------------------------------------------- /OneLoneCoder_MatchingGems_50KSubSpecial.CGE.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/OneLoneCoder_MatchingGems_50KSubSpecial.CGE.cpp -------------------------------------------------------------------------------- /OneLoneCoder_MatchingGems_50KSubSpecial.PGE.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/OneLoneCoder_MatchingGems_50KSubSpecial.PGE.cpp -------------------------------------------------------------------------------- /OneLoneCoder_MatchingGems_50KSubSpecial.SGE.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/OneLoneCoder_MatchingGems_50KSubSpecial.SGE.cpp -------------------------------------------------------------------------------- /OneLoneCoder_Matrix.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Programming The Matrix 3 | "Ribbet" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | I hit 0x1FF subscribers, so celebrated with a live stream! 34 | 35 | Controls 36 | ~~~~~~~~ 37 | None, just spot the blonde, brunette, etc, etc... 38 | 39 | Author 40 | ~~~~~~ 41 | Twitter: @javidx9 42 | Blog: www.onelonecoder.com 43 | 44 | Video: 45 | ~~~~~~ 46 | https://youtu.be/s7EbrvA188A 47 | 48 | 49 | Last Updated: 17/09/2017 50 | */ 51 | 52 | 53 | /* Addition Joseph21 - 20220716 54 | * - removed "using namespace std" and added explicit scope resolution operator where needed 55 | */ 56 | 57 | #include 58 | #include 59 | //using namespace std; 60 | 61 | #include "olcConsoleGameEngine.h" 62 | 63 | 64 | class OneLoneCoder_Matrix : public olcConsoleGameEngine 65 | { 66 | public: 67 | OneLoneCoder_Matrix() 68 | { 69 | m_sAppName = L"Matrix"; 70 | } 71 | 72 | private: 73 | struct sStreamer 74 | { 75 | int nColumn = 0; 76 | float fPosition = 0; 77 | float fSpeed = 0; 78 | std::wstring sText; 79 | }; 80 | 81 | std::list listStreamers; 82 | 83 | int nMaxStreamers = 300; 84 | 85 | wchar_t RandomCharacter() 86 | { 87 | return (wchar_t)(rand() % 0x1EF + 0x00C0); 88 | return (wchar_t)(rand() % 93 + 33); // Random ASCII 89 | } 90 | 91 | void PrepareStreamer(sStreamer *s) 92 | { 93 | s->nColumn = rand() % ScreenWidth(); 94 | s->fPosition = 0; 95 | s->fSpeed = rand() % 40 + 5; 96 | s->sText.clear(); 97 | 98 | int nStreamerLength = rand() % 80 + 10; 99 | for (int i = 0; i < nStreamerLength; i++) 100 | s->sText.append(1, RandomCharacter()); 101 | 102 | //s->sText = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 103 | } 104 | 105 | 106 | protected: 107 | // Called by olcConsoleGameEngine 108 | virtual bool OnUserCreate() 109 | { 110 | for (int n = 0; n < nMaxStreamers; n++) 111 | { 112 | sStreamer s; 113 | PrepareStreamer(&s); 114 | listStreamers.push_back(s); 115 | } 116 | return true; 117 | } 118 | 119 | // Called by olcConsoleGameEngine 120 | virtual bool OnUserUpdate(float fElapsedTime) 121 | { 122 | // Clear Screen 123 | Fill(0, 0, ScreenWidth(), ScreenHeight(), PIXEL_SOLID, 0); 124 | 125 | for (auto &s : listStreamers) 126 | { 127 | s.fPosition += fElapsedTime * s.fSpeed; 128 | for (int i = 0; i < s.sText.size(); i++) 129 | { 130 | // If you hate ternary operators do this 131 | // start -> 132 | short col = s.fSpeed < 15.0f ? FG_DARK_GREEN : FG_GREEN; // ;-) 133 | if (i == 0) 134 | col = FG_WHITE; 135 | else 136 | if (i <= 3) 137 | col = FG_GREY; 138 | 139 | int nCharIndex = (i - (int)s.fPosition) % s.sText.size(); 140 | 141 | Draw(s.nColumn, (int)s.fPosition - i, s.sText[nCharIndex], col); 142 | // <- end 143 | 144 | // If you like them, do this! 145 | //Draw(s.nColumn, (int)s.fPosition - i, s.sText[(abs(i - (int)s.fPosition) % s.sText.size())], i == 0 ? FG_WHITE : i<=3 ? FG_GREY: i>=s.sText.size()-2 || s.fSpeed < 15.0f? FG_DARK_GREEN: FG_GREEN); 146 | 147 | // Missed this out on live stream, occasionally glitch a character 148 | if (rand() % 1000 < 5) 149 | s.sText[i] = RandomCharacter(); 150 | } 151 | 152 | if ( s.fPosition - s.sText.size() >= ScreenHeight()) 153 | PrepareStreamer(&s); 154 | 155 | } 156 | return true; 157 | } 158 | }; 159 | 160 | 161 | int main() 162 | { 163 | // Use olcConsoleGameEngine derived app 164 | OneLoneCoder_Matrix game; 165 | game.ConstructConsole(128, 80, 12, 12); 166 | game.Start(); 167 | return 0; 168 | } 169 | -------------------------------------------------------------------------------- /OneLoneCoder_Matrix.PGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Programming The Matrix 3 | "Ribbet" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | I hit 0x1FF subscribers, so celebrated with a live stream! 34 | 35 | Controls 36 | ~~~~~~~~ 37 | None, just spot the blonde, brunette, etc, etc... 38 | 39 | Author 40 | ~~~~~~ 41 | Twitter: @javidx9 42 | Blog: www.onelonecoder.com 43 | 44 | Video: 45 | ~~~~~~ 46 | https://youtu.be/s7EbrvA188A 47 | 48 | 49 | Last Updated: 17/09/2017 50 | */ 51 | 52 | 53 | /* Addition Joseph21 - 20220716 54 | * - removed "using namespace std" and added explicit scope resolution operator where needed 55 | * Port to PixelGameEngine - 20220715 56 | * - see cheat sheet for generic adaptations needed for port 57 | * - resized screen since characters are 8x8 pixels 58 | * - also adapted positioning of streamers and characters 59 | * - stopped using unicode for the characters to display (random ascii is displayed atm) 60 | */ 61 | 62 | #include 63 | #include 64 | //using namespace std; 65 | 66 | #define OLC_PGE_APPLICATION 67 | #include "olcPixelGameEngine.h" 68 | 69 | 70 | class OneLoneCoder_Matrix : public olc::PixelGameEngine 71 | { 72 | public: 73 | OneLoneCoder_Matrix() 74 | { 75 | sAppName = "Matrix"; 76 | } 77 | 78 | private: 79 | struct sStreamer 80 | { 81 | int nColumn = 0; 82 | float fPosition = 0; 83 | float fSpeed = 0; 84 | std::string sText; 85 | }; 86 | 87 | std::list listStreamers; 88 | 89 | int nMaxStreamers = 300; 90 | 91 | char RandomCharacter() 92 | { 93 | // return (wchar_t)(rand() % 0x1EF + 0x00C0); 94 | return (char)(rand() % 93 + 33); // Random ASCII 95 | } 96 | 97 | void PrepareStreamer(sStreamer *s) 98 | { 99 | s->nColumn = rand() % ScreenWidth(); 100 | s->fPosition = 0; 101 | s->fSpeed = rand() % 40 + 5; 102 | s->sText.clear(); 103 | 104 | int nStreamerLength = rand() % 80 + 10; 105 | for (int i = 0; i < nStreamerLength; i++) 106 | s->sText.append(1, RandomCharacter()); 107 | 108 | // s->sText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 109 | } 110 | 111 | 112 | protected: 113 | // Called by olcConsoleGameEngine 114 | virtual bool OnUserCreate() 115 | { 116 | for (int n = 0; n < nMaxStreamers; n++) 117 | { 118 | sStreamer s; 119 | PrepareStreamer(&s); 120 | listStreamers.push_back(s); 121 | } 122 | return true; 123 | } 124 | 125 | // Called by olcConsoleGameEngine 126 | virtual bool OnUserUpdate(float fElapsedTime) 127 | { 128 | // Clear Screen 129 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), olc::BLACK); 130 | 131 | for (auto &s : listStreamers) 132 | { 133 | s.fPosition += fElapsedTime * s.fSpeed; 134 | for (int i = 0; i < s.sText.size(); i++) 135 | { 136 | // If you hate ternary operators do this 137 | // start -> 138 | olc::Pixel col = s.fSpeed < 15.0f ? olc::DARK_GREEN : olc::GREEN; // ;-) 139 | if (i == 0) 140 | col = olc::WHITE; 141 | else 142 | if (i <= 3) 143 | col = olc::GREY; 144 | 145 | int nCharIndex = (i - (int)s.fPosition) % s.sText.size(); 146 | 147 | DrawString( s.nColumn, 8 * ((int)s.fPosition - i), std::string( 1, s.sText[nCharIndex] ), col ); 148 | // <- end 149 | 150 | // If you like them, do this! 151 | //Draw(s.nColumn, 8 * (int)s.fPosition - i, s.sText[(abs(i - (int)s.fPosition) % s.sText.size())], i == 0 ? olc::WHITE : i<=3 ? olc::GREY: i>=s.sText.size()-2 || s.fSpeed < 15.0f? olc::DARK_GREEN: olc::GREEN); 152 | 153 | // Missed this out on live stream, occasionally glitch a character 154 | if (rand() % 1000 < 5) 155 | s.sText[i] = RandomCharacter(); 156 | } 157 | 158 | if ( 8 * (s.fPosition - s.sText.size()) >= ScreenHeight()) 159 | PrepareStreamer(&s); 160 | 161 | } 162 | return true; 163 | } 164 | }; 165 | 166 | 167 | int main() 168 | { 169 | // Use olcConsoleGameEngine derived app 170 | OneLoneCoder_Matrix game; 171 | if (game.Construct(1000, 600, 1, 1)) 172 | game.Start(); 173 | return 0; 174 | } 175 | -------------------------------------------------------------------------------- /OneLoneCoder_Matrix.SGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Programming The Matrix 3 | "Ribbet" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | I hit 0x1FF subscribers, so celebrated with a live stream! 34 | 35 | Controls 36 | ~~~~~~~~ 37 | None, just spot the blonde, brunette, etc, etc... 38 | 39 | Author 40 | ~~~~~~ 41 | Twitter: @javidx9 42 | Blog: www.onelonecoder.com 43 | 44 | Video: 45 | ~~~~~~ 46 | https://youtu.be/s7EbrvA188A 47 | 48 | 49 | Last Updated: 17/09/2017 50 | */ 51 | 52 | 53 | /* Addition Joseph21 - 20220716 54 | * - removed "using namespace std" and added explicit scope resolution operator where needed 55 | * Port to PixelGameEngine - 20220715 56 | * - see cheat sheet for generic adaptations needed for port 57 | * - resized screen since characters are 8x8 pixels 58 | * - also adapted positioning of streamers and characters 59 | * - stopped using unicode for the characters to display (random ascii is displayed atm) 60 | * Port to SDL-GameEngine - 20221204 61 | * - standard port actions 62 | */ 63 | 64 | #include 65 | #include 66 | #include 67 | 68 | #include "SGE/SGE_Core.h" 69 | 70 | 71 | class OneLoneCoder_Matrix : public flc::SDL_GameEngine 72 | { 73 | public: 74 | OneLoneCoder_Matrix() 75 | { 76 | sAppName = "Matrix"; 77 | } 78 | 79 | private: 80 | struct sStreamer 81 | { 82 | int nColumn = 0; 83 | float fPosition = 0; 84 | float fSpeed = 0; 85 | std::string sText; 86 | }; 87 | 88 | std::list listStreamers; 89 | 90 | int nMaxStreamers = 300; 91 | 92 | char RandomCharacter() 93 | { 94 | // return (wchar_t)(rand() % 0x1EF + 0x00C0); 95 | return (char)(rand() % 93 + 33); // Random ASCII 96 | } 97 | 98 | void PrepareStreamer(sStreamer *s) 99 | { 100 | s->nColumn = rand() % ScreenWidth(); 101 | s->fPosition = 0; 102 | s->fSpeed = rand() % 40 + 5; 103 | s->sText.clear(); 104 | 105 | int nStreamerLength = rand() % 80 + 10; 106 | for (int i = 0; i < nStreamerLength; i++) 107 | s->sText.append(1, RandomCharacter()); 108 | 109 | // s->sText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 110 | } 111 | 112 | 113 | protected: 114 | // Called by olcConsoleGameEngine 115 | virtual bool OnUserCreate() 116 | { 117 | for (int n = 0; n < nMaxStreamers; n++) 118 | { 119 | sStreamer s; 120 | PrepareStreamer(&s); 121 | listStreamers.push_back(s); 122 | } 123 | return true; 124 | } 125 | 126 | // Called by olcConsoleGameEngine 127 | virtual bool OnUserUpdate(float fElapsedTime) 128 | { 129 | // Clear Screen 130 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), flc::BLACK); 131 | 132 | for (auto &s : listStreamers) 133 | { 134 | s.fPosition += fElapsedTime * s.fSpeed; 135 | for (int i = 0; i < (int)s.sText.size(); i++) 136 | { 137 | // If you hate ternary operators do this 138 | // start -> 139 | flc::Pixel col = s.fSpeed < 15.0f ? flc::DARK_GREEN : flc::GREEN; // ;-) 140 | if (i == 0) 141 | col = flc::WHITE; 142 | else 143 | if (i <= 3) 144 | col = flc::GREY; 145 | 146 | int nCharIndex = (i - (int)s.fPosition) % s.sText.size(); 147 | 148 | DrawString( s.nColumn, 8 * ((int)s.fPosition - i), std::string( 1, s.sText[nCharIndex] ), col ); 149 | // <- end 150 | 151 | // If you like them, do this! 152 | //Draw(s.nColumn, 8 * (int)s.fPosition - i, s.sText[(abs(i - (int)s.fPosition) % s.sText.size())], i == 0 ? flc::WHITE : i<=3 ? flc::GREY: i>=s.sText.size()-2 || s.fSpeed < 15.0f? flc::DARK_GREEN: flc::GREEN); 153 | 154 | // Missed this out on live stream, occasionally glitch a character 155 | if (rand() % 1000 < 5) 156 | s.sText[i] = RandomCharacter(); 157 | } 158 | 159 | if ( 8 * (s.fPosition - s.sText.size()) >= ScreenHeight()) 160 | PrepareStreamer(&s); 161 | 162 | } 163 | return true; 164 | } 165 | }; 166 | 167 | 168 | int main( int argc, char *argv[] ) 169 | { 170 | // Use SDL-GameEngine derived app 171 | OneLoneCoder_Matrix game; 172 | if (game.Construct(1000, 600, 1, 1)) 173 | game.Start(); 174 | return 0; 175 | } 176 | -------------------------------------------------------------------------------- /OneLoneCoder_Pseudo3DPlanesMode7.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Programming Pseudo 3D planes, aka MODE7 3 | "The SNES was too advanced for its time" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | 13 | https://www.github.com/onelonecoder 14 | https://www.onelonecoder.com 15 | https://www.youtube.com/javidx9 16 | 17 | GNU GPLv3 18 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 19 | 20 | From Javidx9 :) 21 | ~~~~~~~~~~~~~~~ 22 | Hello! Ultimately I don't care what you use this for. It's intended to be 23 | educational, and perhaps to the oddly minded - a little bit of fun. 24 | Please hack this, change it and use it in any way you see fit. You acknowledge 25 | that I am not responsible for anything bad that happens as a result of 26 | your actions. However this code is protected by GNU GPLv3, see the license in the 27 | github repo. This means you must attribute me if you use it. You can view this 28 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 29 | 30 | Cheers! 31 | 32 | Background 33 | ~~~~~~~~~~ 34 | Pseudo 3D was a technique made popular by the Super Nintendo 35 | in games such as Super Mario Kart. This code demonstrates the 36 | effect of that hardware mode. 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/ybLZyY655iY 46 | 47 | Last Updated: 15/04/2018 48 | */ 49 | 50 | 51 | /* Alterations Joseph21 - 2022-07-18 52 | * - changed path where sprites reside 53 | */ 54 | 55 | #include "olcConsoleGameEngine.h" 56 | 57 | class OneLoneCoder_FakeMode7 : public olcConsoleGameEngine 58 | { 59 | public: 60 | OneLoneCoder_FakeMode7() 61 | { 62 | m_sAppName = L"Pseudo 3D Planes"; 63 | } 64 | 65 | 66 | private: 67 | float fWorldX = 1000.0f; 68 | float fWorldY = 1000.0f; 69 | float fWorldA = 0.1f; 70 | float fNear = 0.005f; 71 | float fFar = 0.03f; 72 | float fFoVHalf = 3.14159f / 4.0f; 73 | 74 | olcSprite *sprGround; 75 | olcSprite *sprSky; 76 | 77 | int nMapSize = 1024; 78 | 79 | protected: 80 | virtual bool OnUserCreate() 81 | { 82 | // Create a large sprite and fill it with horizontal and vertical lines 83 | //sprGround = new olcSprite(nMapSize, nMapSize); 84 | 85 | //for (int x = 0; x <= nMapSize; x += 32) 86 | //{ 87 | // for (int y = 0; y < nMapSize; y++) 88 | // { 89 | // sprGround->SetColour(x, y, FG_MAGENTA); 90 | // sprGround->SetGlyph(x, y, PIXEL_SOLID); 91 | 92 | // sprGround->SetColour(x+1, y, FG_MAGENTA); 93 | // sprGround->SetGlyph(x+1, y, PIXEL_SOLID); 94 | 95 | // sprGround->SetColour(x-1, y, FG_MAGENTA); 96 | // sprGround->SetGlyph(x-1, y, PIXEL_SOLID); 97 | 98 | // sprGround->SetColour(y, x, FG_BLUE); 99 | // sprGround->SetGlyph(y, x, PIXEL_SOLID); 100 | 101 | // sprGround->SetColour(y, x+1, FG_BLUE); 102 | // sprGround->SetGlyph(y, x+1, PIXEL_SOLID); 103 | 104 | // sprGround->SetColour(y, x-1, FG_BLUE); 105 | // sprGround->SetGlyph(y, x-1, PIXEL_SOLID); 106 | // } 107 | //} 108 | 109 | // Simply load very large sprites from file 110 | sprGround = new olcSprite(L"Mode7Sprites/mariokart.spr"); 111 | sprSky = new olcSprite(L"Mode7Sprites/sky1.spr"); 112 | 113 | return true; 114 | } 115 | 116 | virtual bool OnUserUpdate(float fElapsedTime) 117 | { 118 | 119 | // Control rendering parameters dynamically 120 | if (GetKey(L'Q').bHeld) fNear += 0.1f * fElapsedTime; 121 | if (GetKey(L'A').bHeld) fNear -= 0.1f * fElapsedTime; 122 | 123 | if (GetKey(L'W').bHeld) fFar += 0.1f * fElapsedTime; 124 | if (GetKey(L'S').bHeld) fFar -= 0.1f * fElapsedTime; 125 | 126 | if (GetKey(L'Z').bHeld) fFoVHalf += 0.1f * fElapsedTime; 127 | if (GetKey(L'X').bHeld) fFoVHalf -= 0.1f * fElapsedTime; 128 | 129 | 130 | // Create Frustum corner points 131 | float fFarX1 = fWorldX + cosf(fWorldA - fFoVHalf) * fFar; 132 | float fFarY1 = fWorldY + sinf(fWorldA - fFoVHalf) * fFar; 133 | 134 | float fNearX1 = fWorldX + cosf(fWorldA - fFoVHalf) * fNear; 135 | float fNearY1 = fWorldY + sinf(fWorldA - fFoVHalf) * fNear; 136 | 137 | float fFarX2 = fWorldX + cosf(fWorldA + fFoVHalf) * fFar; 138 | float fFarY2 = fWorldY + sinf(fWorldA + fFoVHalf) * fFar; 139 | 140 | float fNearX2 = fWorldX + cosf(fWorldA + fFoVHalf) * fNear; 141 | float fNearY2 = fWorldY + sinf(fWorldA + fFoVHalf) * fNear; 142 | 143 | // Starting with furthest away line and work towards the camera point 144 | for (int y = 0; y < ScreenHeight() / 2; y++) 145 | { 146 | // Take a sample point for depth linearly related to rows down screen 147 | float fSampleDepth = (float)y / ((float)ScreenHeight() / 2.0f); 148 | 149 | // Use sample point in non-linear (1/x) way to enable perspective 150 | // and grab start and end points for lines across the screen 151 | float fStartX = (fFarX1 - fNearX1) / (fSampleDepth) + fNearX1; 152 | float fStartY = (fFarY1 - fNearY1) / (fSampleDepth) + fNearY1; 153 | float fEndX = (fFarX2 - fNearX2) / (fSampleDepth) + fNearX2; 154 | float fEndY = (fFarY2 - fNearY2) / (fSampleDepth) + fNearY2; 155 | 156 | // Linearly interpolate lines across the screen 157 | for (int x = 0; x < ScreenWidth(); x++) 158 | { 159 | float fSampleWidth = (float)x / (float)ScreenWidth(); 160 | float fSampleX = (fEndX - fStartX) * fSampleWidth + fStartX; 161 | float fSampleY = (fEndY - fStartY) * fSampleWidth + fStartY; 162 | 163 | // Wrap sample coordinates to give "infinite" periodicity on maps 164 | fSampleX = fmod(fSampleX, 1.0f); 165 | fSampleY = fmod(fSampleY, 1.0f); 166 | 167 | // Sample symbol and colour from map sprite, and draw the 168 | // pixel to the screen 169 | wchar_t sym = sprGround->SampleGlyph(fSampleX, fSampleY); 170 | short col = sprGround->SampleColour(fSampleX, fSampleY); 171 | Draw(x, y + (ScreenHeight() / 2), sym, col); 172 | 173 | // Sample symbol and colour from sky sprite, we can use same 174 | // coordinates, but we need to draw the "inverted" y-location 175 | sym = sprSky->SampleGlyph(fSampleX, fSampleY); 176 | col = sprSky->SampleColour(fSampleX, fSampleY); 177 | Draw(x, (ScreenHeight() / 2) - y, sym, col); 178 | } 179 | } 180 | 181 | // Draw a blanking line to fill the gap between sky and ground 182 | DrawLine(0, ScreenHeight() / 2, ScreenWidth(), ScreenHeight() / 2, PIXEL_SOLID, FG_CYAN); 183 | 184 | // Handle user navigation with arrow keys 185 | if (GetKey(VK_LEFT).bHeld) 186 | fWorldA -= 1.0f * fElapsedTime; 187 | 188 | if (GetKey(VK_RIGHT).bHeld) 189 | fWorldA += 1.0f * fElapsedTime; 190 | 191 | if (GetKey(VK_UP).bHeld) 192 | { 193 | fWorldX += cosf(fWorldA) * 0.2f * fElapsedTime; 194 | fWorldY += sinf(fWorldA) * 0.2f * fElapsedTime; 195 | } 196 | 197 | if (GetKey(VK_DOWN).bHeld) 198 | { 199 | fWorldX -= cosf(fWorldA) * 0.2f * fElapsedTime; 200 | fWorldY -= sinf(fWorldA) * 0.2f * fElapsedTime; 201 | } 202 | 203 | return true; 204 | } 205 | 206 | 207 | 208 | }; 209 | 210 | int main() 211 | { 212 | OneLoneCoder_FakeMode7 game; 213 | game.ConstructConsole(320, 240, 4, 4); 214 | game.Start(); 215 | return 0; 216 | } 217 | -------------------------------------------------------------------------------- /OneLoneCoder_Pseudo3DPlanesMode7.PGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Programming Pseudo 3D planes, aka MODE7 3 | "The SNES was too advanced for its time" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | 13 | https://www.github.com/onelonecoder 14 | https://www.onelonecoder.com 15 | https://www.youtube.com/javidx9 16 | 17 | GNU GPLv3 18 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 19 | 20 | From Javidx9 :) 21 | ~~~~~~~~~~~~~~~ 22 | Hello! Ultimately I don't care what you use this for. It's intended to be 23 | educational, and perhaps to the oddly minded - a little bit of fun. 24 | Please hack this, change it and use it in any way you see fit. You acknowledge 25 | that I am not responsible for anything bad that happens as a result of 26 | your actions. However this code is protected by GNU GPLv3, see the license in the 27 | github repo. This means you must attribute me if you use it. You can view this 28 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 29 | 30 | Cheers! 31 | 32 | Background 33 | ~~~~~~~~~~ 34 | Pseudo 3D was a technique made popular by the Super Nintendo 35 | in games such as Super Mario Kart. This code demonstrates the 36 | effect of that hardware mode. 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/ybLZyY655iY 46 | 47 | Last Updated: 15/04/2018 48 | */ 49 | 50 | 51 | /* Alterations Joseph21 - 2022-07-18 52 | * - changed path where sprites reside 53 | * Port to PixelGameEngine - 2022-07-18 54 | * - see cheat sheet for generic adaptations needed for port 55 | * - no specific points 56 | */ 57 | 58 | #define OLC_PGE_APPLICATION 59 | #include "olcPixelGameEngine.h" 60 | 61 | class OneLoneCoder_FakeMode7 : public olc::PixelGameEngine 62 | { 63 | public: 64 | OneLoneCoder_FakeMode7() 65 | { 66 | sAppName = "Pseudo 3D Planes"; 67 | } 68 | 69 | 70 | private: 71 | float fWorldX = 1000.0f; 72 | float fWorldY = 1000.0f; 73 | float fWorldA = 0.1f; 74 | float fNear = 0.005f; 75 | float fFar = 0.03f; 76 | float fFoVHalf = 3.14159f / 4.0f; 77 | 78 | olc::Sprite *sprGround; 79 | olc::Sprite *sprSky; 80 | 81 | int nMapSize = 1024; 82 | 83 | protected: 84 | virtual bool OnUserCreate() 85 | { 86 | // Create a large sprite and fill it with horizontal and vertical lines 87 | //sprGround = new olc::Sprite(nMapSize, nMapSize); 88 | 89 | //for (int x = 0; x <= nMapSize; x += 32) 90 | //{ 91 | // for (int y = 0; y < nMapSize; y++) 92 | // { 93 | // sprGround->SetColour(x, y, FG_MAGENTA); 94 | // sprGround->SetGlyph(x, y, PIXEL_SOLID); 95 | 96 | // sprGround->SetColour(x+1, y, FG_MAGENTA); 97 | // sprGround->SetGlyph(x+1, y, PIXEL_SOLID); 98 | 99 | // sprGround->SetColour(x-1, y, FG_MAGENTA); 100 | // sprGround->SetGlyph(x-1, y, PIXEL_SOLID); 101 | 102 | // sprGround->SetColour(y, x, FG_BLUE); 103 | // sprGround->SetGlyph(y, x, PIXEL_SOLID); 104 | 105 | // sprGround->SetColour(y, x+1, FG_BLUE); 106 | // sprGround->SetGlyph(y, x+1, PIXEL_SOLID); 107 | 108 | // sprGround->SetColour(y, x-1, FG_BLUE); 109 | // sprGround->SetGlyph(y, x-1, PIXEL_SOLID); 110 | // } 111 | //} 112 | 113 | // Simply load very large sprites from file 114 | sprGround = new olc::Sprite("Mode7Sprites/mariokart.png"); 115 | sprSky = new olc::Sprite("Mode7Sprites/sky1.png"); 116 | 117 | return true; 118 | } 119 | 120 | virtual bool OnUserUpdate(float fElapsedTime) 121 | { 122 | 123 | // Control rendering parameters dynamically 124 | if (GetKey(olc::Key::Q).bHeld) fNear += 0.1f * fElapsedTime; 125 | if (GetKey(olc::Key::A).bHeld) fNear -= 0.1f * fElapsedTime; 126 | 127 | if (GetKey(olc::Key::W).bHeld) fFar += 0.1f * fElapsedTime; 128 | if (GetKey(olc::Key::S).bHeld) fFar -= 0.1f * fElapsedTime; 129 | 130 | if (GetKey(olc::Key::Z).bHeld) fFoVHalf += 0.1f * fElapsedTime; 131 | if (GetKey(olc::Key::X).bHeld) fFoVHalf -= 0.1f * fElapsedTime; 132 | 133 | 134 | // Create Frustum corner points 135 | float fFarX1 = fWorldX + cosf(fWorldA - fFoVHalf) * fFar; 136 | float fFarY1 = fWorldY + sinf(fWorldA - fFoVHalf) * fFar; 137 | 138 | float fNearX1 = fWorldX + cosf(fWorldA - fFoVHalf) * fNear; 139 | float fNearY1 = fWorldY + sinf(fWorldA - fFoVHalf) * fNear; 140 | 141 | float fFarX2 = fWorldX + cosf(fWorldA + fFoVHalf) * fFar; 142 | float fFarY2 = fWorldY + sinf(fWorldA + fFoVHalf) * fFar; 143 | 144 | float fNearX2 = fWorldX + cosf(fWorldA + fFoVHalf) * fNear; 145 | float fNearY2 = fWorldY + sinf(fWorldA + fFoVHalf) * fNear; 146 | 147 | // Starting with furthest away line and work towards the camera point 148 | for (int y = 0; y < ScreenHeight() / 2; y++) 149 | { 150 | // Take a sample point for depth linearly related to rows down screen 151 | float fSampleDepth = (float)y / ((float)ScreenHeight() / 2.0f); 152 | 153 | // Use sample point in non-linear (1/x) way to enable perspective 154 | // and grab start and end points for lines across the screen 155 | float fStartX = (fFarX1 - fNearX1) / (fSampleDepth) + fNearX1; 156 | float fStartY = (fFarY1 - fNearY1) / (fSampleDepth) + fNearY1; 157 | float fEndX = (fFarX2 - fNearX2) / (fSampleDepth) + fNearX2; 158 | float fEndY = (fFarY2 - fNearY2) / (fSampleDepth) + fNearY2; 159 | 160 | // Linearly interpolate lines across the screen 161 | for (int x = 0; x < ScreenWidth(); x++) 162 | { 163 | float fSampleWidth = (float)x / (float)ScreenWidth(); 164 | float fSampleX = (fEndX - fStartX) * fSampleWidth + fStartX; 165 | float fSampleY = (fEndY - fStartY) * fSampleWidth + fStartY; 166 | 167 | // Wrap sample coordinates to give "infinite" periodicity on maps 168 | fSampleX = fmod(fSampleX, 1.0f); 169 | fSampleY = fmod(fSampleY, 1.0f); 170 | 171 | // Sample symbol and colour from map sprite, and draw the 172 | // pixel to the screen 173 | olc::Pixel col = sprGround->Sample(fSampleX, fSampleY); 174 | Draw(x, y + (ScreenHeight() / 2), col); 175 | 176 | // Sample symbol and colour from sky sprite, we can use same 177 | // coordinates, but we need to draw the "inverted" y-location 178 | col = sprSky->Sample(fSampleX, fSampleY); 179 | Draw(x, (ScreenHeight() / 2) - y, col); 180 | } 181 | } 182 | 183 | // Draw a blanking line to fill the gap between sky and ground 184 | DrawLine(0, ScreenHeight() / 2, ScreenWidth(), ScreenHeight() / 2, olc::CYAN); 185 | 186 | // Handle user navigation with arrow keys 187 | if (GetKey(olc::Key::LEFT).bHeld) 188 | fWorldA -= 1.0f * fElapsedTime; 189 | 190 | if (GetKey(olc::Key::RIGHT).bHeld) 191 | fWorldA += 1.0f * fElapsedTime; 192 | 193 | if (GetKey(olc::Key::UP).bHeld) 194 | { 195 | fWorldX += cosf(fWorldA) * 0.2f * fElapsedTime; 196 | fWorldY += sinf(fWorldA) * 0.2f * fElapsedTime; 197 | } 198 | 199 | if (GetKey(olc::Key::DOWN).bHeld) 200 | { 201 | fWorldX -= cosf(fWorldA) * 0.2f * fElapsedTime; 202 | fWorldY -= sinf(fWorldA) * 0.2f * fElapsedTime; 203 | } 204 | 205 | return true; 206 | } 207 | 208 | 209 | 210 | }; 211 | 212 | int main() 213 | { 214 | OneLoneCoder_FakeMode7 game; 215 | if (game.Construct(320, 240, 4, 4)) 216 | game.Start(); 217 | return 0; 218 | } 219 | -------------------------------------------------------------------------------- /OneLoneCoder_Pseudo3DPlanesMode7.SGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Programming Pseudo 3D planes, aka MODE7 3 | "The SNES was too advanced for its time" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | 13 | https://www.github.com/onelonecoder 14 | https://www.onelonecoder.com 15 | https://www.youtube.com/javidx9 16 | 17 | GNU GPLv3 18 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 19 | 20 | From Javidx9 :) 21 | ~~~~~~~~~~~~~~~ 22 | Hello! Ultimately I don't care what you use this for. It's intended to be 23 | educational, and perhaps to the oddly minded - a little bit of fun. 24 | Please hack this, change it and use it in any way you see fit. You acknowledge 25 | that I am not responsible for anything bad that happens as a result of 26 | your actions. However this code is protected by GNU GPLv3, see the license in the 27 | github repo. This means you must attribute me if you use it. You can view this 28 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 29 | 30 | Cheers! 31 | 32 | Background 33 | ~~~~~~~~~~ 34 | Pseudo 3D was a technique made popular by the Super Nintendo 35 | in games such as Super Mario Kart. This code demonstrates the 36 | effect of that hardware mode. 37 | 38 | Author 39 | ~~~~~~ 40 | Twitter: @javidx9 41 | Blog: www.onelonecoder.com 42 | 43 | Video: 44 | ~~~~~~ 45 | https://youtu.be/ybLZyY655iY 46 | 47 | Last Updated: 15/04/2018 48 | */ 49 | 50 | 51 | /* Alterations Joseph21 - 2022-07-18 52 | * - changed path where sprites reside 53 | * Port to PixelGameEngine - 2022-07-18 54 | * - see cheat sheet for generic adaptations needed for port 55 | * - no specific points 56 | * Port to SDL-GameEngine - 2022-12-09 57 | * - generic port actions, no specifics needed 58 | */ 59 | 60 | 61 | #include "SGE/SGE_Core.h" 62 | 63 | class OneLoneCoder_FakeMode7 : public flc::SDL_GameEngine 64 | { 65 | public: 66 | OneLoneCoder_FakeMode7() 67 | { 68 | sAppName = "Pseudo 3D Planes"; 69 | } 70 | 71 | 72 | private: 73 | float fWorldX = 1000.0f; 74 | float fWorldY = 1000.0f; 75 | float fWorldA = 0.1f; 76 | float fNear = 0.005f; 77 | float fFar = 0.03f; 78 | float fFoVHalf = 3.14159f / 4.0f; 79 | 80 | flc::Sprite *sprGround; 81 | flc::Sprite *sprSky; 82 | 83 | int nMapSize = 1024; 84 | 85 | protected: 86 | virtual bool OnUserCreate() 87 | { 88 | // Create a large sprite and fill it with horizontal and vertical lines 89 | //sprGround = new flc::Sprite(nMapSize, nMapSize); 90 | 91 | //for (int x = 0; x <= nMapSize; x += 32) 92 | //{ 93 | // for (int y = 0; y < nMapSize; y++) 94 | // { 95 | // sprGround->SetColour(x, y, FG_MAGENTA); 96 | // sprGround->SetGlyph(x, y, PIXEL_SOLID); 97 | 98 | // sprGround->SetColour(x+1, y, FG_MAGENTA); 99 | // sprGround->SetGlyph(x+1, y, PIXEL_SOLID); 100 | 101 | // sprGround->SetColour(x-1, y, FG_MAGENTA); 102 | // sprGround->SetGlyph(x-1, y, PIXEL_SOLID); 103 | 104 | // sprGround->SetColour(y, x, FG_BLUE); 105 | // sprGround->SetGlyph(y, x, PIXEL_SOLID); 106 | 107 | // sprGround->SetColour(y, x+1, FG_BLUE); 108 | // sprGround->SetGlyph(y, x+1, PIXEL_SOLID); 109 | 110 | // sprGround->SetColour(y, x-1, FG_BLUE); 111 | // sprGround->SetGlyph(y, x-1, PIXEL_SOLID); 112 | // } 113 | //} 114 | 115 | // Simply load very large sprites from file 116 | sprGround = new flc::Sprite("Mode7Sprites/mariokart.png"); 117 | sprSky = new flc::Sprite("Mode7Sprites/sky1.png"); 118 | 119 | return true; 120 | } 121 | 122 | virtual bool OnUserUpdate(float fElapsedTime) 123 | { 124 | 125 | // Control rendering parameters dynamically 126 | if (GetKey(flc::Key::Q).bHeld) fNear += 0.1f * fElapsedTime; 127 | if (GetKey(flc::Key::A).bHeld) fNear -= 0.1f * fElapsedTime; 128 | 129 | if (GetKey(flc::Key::W).bHeld) fFar += 0.1f * fElapsedTime; 130 | if (GetKey(flc::Key::S).bHeld) fFar -= 0.1f * fElapsedTime; 131 | 132 | if (GetKey(flc::Key::Z).bHeld) fFoVHalf += 0.1f * fElapsedTime; 133 | if (GetKey(flc::Key::X).bHeld) fFoVHalf -= 0.1f * fElapsedTime; 134 | 135 | 136 | // Create Frustum corner points 137 | float fFarX1 = fWorldX + cosf(fWorldA - fFoVHalf) * fFar; 138 | float fFarY1 = fWorldY + sinf(fWorldA - fFoVHalf) * fFar; 139 | 140 | float fNearX1 = fWorldX + cosf(fWorldA - fFoVHalf) * fNear; 141 | float fNearY1 = fWorldY + sinf(fWorldA - fFoVHalf) * fNear; 142 | 143 | float fFarX2 = fWorldX + cosf(fWorldA + fFoVHalf) * fFar; 144 | float fFarY2 = fWorldY + sinf(fWorldA + fFoVHalf) * fFar; 145 | 146 | float fNearX2 = fWorldX + cosf(fWorldA + fFoVHalf) * fNear; 147 | float fNearY2 = fWorldY + sinf(fWorldA + fFoVHalf) * fNear; 148 | 149 | // Starting with furthest away line and work towards the camera point 150 | for (int y = 0; y < ScreenHeight() / 2; y++) 151 | { 152 | // Take a sample point for depth linearly related to rows down screen 153 | float fSampleDepth = (float)y / ((float)ScreenHeight() / 2.0f); 154 | 155 | // Use sample point in non-linear (1/x) way to enable perspective 156 | // and grab start and end points for lines across the screen 157 | float fStartX = (fFarX1 - fNearX1) / (fSampleDepth) + fNearX1; 158 | float fStartY = (fFarY1 - fNearY1) / (fSampleDepth) + fNearY1; 159 | float fEndX = (fFarX2 - fNearX2) / (fSampleDepth) + fNearX2; 160 | float fEndY = (fFarY2 - fNearY2) / (fSampleDepth) + fNearY2; 161 | 162 | // Linearly interpolate lines across the screen 163 | for (int x = 0; x < ScreenWidth(); x++) 164 | { 165 | float fSampleWidth = (float)x / (float)ScreenWidth(); 166 | float fSampleX = (fEndX - fStartX) * fSampleWidth + fStartX; 167 | float fSampleY = (fEndY - fStartY) * fSampleWidth + fStartY; 168 | 169 | // Wrap sample coordinates to give "infinite" periodicity on maps 170 | fSampleX = fmod(fSampleX, 1.0f); 171 | fSampleY = fmod(fSampleY, 1.0f); 172 | 173 | // Sample symbol and colour from map sprite, and draw the 174 | // pixel to the screen 175 | flc::Pixel col = sprGround->Sample(fSampleX, fSampleY); 176 | Draw(x, y + (ScreenHeight() / 2), col); 177 | 178 | // Sample symbol and colour from sky sprite, we can use same 179 | // coordinates, but we need to draw the "inverted" y-location 180 | col = sprSky->Sample(fSampleX, fSampleY); 181 | Draw(x, (ScreenHeight() / 2) - y, col); 182 | } 183 | } 184 | 185 | // Draw a blanking line to fill the gap between sky and ground 186 | DrawLine(0, ScreenHeight() / 2, ScreenWidth(), ScreenHeight() / 2, flc::CYAN); 187 | 188 | // Handle user navigation with arrow keys 189 | if (GetKey(flc::Key::LEFT).bHeld) 190 | fWorldA -= 1.0f * fElapsedTime; 191 | 192 | if (GetKey(flc::Key::RIGHT).bHeld) 193 | fWorldA += 1.0f * fElapsedTime; 194 | 195 | if (GetKey(flc::Key::UP).bHeld) 196 | { 197 | fWorldX += cosf(fWorldA) * 0.2f * fElapsedTime; 198 | fWorldY += sinf(fWorldA) * 0.2f * fElapsedTime; 199 | } 200 | 201 | if (GetKey(flc::Key::DOWN).bHeld) 202 | { 203 | fWorldX -= cosf(fWorldA) * 0.2f * fElapsedTime; 204 | fWorldY -= sinf(fWorldA) * 0.2f * fElapsedTime; 205 | } 206 | 207 | return true; 208 | } 209 | }; 210 | 211 | int main( int argc, char *argv[] ) 212 | { 213 | OneLoneCoder_FakeMode7 game; 214 | if (game.Construct(320, 240, 4, 4)) 215 | game.Start(); 216 | return 0; 217 | } 218 | -------------------------------------------------------------------------------- /OneLoneCoder_Snake.CON.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Command Line Snake 3 | "Give me a break, I'm on holiday..." - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Classic Snake! Controls are Arrow keys Left & Right, eat food, grow larger, avoid self! 34 | 35 | 36 | Author 37 | ~~~~~~ 38 | Twitter: @javidx9 39 | Blog: www.onelonecoder.com 40 | 41 | Video: 42 | ~~~~~~ 43 | https://youtu.be/e8lYLYlrGLg 44 | 45 | Last Updated: 24/06/2017 46 | */ 47 | 48 | 49 | /* Alterations to original (console) code - Joseph21 - 2022-11-19 50 | * - removed "using namespace std" and added explicit scope resolution operator where needed 51 | * - added explicit cast std::chrono::milliseconds() around 120ms and 200ms to solve errors 52 | */ 53 | 54 | #include 55 | #include 56 | #include 57 | //using namespace std; 58 | 59 | #include 60 | 61 | int nScreenWidth = 120; 62 | int nScreenHeight = 30; 63 | 64 | struct sSnakeSegment 65 | { 66 | int x; 67 | int y; 68 | }; 69 | 70 | int main() 71 | { 72 | // Create Screen Buffer 73 | wchar_t *screen = new wchar_t[nScreenWidth*nScreenHeight]; 74 | for (int i = 0; i < nScreenWidth*nScreenHeight; i++) screen[i] = L' '; 75 | HANDLE hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); 76 | SetConsoleActiveScreenBuffer(hConsole); 77 | DWORD dwBytesWritten = 0; 78 | 79 | while(1) 80 | { 81 | // Reset to known state 82 | std::list snake = { {60,15},{61,15},{62,15},{63,15},{64,15},{65,15},{66,15},{67,15},{68,15},{69,15} }; 83 | int nFoodX = 30; 84 | int nFoodY = 15; 85 | int nScore = 0; 86 | int nSnakeDirection = 3; 87 | bool bDead = false; 88 | bool bKeyLeft = false, bKeyRight = false, bKeyLeftOld = false, bKeyRightOld = false; 89 | 90 | while (!bDead) 91 | { 92 | // Frame Timing, compensate for aspect ratio of command line 93 | auto t1 = std::chrono::system_clock::now(); 94 | while ((std::chrono::system_clock::now() - t1) < ((nSnakeDirection % 2 == 1) ? std::chrono::milliseconds(120) : std::chrono::milliseconds(200))) 95 | { 96 | // Get Input, 97 | bKeyRight = (0x8000 & GetAsyncKeyState((unsigned char)('\x27'))) != 0; 98 | bKeyLeft = (0x8000 & GetAsyncKeyState((unsigned char)('\x25'))) != 0; 99 | 100 | if (bKeyRight && !bKeyRightOld) 101 | { 102 | nSnakeDirection++; 103 | if (nSnakeDirection == 4) nSnakeDirection = 0; 104 | } 105 | 106 | if (bKeyLeft && !bKeyLeftOld) 107 | { 108 | nSnakeDirection--; 109 | if (nSnakeDirection == -1) nSnakeDirection = 3; 110 | } 111 | 112 | bKeyRightOld = bKeyRight; 113 | bKeyLeftOld = bKeyLeft; 114 | } 115 | 116 | // ==== Logic 117 | 118 | // Update Snake Position, place a new head at the front of the list in 119 | // the right direction 120 | switch (nSnakeDirection) 121 | { 122 | case 0: // UP 123 | snake.push_front({ snake.front().x, snake.front().y - 1 }); 124 | break; 125 | case 1: // RIGHT 126 | snake.push_front({ snake.front().x + 1, snake.front().y }); 127 | break; 128 | case 2: // DOWN 129 | snake.push_front({ snake.front().x, snake.front().y + 1 }); 130 | break; 131 | case 3: // LEFT 132 | snake.push_front({ snake.front().x - 1, snake.front().y }); 133 | break; 134 | } 135 | 136 | // Collision Detect Snake V Food 137 | if (snake.front().x == nFoodX && snake.front().y == nFoodY) 138 | { 139 | nScore++; 140 | while (screen[nFoodY * nScreenWidth + nFoodX] != L' ') 141 | { 142 | nFoodX = rand() % nScreenWidth; 143 | nFoodY = (rand() % (nScreenHeight-3))+3; 144 | } 145 | 146 | for (int i = 0; i < 5; i++) 147 | snake.push_back({ snake.back().x, snake.back().y }); 148 | } 149 | 150 | // Collision Detect Snake V World 151 | if (snake.front().x < 0 || snake.front().x >= nScreenWidth) 152 | bDead = true; 153 | if (snake.front().y < 3 || snake.front().y >= nScreenHeight) 154 | bDead = true; 155 | 156 | // Collision Detect Snake V Snake 157 | for (std::list::iterator i = snake.begin(); i != snake.end(); i++) 158 | if (i != snake.begin() && i->x == snake.front().x && i->y == snake.front().y) 159 | bDead = true; 160 | 161 | // Chop off Snakes tail :-/ 162 | snake.pop_back(); 163 | 164 | // ==== Presentation 165 | 166 | // Clear Screen 167 | for (int i = 0; i < nScreenWidth*nScreenHeight; i++) screen[i] = L' '; 168 | 169 | // Draw Stats & Border 170 | for (int i = 0; i < nScreenWidth; i++) 171 | { 172 | screen[i] = L'='; 173 | screen[2 * nScreenWidth + i] = L'='; 174 | } 175 | wsprintf(&screen[nScreenWidth + 5], L"www.OneLoneCoder.com - S N A K E ! ! SCORE: %d", nScore); 176 | 177 | 178 | // Draw Snake Body 179 | for (auto s : snake) 180 | screen[s.y * nScreenWidth + s.x] = bDead ? L'+' : L'O'; 181 | 182 | // Draw Snake Head 183 | screen[snake.front().y * nScreenWidth + snake.front().x] = bDead ? L'X' : L'@'; 184 | 185 | // Draw Food 186 | screen[nFoodY * nScreenWidth + nFoodX] = L'%'; 187 | 188 | if (bDead) 189 | wsprintf(&screen[15 * nScreenWidth + 40], L" PRESS 'SPACE' TO PLAY AGAIN "); 190 | 191 | // Display Frame 192 | WriteConsoleOutputCharacter(hConsole, screen, nScreenWidth * nScreenHeight, { 0,0 }, &dwBytesWritten); 193 | } 194 | 195 | // Wait for space 196 | while ((0x8000 & GetAsyncKeyState((unsigned char)('\x20'))) == 0); 197 | } 198 | 199 | return 0; 200 | } 201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /OneLoneCoder_Splines1.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Splines Part 1 3 | "Bendy Wavy Curly" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Curvy things are always better. Splines are a nice way to approximate 34 | curves and loops for games. This video is the first of two parts 35 | demonstrating how Catmull-Rom splines can be implemented. 36 | 37 | Use Z + X to select a point and move it with the arrow keys 38 | Use A + S to move the agent around the spline loop 39 | 40 | Author 41 | ~~~~~~ 42 | Twitter: @javidx9 43 | Blog: www.onelonecoder.com 44 | 45 | Video: 46 | ~~~~~~ 47 | https://youtu.be/9_aJGUTePYo 48 | 49 | Last Updated: 06/08/2017 50 | */ 51 | 52 | 53 | /* Addition Joseph21 - 20220715 54 | * - removed "using namespace std" and added explicit scope resolution operator where needed 55 | */ 56 | 57 | #include 58 | #include 59 | //using namespace std; 60 | 61 | #include "olcConsoleGameEngine.h" 62 | 63 | struct sPoint2D 64 | { 65 | float x; 66 | float y; 67 | }; 68 | 69 | struct sSpline 70 | { 71 | std::vector points; 72 | 73 | sPoint2D GetSplinePoint(float t, bool bLooped = false) 74 | { 75 | int p0, p1, p2, p3; 76 | if (!bLooped) 77 | { 78 | p1 = (int)t + 1; 79 | p2 = p1 + 1; 80 | p3 = p2 + 1; 81 | p0 = p1 - 1; 82 | } 83 | else 84 | { 85 | p1 = (int)t; 86 | p2 = (p1 + 1) % points.size(); 87 | p3 = (p2 + 1) % points.size(); 88 | p0 = p1 >= 1 ? p1 - 1 : points.size() - 1; 89 | } 90 | 91 | t = t - (int)t; 92 | 93 | float tt = t * t; 94 | float ttt = tt * t; 95 | 96 | float q1 = -ttt + 2.0f*tt - t; 97 | float q2 = 3.0f*ttt - 5.0f*tt + 2.0f; 98 | float q3 = -3.0f*ttt + 4.0f*tt + t; 99 | float q4 = ttt - tt; 100 | 101 | float tx = 0.5f * (points[p0].x * q1 + points[p1].x * q2 + points[p2].x * q3 + points[p3].x * q4); 102 | float ty = 0.5f * (points[p0].y * q1 + points[p1].y * q2 + points[p2].y * q3 + points[p3].y * q4); 103 | 104 | return{ tx, ty }; 105 | } 106 | 107 | sPoint2D GetSplineGradient(float t, bool bLooped = false) 108 | { 109 | int p0, p1, p2, p3; 110 | if (!bLooped) 111 | { 112 | p1 = (int)t + 1; 113 | p2 = p1 + 1; 114 | p3 = p2 + 1; 115 | p0 = p1 - 1; 116 | } 117 | else 118 | { 119 | p1 = (int)t; 120 | p2 = (p1 + 1) % points.size(); 121 | p3 = (p2 + 1) % points.size(); 122 | p0 = p1 >= 1 ? p1 - 1 : points.size() - 1; 123 | } 124 | 125 | t = t - (int)t; 126 | 127 | float tt = t * t; 128 | float ttt = tt * t; 129 | 130 | float q1 = -3.0f * tt + 4.0f*t - 1; 131 | float q2 = 9.0f*tt - 10.0f*t; 132 | float q3 = -9.0f*tt + 8.0f*t + 1.0f; 133 | float q4 = 3.0f*tt - 2.0f*t; 134 | 135 | float tx = 0.5f * (points[p0].x * q1 + points[p1].x * q2 + points[p2].x * q3 + points[p3].x * q4); 136 | float ty = 0.5f * (points[p0].y * q1 + points[p1].y * q2 + points[p2].y * q3 + points[p3].y * q4); 137 | 138 | return{ tx, ty }; 139 | } 140 | }; 141 | 142 | class OneLoneCoder_Splines : public olcConsoleGameEngine 143 | { 144 | public: 145 | OneLoneCoder_Splines() 146 | { 147 | m_sAppName = L"Splines"; 148 | } 149 | 150 | private: 151 | sSpline path; 152 | int nSelectedPoint = 0; 153 | float fMarker = 0.0f; 154 | 155 | protected: 156 | // Called by olcConsoleGameEngine 157 | virtual bool OnUserCreate() 158 | { 159 | //path.points = { { 10, 41 },{ 40, 41 },{ 70, 41 },{ 100, 41 } }; 160 | path.points = { { 10, 41 },{ 20, 41 },{ 30, 41 },{ 40, 41 },{ 50, 41 },{ 60, 41 },{ 70, 41 },{ 80, 41 },{ 90, 41 },{ 100, 41 } }; 161 | return true; 162 | } 163 | 164 | // Called by olcConsoleGameEngine 165 | virtual bool OnUserUpdate(float fElapsedTime) 166 | { 167 | // Clear Screen 168 | Fill(0, 0, ScreenWidth(), ScreenHeight(), L' '); 169 | 170 | // Handle input 171 | if (m_keys[L'X'].bReleased) 172 | { 173 | nSelectedPoint++; 174 | if (nSelectedPoint >= path.points.size()) 175 | nSelectedPoint = 0; 176 | } 177 | 178 | if (m_keys[L'Z'].bReleased) 179 | { 180 | nSelectedPoint--; 181 | if (nSelectedPoint < 0) 182 | nSelectedPoint = path.points.size() - 1; 183 | } 184 | 185 | if (m_keys[VK_LEFT].bHeld) 186 | path.points[nSelectedPoint].x -= 30.0f * fElapsedTime; 187 | 188 | if (m_keys[VK_RIGHT].bHeld) 189 | path.points[nSelectedPoint].x += 30.0f * fElapsedTime; 190 | 191 | if (m_keys[VK_UP].bHeld) 192 | path.points[nSelectedPoint].y -= 30.0f * fElapsedTime; 193 | 194 | if (m_keys[VK_DOWN].bHeld) 195 | path.points[nSelectedPoint].y += 30.0f * fElapsedTime; 196 | 197 | if (m_keys[L'A'].bHeld) 198 | fMarker -= 5.0f * fElapsedTime; 199 | 200 | if (m_keys[L'S'].bHeld) 201 | fMarker += 5.0f * fElapsedTime; 202 | 203 | if (fMarker >= (float)path.points.size()) 204 | fMarker -= (float)path.points.size(); 205 | 206 | if (fMarker < 0.0f) 207 | fMarker += (float)path.points.size(); 208 | 209 | // Draw Spline 210 | for (float t = 0; t < (float)path.points.size(); t += 0.005f) 211 | { 212 | sPoint2D pos = path.GetSplinePoint(t, true); 213 | Draw(pos.x, pos.y); 214 | } 215 | 216 | // Draw Control Points 217 | for (int i = 0; i < path.points.size(); i++) 218 | { 219 | Fill(path.points[i].x - 1, path.points[i].y - 1, path.points[i].x + 2, path.points[i].y + 2, PIXEL_SOLID, FG_RED); 220 | DrawString(path.points[i].x, path.points[i].y, std::to_wstring(i)); 221 | } 222 | 223 | // Highlight control point 224 | Fill(path.points[nSelectedPoint].x - 1, path.points[nSelectedPoint].y - 1, path.points[nSelectedPoint].x + 2, path.points[nSelectedPoint].y + 2, PIXEL_SOLID, FG_YELLOW); 225 | DrawString(path.points[nSelectedPoint].x, path.points[nSelectedPoint].y, std::to_wstring(nSelectedPoint)); 226 | 227 | // Draw agent to demonstrate gradient 228 | sPoint2D p1 = path.GetSplinePoint(fMarker, true); 229 | sPoint2D g1 = path.GetSplineGradient(fMarker, true); 230 | float r = atan2(-g1.y, g1.x); 231 | DrawLine(5.0f * sin(r) + p1.x, 5.0f * cos(r) + p1.y, -5.0f * sin(r) + p1.x, -5.0f * cos(r) + p1.y, PIXEL_SOLID, FG_BLUE); 232 | return true; 233 | } 234 | }; 235 | 236 | int main() 237 | { 238 | OneLoneCoder_Splines demo; 239 | demo.ConstructConsole(160, 80, 10, 10); 240 | demo.Start(); 241 | return 0; 242 | } 243 | -------------------------------------------------------------------------------- /OneLoneCoder_Splines1.PGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Splines Part 1 3 | "Bendy Wavy Curly" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Curvy things are always better. Splines are a nice way to approximate 34 | curves and loops for games. This video is the first of two parts 35 | demonstrating how Catmull-Rom splines can be implemented. 36 | 37 | Use Z + X to select a point and move it with the arrow keys 38 | Use A + S to move the agent around the spline loop 39 | 40 | Author 41 | ~~~~~~ 42 | Twitter: @javidx9 43 | Blog: www.onelonecoder.com 44 | 45 | Video: 46 | ~~~~~~ 47 | https://youtu.be/9_aJGUTePYo 48 | 49 | Last Updated: 06/08/2017 50 | */ 51 | 52 | 53 | /* Addition Joseph21 - 20220715 54 | * - removed "using namespace std" and added explicit scope resolution operator where needed 55 | * Port to PixelGameEngine - 20220715 56 | * - see cheat sheet for generic adaptations needed for port 57 | * - implemented other screen characteristics 58 | */ 59 | 60 | #include 61 | #include 62 | //using namespace std; 63 | 64 | #define OLC_PGE_APPLICATION 65 | #include "olcPixelGameEngine.h" 66 | 67 | struct sPoint2D 68 | { 69 | float x; 70 | float y; 71 | }; 72 | 73 | struct sSpline 74 | { 75 | std::vector points; 76 | 77 | sPoint2D GetSplinePoint(float t, bool bLooped = false) 78 | { 79 | int p0, p1, p2, p3; 80 | if (!bLooped) 81 | { 82 | p1 = (int)t + 1; 83 | p2 = p1 + 1; 84 | p3 = p2 + 1; 85 | p0 = p1 - 1; 86 | } 87 | else 88 | { 89 | p1 = (int)t; 90 | p2 = (p1 + 1) % points.size(); 91 | p3 = (p2 + 1) % points.size(); 92 | p0 = p1 >= 1 ? p1 - 1 : points.size() - 1; 93 | } 94 | 95 | t = t - (int)t; 96 | 97 | float tt = t * t; 98 | float ttt = tt * t; 99 | 100 | float q1 = -ttt + 2.0f*tt - t; 101 | float q2 = 3.0f*ttt - 5.0f*tt + 2.0f; 102 | float q3 = -3.0f*ttt + 4.0f*tt + t; 103 | float q4 = ttt - tt; 104 | 105 | float tx = 0.5f * (points[p0].x * q1 + points[p1].x * q2 + points[p2].x * q3 + points[p3].x * q4); 106 | float ty = 0.5f * (points[p0].y * q1 + points[p1].y * q2 + points[p2].y * q3 + points[p3].y * q4); 107 | 108 | return{ tx, ty }; 109 | } 110 | 111 | sPoint2D GetSplineGradient(float t, bool bLooped = false) 112 | { 113 | int p0, p1, p2, p3; 114 | if (!bLooped) 115 | { 116 | p1 = (int)t + 1; 117 | p2 = p1 + 1; 118 | p3 = p2 + 1; 119 | p0 = p1 - 1; 120 | } 121 | else 122 | { 123 | p1 = (int)t; 124 | p2 = (p1 + 1) % points.size(); 125 | p3 = (p2 + 1) % points.size(); 126 | p0 = p1 >= 1 ? p1 - 1 : points.size() - 1; 127 | } 128 | 129 | t = t - (int)t; 130 | 131 | float tt = t * t; 132 | float ttt = tt * t; 133 | 134 | float q1 = -3.0f * tt + 4.0f*t - 1; 135 | float q2 = 9.0f*tt - 10.0f*t; 136 | float q3 = -9.0f*tt + 8.0f*t + 1.0f; 137 | float q4 = 3.0f*tt - 2.0f*t; 138 | 139 | float tx = 0.5f * (points[p0].x * q1 + points[p1].x * q2 + points[p2].x * q3 + points[p3].x * q4); 140 | float ty = 0.5f * (points[p0].y * q1 + points[p1].y * q2 + points[p2].y * q3 + points[p3].y * q4); 141 | 142 | return{ tx, ty }; 143 | } 144 | }; 145 | 146 | class OneLoneCoder_Splines : public olc::PixelGameEngine 147 | { 148 | public: 149 | OneLoneCoder_Splines() 150 | { 151 | sAppName = "Splines"; 152 | } 153 | 154 | private: 155 | sSpline path; 156 | int nSelectedPoint = 0; 157 | float fMarker = 0.0f; 158 | 159 | protected: 160 | // Called by olcConsoleGameEngine 161 | virtual bool OnUserCreate() 162 | { 163 | //path.points = { { 10, 41 },{ 40, 41 },{ 70, 41 },{ 100, 41 } }; 164 | path.points = { { 10, 41 },{ 20, 41 },{ 30, 41 },{ 40, 41 },{ 50, 41 },{ 60, 41 },{ 70, 41 },{ 80, 41 },{ 90, 41 },{ 100, 41 } }; 165 | return true; 166 | } 167 | 168 | // Called by olcConsoleGameEngine 169 | virtual bool OnUserUpdate(float fElapsedTime) 170 | { 171 | // Clear Screen 172 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), olc::BLACK); 173 | 174 | // Handle input 175 | if (GetKey(olc::Key::X).bReleased) 176 | { 177 | nSelectedPoint++; 178 | if (nSelectedPoint >= path.points.size()) 179 | nSelectedPoint = 0; 180 | } 181 | 182 | if (GetKey(olc::Key::Z).bReleased) 183 | { 184 | nSelectedPoint--; 185 | if (nSelectedPoint < 0) 186 | nSelectedPoint = path.points.size() - 1; 187 | } 188 | 189 | if (GetKey(olc::Key::LEFT).bHeld) 190 | path.points[nSelectedPoint].x -= 30.0f * fElapsedTime; 191 | 192 | if (GetKey(olc::Key::RIGHT).bHeld) 193 | path.points[nSelectedPoint].x += 30.0f * fElapsedTime; 194 | 195 | if (GetKey(olc::Key::UP).bHeld) 196 | path.points[nSelectedPoint].y -= 30.0f * fElapsedTime; 197 | 198 | if (GetKey(olc::Key::DOWN).bHeld) 199 | path.points[nSelectedPoint].y += 30.0f * fElapsedTime; 200 | 201 | if (GetKey(olc::Key::A).bHeld) 202 | fMarker -= 5.0f * fElapsedTime; 203 | 204 | if (GetKey(olc::Key::S).bHeld) 205 | fMarker += 5.0f * fElapsedTime; 206 | 207 | if (fMarker >= (float)path.points.size()) 208 | fMarker -= (float)path.points.size(); 209 | 210 | if (fMarker < 0.0f) 211 | fMarker += (float)path.points.size(); 212 | 213 | // Draw Spline 214 | for (float t = 0; t < (float)path.points.size(); t += 0.005f) 215 | { 216 | sPoint2D pos = path.GetSplinePoint(t, true); 217 | Draw(pos.x, pos.y); 218 | } 219 | 220 | // Draw Control Points 221 | for (int i = 0; i < path.points.size(); i++) 222 | { 223 | FillRect(path.points[i].x - 1, path.points[i].y - 1, 3, 3, olc::RED); 224 | DrawString(path.points[i].x, path.points[i].y, std::to_string(i)); 225 | } 226 | 227 | // Highlight control point 228 | FillRect(path.points[nSelectedPoint].x - 1, path.points[nSelectedPoint].y - 1, 3, 3, olc::YELLOW); 229 | DrawString(path.points[nSelectedPoint].x, path.points[nSelectedPoint].y, std::to_string(nSelectedPoint)); 230 | 231 | // Draw agent to demonstrate gradient 232 | sPoint2D p1 = path.GetSplinePoint(fMarker, true); 233 | sPoint2D g1 = path.GetSplineGradient(fMarker, true); 234 | float r = atan2(-g1.y, g1.x); 235 | DrawLine(5.0f * sin(r) + p1.x, 5.0f * cos(r) + p1.y, -5.0f * sin(r) + p1.x, -5.0f * cos(r) + p1.y, olc::BLUE); 236 | return true; 237 | } 238 | }; 239 | 240 | int main() 241 | { 242 | OneLoneCoder_Splines demo; 243 | if (demo.Construct(240, 150, 4, 4)) 244 | demo.Start(); 245 | return 0; 246 | } 247 | -------------------------------------------------------------------------------- /OneLoneCoder_Splines1.SGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Splines Part 1 3 | "Bendy Wavy Curly" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Curvy things are always better. Splines are a nice way to approximate 34 | curves and loops for games. This video is the first of two parts 35 | demonstrating how Catmull-Rom splines can be implemented. 36 | 37 | Use Z + X to select a point and move it with the arrow keys 38 | Use A + S to move the agent around the spline loop 39 | 40 | Author 41 | ~~~~~~ 42 | Twitter: @javidx9 43 | Blog: www.onelonecoder.com 44 | 45 | Video: 46 | ~~~~~~ 47 | https://youtu.be/9_aJGUTePYo 48 | 49 | Last Updated: 06/08/2017 50 | */ 51 | 52 | 53 | /* Addition Joseph21 - 20220715 54 | * - removed "using namespace std" and added explicit scope resolution operator where needed 55 | * Port to PixelGameEngine - 20220715 56 | * - see cheat sheet for generic adaptations needed for port 57 | * - implemented other screen characteristics 58 | * Port to SDL-GameEngine - 20221204 59 | * - generic port, no specifics 60 | */ 61 | 62 | #include 63 | #include 64 | 65 | #include "SGE/SGE_Core.h" 66 | 67 | struct sPoint2D 68 | { 69 | float x; 70 | float y; 71 | }; 72 | 73 | struct sSpline 74 | { 75 | std::vector points; 76 | 77 | sPoint2D GetSplinePoint(float t, bool bLooped = false) 78 | { 79 | int p0, p1, p2, p3; 80 | if (!bLooped) 81 | { 82 | p1 = (int)t + 1; 83 | p2 = p1 + 1; 84 | p3 = p2 + 1; 85 | p0 = p1 - 1; 86 | } 87 | else 88 | { 89 | p1 = (int)t; 90 | p2 = (p1 + 1) % points.size(); 91 | p3 = (p2 + 1) % points.size(); 92 | p0 = p1 >= 1 ? p1 - 1 : points.size() - 1; 93 | } 94 | 95 | t = t - (int)t; 96 | 97 | float tt = t * t; 98 | float ttt = tt * t; 99 | 100 | float q1 = -ttt + 2.0f*tt - t; 101 | float q2 = 3.0f*ttt - 5.0f*tt + 2.0f; 102 | float q3 = -3.0f*ttt + 4.0f*tt + t; 103 | float q4 = ttt - tt; 104 | 105 | float tx = 0.5f * (points[p0].x * q1 + points[p1].x * q2 + points[p2].x * q3 + points[p3].x * q4); 106 | float ty = 0.5f * (points[p0].y * q1 + points[p1].y * q2 + points[p2].y * q3 + points[p3].y * q4); 107 | 108 | return{ tx, ty }; 109 | } 110 | 111 | sPoint2D GetSplineGradient(float t, bool bLooped = false) 112 | { 113 | int p0, p1, p2, p3; 114 | if (!bLooped) 115 | { 116 | p1 = (int)t + 1; 117 | p2 = p1 + 1; 118 | p3 = p2 + 1; 119 | p0 = p1 - 1; 120 | } 121 | else 122 | { 123 | p1 = (int)t; 124 | p2 = (p1 + 1) % points.size(); 125 | p3 = (p2 + 1) % points.size(); 126 | p0 = p1 >= 1 ? p1 - 1 : points.size() - 1; 127 | } 128 | 129 | t = t - (int)t; 130 | 131 | float tt = t * t; 132 | float ttt = tt * t; 133 | 134 | float q1 = -3.0f * tt + 4.0f*t - 1; 135 | float q2 = 9.0f*tt - 10.0f*t; 136 | float q3 = -9.0f*tt + 8.0f*t + 1.0f; 137 | float q4 = 3.0f*tt - 2.0f*t; 138 | 139 | float tx = 0.5f * (points[p0].x * q1 + points[p1].x * q2 + points[p2].x * q3 + points[p3].x * q4); 140 | float ty = 0.5f * (points[p0].y * q1 + points[p1].y * q2 + points[p2].y * q3 + points[p3].y * q4); 141 | 142 | return{ tx, ty }; 143 | } 144 | }; 145 | 146 | class OneLoneCoder_Splines : public flc::SDL_GameEngine 147 | { 148 | public: 149 | OneLoneCoder_Splines() 150 | { 151 | sAppName = "Splines"; 152 | } 153 | 154 | private: 155 | sSpline path; 156 | int nSelectedPoint = 0; 157 | float fMarker = 0.0f; 158 | 159 | protected: 160 | // Called by olcConsoleGameEngine 161 | virtual bool OnUserCreate() 162 | { 163 | //path.points = { { 10, 41 },{ 40, 41 },{ 70, 41 },{ 100, 41 } }; 164 | path.points = { { 10, 41 },{ 20, 41 },{ 30, 41 },{ 40, 41 },{ 50, 41 },{ 60, 41 },{ 70, 41 },{ 80, 41 },{ 90, 41 },{ 100, 41 } }; 165 | return true; 166 | } 167 | 168 | // Called by olcConsoleGameEngine 169 | virtual bool OnUserUpdate(float fElapsedTime) 170 | { 171 | // Clear Screen 172 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), flc::BLACK); 173 | 174 | // Handle input 175 | if (GetKey(flc::Key::X).bReleased) 176 | { 177 | nSelectedPoint++; 178 | if (nSelectedPoint >= (int)path.points.size()) 179 | nSelectedPoint = 0; 180 | } 181 | 182 | if (GetKey(flc::Key::Z).bReleased) 183 | { 184 | nSelectedPoint--; 185 | if (nSelectedPoint < 0) 186 | nSelectedPoint = path.points.size() - 1; 187 | } 188 | 189 | if (GetKey(flc::Key::LEFT).bHeld) 190 | path.points[nSelectedPoint].x -= 30.0f * fElapsedTime; 191 | 192 | if (GetKey(flc::Key::RIGHT).bHeld) 193 | path.points[nSelectedPoint].x += 30.0f * fElapsedTime; 194 | 195 | if (GetKey(flc::Key::UP).bHeld) 196 | path.points[nSelectedPoint].y -= 30.0f * fElapsedTime; 197 | 198 | if (GetKey(flc::Key::DOWN).bHeld) 199 | path.points[nSelectedPoint].y += 30.0f * fElapsedTime; 200 | 201 | if (GetKey(flc::Key::A).bHeld) 202 | fMarker -= 5.0f * fElapsedTime; 203 | 204 | if (GetKey(flc::Key::S).bHeld) 205 | fMarker += 5.0f * fElapsedTime; 206 | 207 | if (fMarker >= (float)path.points.size()) 208 | fMarker -= (float)path.points.size(); 209 | 210 | if (fMarker < 0.0f) 211 | fMarker += (float)path.points.size(); 212 | 213 | // Draw Spline 214 | for (float t = 0; t < (float)path.points.size(); t += 0.005f) 215 | { 216 | sPoint2D pos = path.GetSplinePoint(t, true); 217 | Draw(pos.x, pos.y); 218 | } 219 | 220 | // Draw Control Points 221 | for (int i = 0; i < (int)path.points.size(); i++) 222 | { 223 | FillRect(path.points[i].x - 1, path.points[i].y - 1, 3, 3, flc::RED); 224 | DrawString(path.points[i].x, path.points[i].y, std::to_string(i)); 225 | } 226 | 227 | // Highlight control point 228 | FillRect(path.points[nSelectedPoint].x - 1, path.points[nSelectedPoint].y - 1, 3, 3, flc::YELLOW); 229 | DrawString(path.points[nSelectedPoint].x, path.points[nSelectedPoint].y, std::to_string(nSelectedPoint)); 230 | 231 | // Draw agent to demonstrate gradient 232 | sPoint2D p1 = path.GetSplinePoint(fMarker, true); 233 | sPoint2D g1 = path.GetSplineGradient(fMarker, true); 234 | float r = atan2(-g1.y, g1.x); 235 | DrawLine(5.0f * sin(r) + p1.x, 5.0f * cos(r) + p1.y, -5.0f * sin(r) + p1.x, -5.0f * cos(r) + p1.y, flc::BLUE); 236 | return true; 237 | } 238 | }; 239 | 240 | int main( int argc, char *argv[] ) 241 | { 242 | OneLoneCoder_Splines demo; 243 | if (demo.Construct(240, 150, 4, 4)) 244 | demo.Start(); 245 | return 0; 246 | } 247 | -------------------------------------------------------------------------------- /OneLoneCoder_SpriteEditor.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - Sprite Editor 3 | "Stop Crying about Paint ya big baby" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | 16 | GNU GPLv3 17 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 18 | 19 | From Javidx9 :) 20 | ~~~~~~~~~~~~~~~ 21 | Hello! Ultimately I don't care what you use this for. It's intended to be 22 | educational, and perhaps to the oddly minded - a little bit of fun. 23 | Please hack this, change it and use it in any way you see fit. You acknowledge 24 | that I am not responsible for anything bad that happens as a result of 25 | your actions. However this code is protected by GNU GPLv3, see the license in the 26 | github repo. This means you must attribute me if you use it. You can view this 27 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 28 | Cheers! 29 | 30 | 31 | Background 32 | ~~~~~~~~~~ 33 | Editing ASCII is not a simple as it should be, especially if you want to 34 | include all the weird characters 35 | 36 | Controls 37 | ~~~~~~~~ 38 | 39 | 40 | Author 41 | ~~~~~~ 42 | Twitter: @javidx9 43 | Blog: www.onelonecoder.com 44 | 45 | Video: 46 | ~~~~~~ 47 | Several... 48 | 49 | Last Updated: 50 | */ 51 | 52 | /* Addition Joseph21 - 20230415 53 | * - removed "using namespace std" and added explicit scope resolution operator where needed 54 | */ 55 | 56 | #include 57 | #include 58 | //using namespace std; 59 | 60 | #include "olcConsoleGameEngine.h" 61 | 62 | 63 | 64 | 65 | 66 | class OneLoneCoder_SpriteEditor : public olcConsoleGameEngine 67 | { 68 | public: 69 | OneLoneCoder_SpriteEditor() 70 | { 71 | m_sAppName = L"Sprite Editor"; 72 | } 73 | 74 | private: 75 | int nPosX = 0; 76 | int nPosY = 0; 77 | int nOffsetX = 0; 78 | int nOffsetY = 0; 79 | int nZoom = 4; 80 | int nCurrentGlyph = PIXEL_SOLID; 81 | int nCurrentColourFG = FG_RED; 82 | int nCurrentColourBG = FG_BLACK; 83 | 84 | olcSprite *sprite = nullptr; 85 | std::wstring sCurrentSpriteFile; 86 | 87 | protected: 88 | // Called by olcConsoleGameEngine 89 | virtual bool OnUserCreate() 90 | { 91 | sprite = new olcSprite(8, 32); 92 | sCurrentSpriteFile = L"fps_fireball1.spr"; 93 | 94 | return true; 95 | } 96 | 97 | // Called by olcConsoleGameEngine 98 | virtual bool OnUserUpdate(float fElapsedTime) 99 | { 100 | 101 | // Zooming 102 | if (m_keys[VK_PRIOR].bReleased) 103 | nZoom <<= 1; 104 | 105 | if (m_keys[VK_NEXT].bReleased) 106 | nZoom >>= 1; 107 | 108 | if (nZoom > 32) nZoom = 32; 109 | if (nZoom < 2) nZoom = 2; 110 | 111 | // Brushes 112 | if (m_keys[VK_F1].bReleased) nCurrentGlyph = PIXEL_SOLID; 113 | if (m_keys[VK_F2].bReleased) nCurrentGlyph = PIXEL_THREEQUARTERS; 114 | if (m_keys[VK_F3].bReleased) nCurrentGlyph = PIXEL_HALF; 115 | if (m_keys[VK_F4].bReleased) nCurrentGlyph = PIXEL_QUARTER; 116 | 117 | // Colours 118 | for (int i = 0; i < 8; i++) 119 | if (m_keys[L"01234567"[i]].bReleased) { 120 | if (m_keys[VK_SHIFT].bHeld) 121 | nCurrentColourFG = i + 8; 122 | else 123 | nCurrentColourFG = i; 124 | } 125 | 126 | if (m_keys[VK_F7].bReleased) 127 | nCurrentColourBG--; 128 | 129 | if (m_keys[VK_F8].bReleased) 130 | nCurrentColourBG++; 131 | 132 | if (nCurrentColourBG < 0) nCurrentColourBG = 15; 133 | if (nCurrentColourBG > 15) nCurrentColourBG = 0; 134 | 135 | // Cursing :-) 136 | if (m_keys[VK_SHIFT].bHeld) 137 | { 138 | if (m_keys[VK_UP].bReleased) nOffsetY++; 139 | if (m_keys[VK_DOWN].bReleased) nOffsetY--; 140 | if (m_keys[VK_LEFT].bReleased) nOffsetX++; 141 | if (m_keys[VK_RIGHT].bReleased) nOffsetX--; 142 | } 143 | else 144 | { 145 | if (m_keys[VK_UP].bReleased) nPosY--; 146 | if (m_keys[VK_DOWN].bReleased) nPosY++; 147 | if (m_keys[VK_LEFT].bReleased) nPosX--; 148 | if (m_keys[VK_RIGHT].bReleased) nPosX++; 149 | } 150 | 151 | if (sprite != nullptr) 152 | { 153 | if (nPosX < 0) nPosX = 0; 154 | if (nPosX >= sprite->nWidth) nPosX = sprite->nWidth - 1; 155 | if (nPosY < 0) nPosY = 0; 156 | if (nPosY >= sprite->nHeight) nPosY = sprite->nHeight - 1; 157 | 158 | if (m_keys[VK_SPACE].bReleased) 159 | { 160 | sprite->SetGlyph(nPosX - 0, nPosY - 0, nCurrentGlyph); 161 | sprite->SetColour(nPosX - 0, nPosY - 0, nCurrentColourFG | (nCurrentColourBG << 4)); 162 | } 163 | 164 | if (m_keys[VK_DELETE].bReleased) 165 | { 166 | sprite->SetGlyph(nPosX - 0, nPosY - 0, L' '); 167 | sprite->SetColour(nPosX - 0, nPosY - 0, 0); 168 | } 169 | 170 | if (m_keys[VK_F9].bReleased) 171 | { 172 | sprite->Load(sCurrentSpriteFile); 173 | } 174 | 175 | if (m_keys[VK_F10].bReleased) 176 | { 177 | sprite->Save(sCurrentSpriteFile); 178 | } 179 | } 180 | 181 | 182 | 183 | 184 | 185 | // Erase All 186 | Fill(0, 0, ScreenWidth(), ScreenHeight(), L' ', 0); 187 | 188 | // Draw Menu 189 | DrawString(1, 1, L"F1 = 100% F2 = 75% F3 = 50% F4 = 25% F9 = Load File F10 = Save File"); 190 | for (int i = 0; i < 8; i++) 191 | { 192 | DrawString(1 + 6 * i, 3, std::to_wstring(i) + L" = "); 193 | if (m_keys[VK_SHIFT].bHeld) 194 | Draw(1 + 6 * i + 4, 3, PIXEL_SOLID, (i + 8)); 195 | else 196 | Draw(1 + 6 * i + 4, 3, PIXEL_SOLID, (i)); 197 | } 198 | 199 | DrawString(1, 5, L"Current Brush = "); 200 | Draw(18, 5, nCurrentGlyph, nCurrentColourFG | (nCurrentColourBG << 4)); 201 | 202 | // Draw Canvas 203 | for (int x = 9; x < 138; x++) 204 | { 205 | Draw(x, 9); 206 | Draw(x, 74); 207 | } 208 | 209 | for (int y = 9; y < 75; y++) 210 | { 211 | Draw(9, y); 212 | Draw(138, y); 213 | } 214 | 215 | // Draw Visible Sprite 216 | if (sprite != nullptr) 217 | { 218 | int nVisiblePixelsX = 128 / nZoom; 219 | int nVisiblePixelsY = 64 / nZoom; 220 | 221 | for (int x = 0; x < nVisiblePixelsX; x++) 222 | for (int y = 0; y < nVisiblePixelsY; y++) 223 | { 224 | if (x - nOffsetX < sprite->nWidth && y - nOffsetY < sprite->nHeight && x - nOffsetX >= 0 && y - nOffsetY >= 0) 225 | { 226 | // Draw Sprite 227 | Fill(x * nZoom + 10, y*nZoom + 10, (x + 1)*nZoom + 10, (y + 1)*nZoom + 10, sprite->GetGlyph(x - nOffsetX, y - nOffsetY), sprite->GetColour(x - nOffsetX, y - nOffsetY)); 228 | 229 | 230 | // Draw Pixel Markers 231 | if (sprite->GetGlyph(x - nOffsetX, y - nOffsetY) == L' ') 232 | Draw((x)* nZoom + 10, (y)* nZoom + 10, L'.'); 233 | } 234 | 235 | if (x - nOffsetX == nPosX && y - nOffsetY == nPosY) 236 | Draw((x)* nZoom + 10, (y)* nZoom + 10, L'O'); 237 | } 238 | } 239 | 240 | 241 | // Draw Actual Sprite 242 | for (int x = 0; x < sprite->nWidth; x++) 243 | for (int y = 0; y < sprite->nHeight; y++) 244 | Draw(x + 10, y + 80, sprite->GetGlyph(x, y), sprite->GetColour(x, y)); 245 | 246 | 247 | 248 | return true; 249 | } 250 | }; 251 | 252 | 253 | int main() 254 | { 255 | // Use olcConsoleGameEngine derived app 256 | OneLoneCoder_SpriteEditor game; 257 | game.ConstructConsole(160, 100, 8, 8); 258 | game.Start(); 259 | 260 | return 0; 261 | } 262 | -------------------------------------------------------------------------------- /OneLoneCoder_olcEngine3D_Part1.CGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - 3D Graphics Part #1 - Triangles & Projections 3 | "Tredimensjonal Grafikk" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | GNU GPLv3 16 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 17 | 18 | From Javidx9 :) 19 | ~~~~~~~~~~~~~~~ 20 | Hello! Ultimately I don't care what you use this for. It's intended to be 21 | educational, and perhaps to the oddly minded - a little bit of fun. 22 | Please hack this, change it and use it in any way you see fit. You acknowledge 23 | that I am not responsible for anything bad that happens as a result of 24 | your actions. However this code is protected by GNU GPLv3, see the license in the 25 | github repo. This means you must attribute me if you use it. You can view this 26 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 27 | Cheers! 28 | 29 | Background 30 | ~~~~~~~~~~ 31 | 3D Graphics is an interesting, visually pleasing suite of algorithms. This is the 32 | first video in a series that will demonstrate the fundamentals required to 33 | build your own software based 3D graphics systems. 34 | 35 | Video 36 | ~~~~~ 37 | https://youtu.be/ih20l3pJoeU 38 | 39 | Author 40 | ~~~~~~ 41 | Twitter: @javidx9 42 | Blog: http://www.onelonecoder.com 43 | Discord: https://discord.gg/WhwHUMV 44 | 45 | 46 | Last Updated: 14/07/2018 47 | */ 48 | 49 | 50 | /* Alterations Joseph21 - 2022-07-19 51 | * - removed "using namespace std" and added explicit scope resolution operator where needed 52 | */ 53 | 54 | #include "olcConsoleGameEngine.h" 55 | //using namespace std; 56 | 57 | 58 | struct vec3d 59 | { 60 | float x, y, z; 61 | }; 62 | 63 | struct triangle 64 | { 65 | vec3d p[3]; 66 | }; 67 | 68 | struct mesh 69 | { 70 | std::vector tris; 71 | }; 72 | 73 | struct mat4x4 74 | { 75 | float m[4][4] = { 0 }; 76 | }; 77 | 78 | class olcEngine3D : public olcConsoleGameEngine 79 | { 80 | public: 81 | olcEngine3D() 82 | { 83 | m_sAppName = L"3D Demo"; 84 | } 85 | 86 | 87 | private: 88 | mesh meshCube; 89 | mat4x4 matProj; 90 | 91 | float fTheta; 92 | 93 | void MultiplyMatrixVector(vec3d &i, vec3d &o, mat4x4 &m) 94 | { 95 | o.x = i.x * m.m[0][0] + i.y * m.m[1][0] + i.z * m.m[2][0] + m.m[3][0]; 96 | o.y = i.x * m.m[0][1] + i.y * m.m[1][1] + i.z * m.m[2][1] + m.m[3][1]; 97 | o.z = i.x * m.m[0][2] + i.y * m.m[1][2] + i.z * m.m[2][2] + m.m[3][2]; 98 | float w = i.x * m.m[0][3] + i.y * m.m[1][3] + i.z * m.m[2][3] + m.m[3][3]; 99 | 100 | if (w != 0.0f) 101 | { 102 | o.x /= w; o.y /= w; o.z /= w; 103 | } 104 | } 105 | 106 | public: 107 | bool OnUserCreate() override 108 | { 109 | meshCube.tris = { 110 | 111 | // SOUTH 112 | { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f }, 113 | { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }, 114 | 115 | // EAST 116 | { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f }, 117 | { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f }, 118 | 119 | // NORTH 120 | { 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f }, 121 | { 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, 122 | 123 | // WEST 124 | { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f }, 125 | { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f }, 126 | 127 | // TOP 128 | { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }, 129 | { 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f }, 130 | 131 | // BOTTOM 132 | { 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f }, 133 | { 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }, 134 | 135 | }; 136 | 137 | // Projection Matrix 138 | float fNear = 0.1f; 139 | float fFar = 1000.0f; 140 | float fFov = 90.0f; 141 | float fAspectRatio = (float)ScreenHeight() / (float)ScreenWidth(); 142 | float fFovRad = 1.0f / tanf(fFov * 0.5f / 180.0f * 3.14159f); 143 | 144 | matProj.m[0][0] = fAspectRatio * fFovRad; 145 | matProj.m[1][1] = fFovRad; 146 | matProj.m[2][2] = fFar / (fFar - fNear); 147 | matProj.m[3][2] = (-fFar * fNear) / (fFar - fNear); 148 | matProj.m[2][3] = 1.0f; 149 | matProj.m[3][3] = 0.0f; 150 | 151 | return true; 152 | } 153 | 154 | bool OnUserUpdate(float fElapsedTime) override 155 | { 156 | // Clear Screen 157 | Fill(0, 0, ScreenWidth(), ScreenHeight(), PIXEL_SOLID, FG_BLACK); 158 | 159 | // Set up rotation matrices 160 | mat4x4 matRotZ, matRotX; 161 | fTheta += 1.0f * fElapsedTime; 162 | 163 | // Rotation Z 164 | matRotZ.m[0][0] = cosf(fTheta); 165 | matRotZ.m[0][1] = sinf(fTheta); 166 | matRotZ.m[1][0] = -sinf(fTheta); 167 | matRotZ.m[1][1] = cosf(fTheta); 168 | matRotZ.m[2][2] = 1; 169 | matRotZ.m[3][3] = 1; 170 | 171 | // Rotation X 172 | matRotX.m[0][0] = 1; 173 | matRotX.m[1][1] = cosf(fTheta * 0.5f); 174 | matRotX.m[1][2] = sinf(fTheta * 0.5f); 175 | matRotX.m[2][1] = -sinf(fTheta * 0.5f); 176 | matRotX.m[2][2] = cosf(fTheta * 0.5f); 177 | matRotX.m[3][3] = 1; 178 | 179 | // Draw Triangles 180 | for (auto tri : meshCube.tris) 181 | { 182 | triangle triProjected, triTranslated, triRotatedZ, triRotatedZX; 183 | 184 | // Rotate in Z-Axis 185 | MultiplyMatrixVector(tri.p[0], triRotatedZ.p[0], matRotZ); 186 | MultiplyMatrixVector(tri.p[1], triRotatedZ.p[1], matRotZ); 187 | MultiplyMatrixVector(tri.p[2], triRotatedZ.p[2], matRotZ); 188 | 189 | // Rotate in X-Axis 190 | MultiplyMatrixVector(triRotatedZ.p[0], triRotatedZX.p[0], matRotX); 191 | MultiplyMatrixVector(triRotatedZ.p[1], triRotatedZX.p[1], matRotX); 192 | MultiplyMatrixVector(triRotatedZ.p[2], triRotatedZX.p[2], matRotX); 193 | 194 | // Offset into the screen 195 | triTranslated = triRotatedZX; 196 | triTranslated.p[0].z = triRotatedZX.p[0].z + 3.0f; 197 | triTranslated.p[1].z = triRotatedZX.p[1].z + 3.0f; 198 | triTranslated.p[2].z = triRotatedZX.p[2].z + 3.0f; 199 | 200 | // Project triangles from 3D --> 2D 201 | MultiplyMatrixVector(triTranslated.p[0], triProjected.p[0], matProj); 202 | MultiplyMatrixVector(triTranslated.p[1], triProjected.p[1], matProj); 203 | MultiplyMatrixVector(triTranslated.p[2], triProjected.p[2], matProj); 204 | 205 | // Scale into view 206 | triProjected.p[0].x += 1.0f; triProjected.p[0].y += 1.0f; 207 | triProjected.p[1].x += 1.0f; triProjected.p[1].y += 1.0f; 208 | triProjected.p[2].x += 1.0f; triProjected.p[2].y += 1.0f; 209 | triProjected.p[0].x *= 0.5f * (float)ScreenWidth(); 210 | triProjected.p[0].y *= 0.5f * (float)ScreenHeight(); 211 | triProjected.p[1].x *= 0.5f * (float)ScreenWidth(); 212 | triProjected.p[1].y *= 0.5f * (float)ScreenHeight(); 213 | triProjected.p[2].x *= 0.5f * (float)ScreenWidth(); 214 | triProjected.p[2].y *= 0.5f * (float)ScreenHeight(); 215 | 216 | // Rasterize triangle 217 | DrawTriangle(triProjected.p[0].x, triProjected.p[0].y, 218 | triProjected.p[1].x, triProjected.p[1].y, 219 | triProjected.p[2].x, triProjected.p[2].y, 220 | PIXEL_SOLID, FG_WHITE); 221 | 222 | } 223 | 224 | 225 | return true; 226 | } 227 | 228 | }; 229 | 230 | 231 | 232 | 233 | int main() 234 | { 235 | olcEngine3D demo; 236 | if (demo.ConstructConsole(256, 240, 4, 4)) 237 | demo.Start(); 238 | return 0; 239 | } 240 | 241 | -------------------------------------------------------------------------------- /OneLoneCoder_olcEngine3D_Part1.SGE.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OneLoneCoder.com - 3D Graphics Part #1 - Triangles & Projections 3 | "Tredimensjonal Grafikk" - @Javidx9 4 | 5 | License 6 | ~~~~~~~ 7 | One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9 8 | This program comes with ABSOLUTELY NO WARRANTY. 9 | This is free software, and you are welcome to redistribute it 10 | under certain conditions; See license for details. 11 | Original works located at: 12 | https://www.github.com/onelonecoder 13 | https://www.onelonecoder.com 14 | https://www.youtube.com/javidx9 15 | GNU GPLv3 16 | https://github.com/OneLoneCoder/videos/blob/master/LICENSE 17 | 18 | From Javidx9 :) 19 | ~~~~~~~~~~~~~~~ 20 | Hello! Ultimately I don't care what you use this for. It's intended to be 21 | educational, and perhaps to the oddly minded - a little bit of fun. 22 | Please hack this, change it and use it in any way you see fit. You acknowledge 23 | that I am not responsible for anything bad that happens as a result of 24 | your actions. However this code is protected by GNU GPLv3, see the license in the 25 | github repo. This means you must attribute me if you use it. You can view this 26 | license here: https://github.com/OneLoneCoder/videos/blob/master/LICENSE 27 | Cheers! 28 | 29 | Background 30 | ~~~~~~~~~~ 31 | 3D Graphics is an interesting, visually pleasing suite of algorithms. This is the 32 | first video in a series that will demonstrate the fundamentals required to 33 | build your own software based 3D graphics systems. 34 | 35 | Video 36 | ~~~~~ 37 | https://youtu.be/ih20l3pJoeU 38 | 39 | Author 40 | ~~~~~~ 41 | Twitter: @javidx9 42 | Blog: http://www.onelonecoder.com 43 | Discord: https://discord.gg/WhwHUMV 44 | 45 | 46 | Last Updated: 14/07/2018 47 | */ 48 | 49 | 50 | /* Alterations Joseph21 - 2022-07-19 51 | * - removed "using namespace std" and added explicit scope resolution operator where needed 52 | * Port to PixelGameEngine - 2022-07-18 53 | * - see cheat sheet for generic adaptations needed for port 54 | * - no specific points 55 | */ 56 | 57 | #include "SGE/SGE_Core.h" 58 | //using namespace std; 59 | 60 | 61 | struct vec3d 62 | { 63 | float x, y, z; 64 | }; 65 | 66 | struct triangle 67 | { 68 | vec3d p[3]; 69 | }; 70 | 71 | struct mesh 72 | { 73 | std::vector tris; 74 | }; 75 | 76 | struct mat4x4 77 | { 78 | float m[4][4] = { 0 }; 79 | }; 80 | 81 | class flcEngine3D : public flc::SDL_GameEngine 82 | { 83 | public: 84 | flcEngine3D() 85 | { 86 | sAppName = "3D Demo"; 87 | } 88 | 89 | 90 | private: 91 | mesh meshCube; 92 | mat4x4 matProj; 93 | 94 | float fTheta; 95 | 96 | void MultiplyMatrixVector(vec3d &i, vec3d &o, mat4x4 &m) 97 | { 98 | o.x = i.x * m.m[0][0] + i.y * m.m[1][0] + i.z * m.m[2][0] + m.m[3][0]; 99 | o.y = i.x * m.m[0][1] + i.y * m.m[1][1] + i.z * m.m[2][1] + m.m[3][1]; 100 | o.z = i.x * m.m[0][2] + i.y * m.m[1][2] + i.z * m.m[2][2] + m.m[3][2]; 101 | float w = i.x * m.m[0][3] + i.y * m.m[1][3] + i.z * m.m[2][3] + m.m[3][3]; 102 | 103 | if (w != 0.0f) 104 | { 105 | o.x /= w; o.y /= w; o.z /= w; 106 | } 107 | } 108 | 109 | public: 110 | bool OnUserCreate() override 111 | { 112 | meshCube.tris = { 113 | 114 | // SOUTH 115 | { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f }, 116 | { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }, 117 | 118 | // EAST 119 | { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f }, 120 | { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f }, 121 | 122 | // NORTH 123 | { 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f }, 124 | { 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, 125 | 126 | // WEST 127 | { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f }, 128 | { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f }, 129 | 130 | // TOP 131 | { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }, 132 | { 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f }, 133 | 134 | // BOTTOM 135 | { 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f }, 136 | { 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }, 137 | 138 | }; 139 | 140 | // Projection Matrix 141 | float fNear = 0.1f; 142 | float fFar = 1000.0f; 143 | float fFov = 90.0f; 144 | float fAspectRatio = (float)ScreenHeight() / (float)ScreenWidth(); 145 | float fFovRad = 1.0f / tanf(fFov * 0.5f / 180.0f * 3.14159f); 146 | 147 | matProj.m[0][0] = fAspectRatio * fFovRad; 148 | matProj.m[1][1] = fFovRad; 149 | matProj.m[2][2] = fFar / (fFar - fNear); 150 | matProj.m[3][2] = (-fFar * fNear) / (fFar - fNear); 151 | matProj.m[2][3] = 1.0f; 152 | matProj.m[3][3] = 0.0f; 153 | 154 | return true; 155 | } 156 | 157 | bool OnUserUpdate(float fElapsedTime) override 158 | { 159 | // Clear Screen 160 | FillRect(0, 0, ScreenWidth(), ScreenHeight(), flc::BLACK); 161 | 162 | // Set up rotation matrices 163 | mat4x4 matRotZ, matRotX; 164 | fTheta += 1.0f * fElapsedTime; 165 | 166 | // Rotation Z 167 | matRotZ.m[0][0] = cosf(fTheta); 168 | matRotZ.m[0][1] = sinf(fTheta); 169 | matRotZ.m[1][0] = -sinf(fTheta); 170 | matRotZ.m[1][1] = cosf(fTheta); 171 | matRotZ.m[2][2] = 1; 172 | matRotZ.m[3][3] = 1; 173 | 174 | // Rotation X 175 | matRotX.m[0][0] = 1; 176 | matRotX.m[1][1] = cosf(fTheta * 0.5f); 177 | matRotX.m[1][2] = sinf(fTheta * 0.5f); 178 | matRotX.m[2][1] = -sinf(fTheta * 0.5f); 179 | matRotX.m[2][2] = cosf(fTheta * 0.5f); 180 | matRotX.m[3][3] = 1; 181 | 182 | // Draw Triangles 183 | for (auto tri : meshCube.tris) 184 | { 185 | triangle triProjected, triTranslated, triRotatedZ, triRotatedZX; 186 | 187 | // Rotate in Z-Axis 188 | MultiplyMatrixVector(tri.p[0], triRotatedZ.p[0], matRotZ); 189 | MultiplyMatrixVector(tri.p[1], triRotatedZ.p[1], matRotZ); 190 | MultiplyMatrixVector(tri.p[2], triRotatedZ.p[2], matRotZ); 191 | 192 | // Rotate in X-Axis 193 | MultiplyMatrixVector(triRotatedZ.p[0], triRotatedZX.p[0], matRotX); 194 | MultiplyMatrixVector(triRotatedZ.p[1], triRotatedZX.p[1], matRotX); 195 | MultiplyMatrixVector(triRotatedZ.p[2], triRotatedZX.p[2], matRotX); 196 | 197 | // Offset into the screen 198 | triTranslated = triRotatedZX; 199 | triTranslated.p[0].z = triRotatedZX.p[0].z + 3.0f; 200 | triTranslated.p[1].z = triRotatedZX.p[1].z + 3.0f; 201 | triTranslated.p[2].z = triRotatedZX.p[2].z + 3.0f; 202 | 203 | // Project triangles from 3D --> 2D 204 | MultiplyMatrixVector(triTranslated.p[0], triProjected.p[0], matProj); 205 | MultiplyMatrixVector(triTranslated.p[1], triProjected.p[1], matProj); 206 | MultiplyMatrixVector(triTranslated.p[2], triProjected.p[2], matProj); 207 | 208 | // Scale into view 209 | triProjected.p[0].x += 1.0f; triProjected.p[0].y += 1.0f; 210 | triProjected.p[1].x += 1.0f; triProjected.p[1].y += 1.0f; 211 | triProjected.p[2].x += 1.0f; triProjected.p[2].y += 1.0f; 212 | triProjected.p[0].x *= 0.5f * (float)ScreenWidth(); 213 | triProjected.p[0].y *= 0.5f * (float)ScreenHeight(); 214 | triProjected.p[1].x *= 0.5f * (float)ScreenWidth(); 215 | triProjected.p[1].y *= 0.5f * (float)ScreenHeight(); 216 | triProjected.p[2].x *= 0.5f * (float)ScreenWidth(); 217 | triProjected.p[2].y *= 0.5f * (float)ScreenHeight(); 218 | 219 | // Rasterize triangle 220 | DrawTriangle(triProjected.p[0].x, triProjected.p[0].y, 221 | triProjected.p[1].x, triProjected.p[1].y, 222 | triProjected.p[2].x, triProjected.p[2].y, 223 | flc::WHITE); 224 | 225 | } 226 | 227 | 228 | return true; 229 | } 230 | 231 | }; 232 | 233 | 234 | 235 | 236 | int main( int argc, char *argv[] ) 237 | { 238 | flcEngine3D demo; 239 | if (demo.Construct(256, 240, 4, 4)) 240 | demo.Start(); 241 | return 0; 242 | } 243 | 244 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # From-ConsoleGameEngine-to-PixelGameEngine 2 | Contains code that is ported from most of Javidx9s olcConsoleGameEngine videos to olcPixelGameEngine 3 | 4 | Being a fan of Javidx9 I implemented most of his videos. In 2017 he developed the olcConsoleGameEngine (CGE for short) as a Windows console based platform for game, concept and algorithm development. In 2018 the olcPixelGameEngine (PGE) v. 1.0 was introduced, and the emphasis in the videos shifted to development on the PGE. 5 | 6 | In January 2022 the CGE was deprecated and is no longer supported. It is still possible to follow the CGE based videos and doing the implementation on the deprecated CGE platform, but you can also do the implementation on the newer, much more feature rich, cross platform and supported PGE. 7 | 8 | I implemented most of the CGE videos on the CGE platform, and ported these implementations to the newer PGE platform afterwards. To help anyone who wants to follow these CGE based videos I decided to upload all these ports. I also put a cheat sheet that describes how to port from CGE to PGE yourself if you want. And all the sprite files are converted from .spr to .png format, using Gorbit's sprite converter code (and a bit of my own hackery). 9 | 10 | The original code is there as well, but I took the liberty to outcomment the "using namespace std;" lines wherever I found them, and correct with scope resolution operators where necessary. You can recognize the code based on the CGE platform by the CGE in the file name. The file having the PGE in the name is the ported version of the code. I find it convenient to have them together to enable easy comparison of both versions. 11 | 12 | Note: There are also a few programs that were developed for the bare Windows console originally (Snake, CaveDiver, Tetris and the first version of the First Person Shooter). This code is also included in this repo: I ported these programs to the ConsoleGameEngine first, and from there to the PixelGameEngine. The original (Windows console) versions can be identified by the CON in the file names. 13 | 14 | I'm having no licence or copyright on this code whatsoever - the original GNU GPLv3 license of the original creator applies and is there in each of the code files as they were in the originals. 15 | 16 | In the header comment I added a little summary of the adaptations I did per file. 17 | 18 | **Update june 2, 2024 - code also available via PGEtinker** 19 | 20 | Recently Moros1138 released his PGEtinker, a tool for realtime compiling and running PGE based code using Emscriptem for the translation to WASM. (It probably contains much more very smart tricks and techniques, but I'm not able to explain them all :) ) He also ported all the CGE to PGE ported code to PGEtinker. Here's a list of links, courtesy of Moros1138! 21 | 22 | OneLoneCoder_Asteroids.PGE.cpp - https://beta.pgetinker.com/s/98dA5VR2lMU 23 | 24 | OneLoneCoder_Balls1.PGE.cpp - https://beta.pgetinker.com/s/r2qCfSOO3HU 25 | 26 | OneLoneCoder_Balls2.PGE.cpp - https://beta.pgetinker.com/s/T6KnEfy4M- 27 | 28 | OneLoneCoder_CaveDiver.PGE.cpp - https://beta.pgetinker.com/s/Iw8MqeZWjz5 29 | 30 | OneLoneCoder_CommandLineFPS.PGE.cpp - https://beta.pgetinker.com/s/kp20NorMY3C 31 | 32 | OneLoneCoder_CommandLineFPS_2.PGE.cpp - https://beta.pgetinker.com/s/Sg5Q2flDNna 33 | 34 | OneLoneCoder_Fireworks_10KSubSpecial.PGE.cpp - https://beta.pgetinker.com/s/3lfLR6elx7q 35 | 36 | OneLoneCoder_FlappyBird.PGE.cpp - https://beta.pgetinker.com/s/3eYwcEz311 37 | 38 | OneLoneCoder_Frogger.PGE.cpp - https://beta.pgetinker.com/s/d1WUYCMAhKS 39 | 40 | OneLoneCoder_GameOfLife.PGE.cpp - https://beta.pgetinker.com/s/obiToOT98y6 41 | 42 | OneLoneCoder_LudumDare42.PGE.cpp - https://beta.pgetinker.com/s/rmUZohYfS89 43 | 44 | OneLoneCoder_MatchingGems_50KSubSpecial.PGE.cpp - https://beta.pgetinker.com/s/cJXN5Fxons 45 | 46 | OneLoneCoder_Matrix.PGE.cpp - https://beta.pgetinker.com/s/ceC3MIPakJF 47 | 48 | OneLoneCoder_Mazes.PGE.cpp - https://beta.pgetinker.com/s/jm34y5fFGc 49 | 50 | OneLoneCoder_olcEngine3D_Part1.PGE.cpp - https://beta.pgetinker.com/s/FuNihLD9MG 51 | 52 | OneLoneCoder_olcEngine3D_Part2.PGE.cpp - https://beta.pgetinker.com/s/JJuMnMDWdcu 53 | 54 | OneLoneCoder_olcEngine3D_Part3.PGE.cpp - https://beta.pgetinker.com/s/hnLeVLiCNj 55 | 56 | OneLoneCoder_olcEngine3D_Part4.PGE.cpp - https://beta.pgetinker.com/s/TEkNFkol3c 57 | 58 | OneLoneCoder_PanAndZoom.PGE.cpp - https://beta.pgetinker.com/s/jJhBVmxHafZ 59 | 60 | OneLoneCoder_PathFinding_AStar.PGE.cpp - https://beta.pgetinker.com/s/N2ki6Ip3XXW 61 | 62 | OneLoneCoder_PerlinNoise.PGE.cpp - https://beta.pgetinker.com/s/U89runhyg1 63 | 64 | OneLoneCoder_PlatformGame1.PGE.cpp - https://beta.pgetinker.com/s/rMSJZETWEFy 65 | 66 | OneLoneCoder_Pseudo3DPlanesMode7.PGE.cpp - https://beta.pgetinker.com/s/KNdCipg0fuB 67 | 68 | OneLoneCoder_RacingLines.PGE.cpp - https://beta.pgetinker.com/s/eTwmKacI1RO 69 | 70 | OneLoneCoder_RetroArcadeRacer.PGE.cpp - https://beta.pgetinker.com/s/J5OVmuW1Kd5 71 | 72 | OneLoneCoder_Snake.PGE.cpp - https://beta.pgetinker.com/s/aPSfbnEMct 73 | 74 | OneLoneCoder_Splines1.PGE.cpp - https://beta.pgetinker.com/s/8AYfnVW9G8F 75 | 76 | OneLoneCoder_Splines2.PGE.cpp - https://beta.pgetinker.com/s/-CI0KKN3AIh 77 | 78 | OneLoneCoder_Tetris.PGE.cpp - https://beta.pgetinker.com/s/yNkUjCXqhIp 79 | 80 | OneLoneCoder_Worms1.PGE.cpp - https://beta.pgetinker.com/s/EhIklVCtthV 81 | 82 | OneLoneCoder_Worms2.PGE.cpp - https://beta.pgetinker.com/s/YR0KVrjkure 83 | 84 | OneLoneCoder_Worms3.PGE.cpp - https://beta.pgetinker.com/s/cPLcxz0SEMT 85 | 86 | 87 | Have fun with it! 88 | 89 | Joseph21 90 | -------------------------------------------------------------------------------- /WormsSprites/worms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/WormsSprites/worms.png -------------------------------------------------------------------------------- /WormsSprites/worms.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/WormsSprites/worms.spr -------------------------------------------------------------------------------- /WormsSprites/worms1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/WormsSprites/worms1.png -------------------------------------------------------------------------------- /WormsSprites/worms1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/WormsSprites/worms1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Assets.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Assets.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Assets.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Assets.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Commands.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Commands.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Commands.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Commands.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Dynamics.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Dynamics.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Dynamics.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Dynamics.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Engine.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Engine.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Engine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Engine.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Items.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Items.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Items.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Items.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Maps.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Maps.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Maps.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Maps.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Quests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Quests.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/RPG_Quests.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/RPG_Quests.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/main.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/olcConsoleGameEngineOOP.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/olcConsoleGameEngineOOP.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/olcConsoleGameEngineOOP.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/olcConsoleGameEngineOOP.h -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/Sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/Sword.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/Sword.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/Sword.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/balloon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/balloon1.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/balloon1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/balloon1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/item_health.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/item_health.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/item_health.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/item_health.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/item_healthboost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/item_healthboost.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/item_healthboost.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/item_healthboost.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/javidx9_nesfont8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/javidx9_nesfont8x8.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/javidx9_nesfont8x8.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/javidx9_nesfont8x8.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/sky1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/sky1.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/sky1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/sky1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/title3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/title3.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/title3.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/title3.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_CharacterSprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_CharacterSprites.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_CharacterSprites.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_CharacterSprites.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_char001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_char001.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_char001.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_char001.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_modernish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_modernish.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_modernish.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_modernish.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_purple.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_purple.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_purple.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_spritesheetdark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_spritesheetdark.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/toml_spritesheetdark.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/toml_spritesheetdark.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/weapon_basic_sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/weapon_basic_sword.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/weapon_basic_sword.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/weapon_basic_sword.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/worldmap1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/worldmap1.png -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/gfx/worldmap1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - CGE/rpgdata/gfx/worldmap1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/map/home.lvl: -------------------------------------------------------------------------------- 1 | 16 16 2 | 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 56 1 56 1 56 1 55 1 55 1 13 1 14 1 51 1 56 1 56 1 11 1 54 1 11 1 11 1 0 1 0 1 20 1 63 1 65 1 65 1 65 1 23 1 24 1 20 1 63 1 66 1 66 1 63 1 66 1 66 1 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 0 1 30 0 18 0 58 1 58 1 58 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 0 1 30 0 30 0 58 1 58 1 58 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 0 1 30 0 30 0 58 1 58 1 12 1 30 0 30 0 30 0 0 1 0 1 30 0 30 0 0 1 0 1 0 1 0 1 30 0 30 0 10 1 10 1 30 0 30 0 30 0 30 0 0 1 53 1 30 0 30 0 56 1 56 1 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 63 1 30 0 30 0 66 1 66 1 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 84 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 84 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 0 1 0 1 0 1 0 1 30 0 30 0 0 1 0 1 0 1 0 1 31 0 18 0 31 0 31 0 31 0 0 1 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 -------------------------------------------------------------------------------- /olcRolePlayingGame - CGE/rpgdata/map/introduction.lvl: -------------------------------------------------------------------------------- 1 | 64 15 2 | 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 14 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 19 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 19 0 14 0 14 0 14 0 14 0 14 0 14 0 9 0 9 0 9 0 9 0 9 0 14 0 14 0 3 0 25 0 14 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 15 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 13 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 19 0 19 0 9 0 9 0 9 0 9 0 14 0 14 0 14 0 9 0 9 0 9 0 9 0 14 0 14 0 14 0 9 0 9 0 9 0 9 0 14 0 14 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 14 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 19 0 9 0 9 0 9 0 19 0 19 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 19 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Assets.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Assets.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Assets.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Assets.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Commands.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Commands.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Commands.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Commands.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Dynamics.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Dynamics.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Dynamics.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Dynamics.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Engine.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Engine.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Engine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Engine.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Items.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Items.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Items.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Items.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Maps.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Maps.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Maps.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Maps.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Quests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Quests.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/RPG_Quests.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/RPG_Quests.h -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/main.cpp -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/Sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/Sword.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/Sword.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/Sword.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/balloon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/balloon1.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/balloon1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/balloon1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/item_health.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/item_health.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/item_health.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/item_health.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/item_healthboost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/item_healthboost.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/item_healthboost.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/item_healthboost.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/javidx9_nesfont8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/javidx9_nesfont8x8.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/javidx9_nesfont8x8.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/javidx9_nesfont8x8.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/sky1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/sky1.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/sky1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/sky1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/title3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/title3.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/title3.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/title3.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_CharacterSprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_CharacterSprites.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_CharacterSprites.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_CharacterSprites.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_char001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_char001.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_char001.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_char001.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_modernish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_modernish.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_modernish.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_modernish.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_purple.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_purple.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_purple.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_spritesheetdark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_spritesheetdark.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/toml_spritesheetdark.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/toml_spritesheetdark.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/weapon_basic_sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/weapon_basic_sword.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/weapon_basic_sword.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/weapon_basic_sword.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/worldmap1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/worldmap1.png -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/gfx/worldmap1.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Joseph21-6147/From-ConsoleGameEngine-to-PixelGameEngine/ab0e4adbf0ac6166905165fb2637ea8401f091ef/olcRolePlayingGame - PGE/rpgdata/gfx/worldmap1.spr -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/map/home.lvl: -------------------------------------------------------------------------------- 1 | 16 16 2 | 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 56 1 56 1 56 1 55 1 55 1 13 1 14 1 51 1 56 1 56 1 11 1 54 1 11 1 11 1 0 1 0 1 20 1 63 1 65 1 65 1 65 1 23 1 24 1 20 1 63 1 66 1 66 1 63 1 66 1 66 1 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 0 1 30 0 18 0 58 1 58 1 58 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 0 1 30 0 30 0 58 1 58 1 58 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 0 1 30 0 30 0 58 1 58 1 12 1 30 0 30 0 30 0 0 1 0 1 30 0 30 0 0 1 0 1 0 1 0 1 30 0 30 0 10 1 10 1 30 0 30 0 30 0 30 0 0 1 53 1 30 0 30 0 56 1 56 1 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 63 1 30 0 30 0 66 1 66 1 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 84 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 84 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 0 1 30 0 30 0 30 0 30 0 30 0 30 0 30 0 30 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 0 1 0 1 0 1 0 1 30 0 30 0 0 1 0 1 0 1 0 1 31 0 18 0 31 0 31 0 31 0 0 1 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 0 1 31 0 31 0 31 0 31 0 31 0 0 1 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 73 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 -------------------------------------------------------------------------------- /olcRolePlayingGame - PGE/rpgdata/map/introduction.lvl: -------------------------------------------------------------------------------- 1 | 64 15 2 | 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 14 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 19 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 19 0 14 0 14 0 14 0 14 0 14 0 14 0 9 0 9 0 9 0 9 0 9 0 14 0 14 0 3 0 25 0 14 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 15 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 13 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 14 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 19 0 19 0 9 0 9 0 9 0 9 0 14 0 14 0 14 0 9 0 9 0 9 0 9 0 14 0 14 0 14 0 9 0 9 0 9 0 9 0 14 0 14 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 14 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 19 0 9 0 9 0 9 0 19 0 19 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 19 0 9 0 9 0 19 0 9 0 9 0 9 0 19 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 13 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 --------------------------------------------------------------------------------