{"id":18771505,"url":"https://github.com/ssusnic/windows-console-game-framework","last_synced_at":"2026-05-03T09:37:58.299Z","repository":{"id":111157243,"uuid":"429869699","full_name":"ssusnic/Windows-Console-Game-Framework","owner":"ssusnic","description":"This repo contains a simple game framework for making Windows Console games in C++, and the source codes of the games made by using it. ","archived":false,"fork":false,"pushed_at":"2021-12-11T19:11:35.000Z","size":1916,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-21T01:13:03.382Z","etag":null,"topics":["c-plus-plus","command-line","command-line-app","command-prompt","console","console-framework","console-game","cpp","framework","game-2d","game-dev","game-development","game-engine","gamedev","making-2d-games","making-games","mingw","mingw-w64","simple-game","windows-console"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssusnic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-19T16:45:29.000Z","updated_at":"2024-01-21T20:55:13.000Z","dependencies_parsed_at":"2024-03-16T19:45:16.864Z","dependency_job_id":null,"html_url":"https://github.com/ssusnic/Windows-Console-Game-Framework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssusnic/Windows-Console-Game-Framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssusnic%2FWindows-Console-Game-Framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssusnic%2FWindows-Console-Game-Framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssusnic%2FWindows-Console-Game-Framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssusnic%2FWindows-Console-Game-Framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssusnic","download_url":"https://codeload.github.com/ssusnic/Windows-Console-Game-Framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssusnic%2FWindows-Console-Game-Framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27682010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","command-line","command-line-app","command-prompt","console","console-framework","console-game","cpp","framework","game-2d","game-dev","game-development","game-engine","gamedev","making-2d-games","making-games","mingw","mingw-w64","simple-game","windows-console"],"created_at":"2024-11-07T19:25:07.000Z","updated_at":"2025-12-12T11:30:31.814Z","avatar_url":"https://github.com/ssusnic.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Windows-Console-Game-Framework\nTo facilitate the process of coding games in C++ for the Windows Console, I developed a simple game framework named **Consoler**.\n\nThis repo contains the Consoler framework, including the following files:  \n1. **Consoler.h**         - the framework interface\n2. **Consoler.dll**       - the dynamic library\n3. **ConsolerStatic.lib** - the static library\n4. **manual.txt**         - the user manual\n\nThis repo also contains the source codes of the demos and games made by using this framework.  \n\n\n## API Documentation\nThe framework interface file (Consoler.h) can be used as the reference documentation of the Consoler API.  \nAll globals, constants and classes with their variables and methods are listed there and commented very well.  \nSo, you should easily find out how to use them for making your own console games.  \n\nIn addition, you can always check out examples published in this repo to learn more details about implementing games based on this framework.\n\nThe video tutorials on this topic are also available on my Youtube channel:  \n\n[**Playlist: All Episodes**](https://www.youtube.com/playlist?list=PLiUmDJi4BtJvrUzgItTsGpjKpu9E4P7ty)  \n\n[**Episode #1: Basic Graphics**](https://youtu.be/TW_OVQkmDXU)  \n[**Episode #2: Images \u0026 Sprites**](https://youtu.be/gHzrvK6coAM)\n\n\n## Usage\n1. create a new C++ source code file  \n2. include the **Consoler.h**  \n3. define a new **Game class** which inherits the **Consoler class** and then:  \n\ta. override the **Setup()** method to set up game and load sprites/sounds  \n\tb. override the **Update()** method to update the game logic  \n\tc. override the **ShowPauseInfo()** method to handle the game when it is paused  \n4. inside the **main program**:  \n\ta. initialize a new game object  \n\tb. run the main game loop  \n5. build your game dynamically with **Consoler.dll** or statically with **ConsolerStatic.lib**  \n\n\n## Program Template\nHere is a basic program template that uses the Consoler framework.  \nIt creates a new console window and then clears the screen in each frame.  \n\n```c++\n// include interface of the Consoler framework\n#include \"Consoler.h\"\n\n// Game class - inherits Consoler class.\nclass Game : public Consoler\n{\npublic:\n\t// inherit Consoler constructor\n\tusing Consoler::Consoler;\n\t\n\t// override Setup() method to set up game and load sprites/sounds\n\tvoid Setup() override\n\t{\n\t}\n\t\n\t// override Update() method to update game logic (this is the main game loop)\n\tvoid Update() override\n\t{\n\t\tClearScreen();\n\t}\n};\n\n// Main program\nint main(){\n\t// initialize a new game by defining the size of the console screen and target fps\n\tGame game(L\"Consoler Demo\", 320, 200, 1, 1, 60);\n\t\n\t// run the main game loop\n\tgame.Run();\n\t\n\treturn 0;\n}\n```\n\n## Compiling\nTo compile your C++ program, you should have a C++ compiler installed on your computer.  \nSince I'm using the MinGW development tools, here are instructions how to build a game by running the **g++ compiler** at the command prompt.  \n\n**Prerequisites:**  \n  - **MinGW installed** on your computer (https://www.mingw-w64.org/)  \n  - the **PATH** environment variable set to **MinGW\\bin** directory, so the system knows where to find the g++ compiler.  \n\n**Steps to build a game:**  \n1. start the command prompt (by running cmd.exe)\n2. change directory to the folder with the source code of your game\n3. set the path to the folder with the Consoler framework\n4. run the g++ compiler to build the game:\n  - dynamically by using **Consoler.dll**:  \n  ```shell\n\t  g++ -I../Consoler MyGame.cpp -o MyGame.exe -DUNICODE -O3 -lwinmm -L../Consoler -lConsoler\n  ``` \n  - statically by using **ConsolerStatic.lib**:\n  ```shell  \n\t  g++ -I../Consoler MyGame.cpp ../Consoler/ConsolerStatic.lib -o MyGame.exe -DUNICODE -O3 -DSTATIC -lwinmm -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread\n  ```\n\nI guess you can compile your programs in a similar way on any other C ++ development platform. \n\n\n## Batch Scripts\nTo execute previous commands more efficiently and quickly, you can use batch scripts.\n\nHere are some examples:\n\n1. **start_cmd.bat**\n```shell\ncmd /k \"set path=%path%;%~dp0..\\Consoler\"\n```\n\n- this script starts the Windows command prompt and sets the path to the Consoler folder\n- place this script in your project folder\n- to run it, open the project folder using File Explorer, and then double-click on the script file  \n\n2. **make.bat**\n```bat\n@echo off\nSet \"appName=MyGame\"\n\nif \"%1\"==\"-s\" (\n\tgoto compile_static_lib\n) else (\n\tgoto compile_dynamic_lib\n)\n\n:compile_dynamic_lib\n\techo Compiling with the Consoler dynamic library...\n\t@echo on\n\tg++ -I../Consoler %appName%.cpp -o %appName%.exe -DUNICODE -O3 -lwinmm -L../Consoler -lConsoler\n\t@echo off\n\tgoto end\n\n:compile_static_lib\n\techo Compiling with the Consoler static library...\n\t@echo on\n\tg++ -I../Consoler %appName%.cpp ../Consoler/ConsolerStatic.lib -o %appName%.exe -DUNICODE -O3 -DSTATIC -lwinmm -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread\n\t@echo off\n\tgoto end\n\n:end\n\tif %errorlevel% == 0 (\n\t\techo.\n\t\techo Successfully Compiled.\n\t\techo Running %appName%.exe...\n\t\t%appName%.exe\n\t)\n```\n\n- this script compiles the source code of your game (MyGame.cpp) and makes its executable code (MyGame.exe)\n- if the compilation is successfull, the game starts\n- to build the game dynamically enter **\"make -d\"** or just **\"make\"** at the command prompt\n- to build the game statically enter **\"make -s\"** at the command prompt  \n\n3. **run.bat**\n```shell\nMyGame.exe\n```\n\n- this script runs the executable code of your game (MyGame.exe)\n\n\n## Image Converter Tool (How to display images and sprites at command prompt)\nTo display an image in the Windows Console, it must be converted to a series of bytes, where each byte represent the nearest console color of a single pixel. So I made a special image conversion tool using **SFML** library, which does this dirty job.  \n\nThe tool is placed in the **ImageConv** folder.  \n\nThe executable file **Converter.exe** is compressed within the **Converter.zip** archive.  \nYou can also compile the source code **Converter.c** on your own by running the **make.bat** script.  \nTo compile it, you need a C++ compiler and the SFML library installed on your computer.  \n\nTo use the tool, put a .png image in the .\\assets folder and run the following command:  \n```shell\nConverter.exe [folder] [filename]\n```\n\nExample:  \n```shell\nConverter assets img_pallete\n```\n\nThe tool will convert your **.png** image into two binary files with the **.bin** extension, which you can then use as a sprite in your Windows Console game.  \n\nYou can also use the Converter tool directly from your project folders by running the following **conv.bat** script:  \n\n```shell\n..\\ImageConv\\Converter.exe %~dp0assets %1\n```\n\n- this script runs the Console Image Converter tool directly from your project folder  \n- to use it, put a .png image (for instance **img_test.png**) in the **.\\assets** folder of your project folder  \n- to run the tool, execute this command: **conv img_test**  \n- after the conversion is complete, find two new binary files **spr_test_1.bin** and **spr_test_2.bin** in the **.\\assets** folder, and use one of them in your game.  \n\n\n## License notice\nCopyright (C) 2021 Ask For Game Task\n\nAll programs in this repository are protected by GNU General Public License version 3.  \nIf you use them, you must attribute me.\n\nEach program in this repository is free software: \nyou can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.\n\nEach program in this repository is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n\nSee the LICENSE file for more details on the GNU General Public License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssusnic%2Fwindows-console-game-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssusnic%2Fwindows-console-game-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssusnic%2Fwindows-console-game-framework/lists"}