{"id":16105556,"url":"https://github.com/mstuttgart/ludic-game-library","last_synced_at":"2025-10-23T11:31:40.899Z","repository":{"id":18673993,"uuid":"21882506","full_name":"mstuttgart/ludic-game-library","owner":"mstuttgart","description":"( Unmaintained ) Oriented Object Game Library in C++","archived":true,"fork":false,"pushed_at":"2019-10-12T16:50:41.000Z","size":30404,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-19T10:24:41.547Z","etag":null,"topics":["allegro","c-plus-plus","framework","game-library","ludic-library"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mstuttgart.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}},"created_at":"2014-07-16T01:48:05.000Z","updated_at":"2024-06-30T18:12:05.000Z","dependencies_parsed_at":"2022-09-14T13:12:21.501Z","dependency_job_id":null,"html_url":"https://github.com/mstuttgart/ludic-game-library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstuttgart%2Fludic-game-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstuttgart%2Fludic-game-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstuttgart%2Fludic-game-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstuttgart%2Fludic-game-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mstuttgart","download_url":"https://codeload.github.com/mstuttgart/ludic-game-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237821586,"owners_count":19371791,"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","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":["allegro","c-plus-plus","framework","game-library","ludic-library"],"created_at":"2024-10-09T19:09:59.072Z","updated_at":"2025-10-23T11:31:35.340Z","avatar_url":"https://github.com/mstuttgart.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ludic-Game-Library\n\nThe Ludic Game Library, or Ludic library is a oriented object multi-platform game library, \ndeveloped on Allegro5 API and the C++ language, focused on the development of 2D games. \nIts main focus is academia, providing students tools that will facilitate learning the \ntechniques used in creating electronic games.\n\n\u003cp align=\"center\"\u003e\n\u003ca name=\"top\" href=\"https://github.com/mstuttgart/ludic-game-library\"\u003e\u003cimg src=\"images/screenshot.jpg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nDo you liked it? See the portuguese doc about: [here](https://drive.google.com/open?id=0ByiecNQsXD1GWlZWeTNzc3RqOXc)\n\nPs.: Saga Game Library is the previous name of Ludic Game Library.\n\n## Features\n\nThe current version is usable. However, we intend to improve it even more, \nso it is defined as an beta version.\n\n* Support the animated sprites\n* Support the Tiled level editor to create Levels for you \ngames and animations for you Animated Sprites.\n* Support the several image formates provide by Allegro 5 API: BMP, PCX, TGA. \nEvery platform also supports JPEG and PNG via external dependencies.\n* Rendering using 3D hardware acceleration.\n* Support of True Type fonts (.ttf)\n* Support of several audio formates: .wav, .flac, .ogg, .it, .mod, .s3m, .xm. \nInclude support to play BGM and SFX sounds.\n* Support of mouse and keyboard inputs. Support for joystick soon.\n* Resource Manager proven methods to manage and control memory while allocating \nimage resources, and audio sources.\n* Support of collision checking by rectangles and pixel-perfect methods.\n* Simple and easy to use :)\n\n## Use exemple\n\n```cpp\n#include \"video.hpp\"\n#include \"static_sprite.hpp\"\n#include \"animated_sprite.hpp\"\n#include \"keyboard_manager.hpp\"\n#include \"mouse_manager.hpp\"\n#include \"font.hpp\"\n#include \"time_handler.hpp\"\n#include \"color.hpp\"\n#include \"config_file_stream.hpp\"\n#include \"tmx_tile_map.hpp\"\n#include \"util.hpp\"\n#include \"audio_sample.hpp\"\n#include \"audio_stream.hpp\"\n#include \"time_handler.hpp\"\n\nusing namespace sgl;\nusing namespace sgl::image;\nusing namespace sgl::font;\nusing namespace sgl::input;\nusing namespace sgl::core;\nusing namespace sgl::audio;\n\nusing namespace std;\n\n/* Constantes do sprite*/\n#define FPS 15\n\nint main()\n{\n\n\t//---------------------------\n\n\tVideo video ( 800, 515 );\n\n\tvideo.setTitle ( \"Saga Game Library\" );\n\tvideo.setIcon ( \"Resource/icone.png\" );\n\n\tvideo.setBackgroundColor ( Color ( 145,184,60 ) );\n\n\t//-----------------------------------------------\n\n\t// Inicializamos os dispositivos de entrada\n\tKeyboardManager* keyboard = KeyboardManager::Instance();\n\tMouseManager* mouse       = MouseManager::Instance ( \u0026video );\n\n\t//-----------------------------------------------\n\n\tAnimatedSprite spr;\n\tspr.load ( \"Resource/mapas/personagem.tmx\" );\n\n\t// Ajustamos posicao do sprite\n\tspr.setPosition ( Vector2D ( 150.0f, 100.0f ) );\n\n\t// Colocamos o sprite como visible\n\tspr.setVisible ( true );\n\n\tAnimatedSprite enemy;\n\tenemy.load ( \"Resource/mapas/death.tmx\" );\n\tenemy.setPosition ( Vector2D ( 550.0f, 300.0f ) );\n\tenemy.setVisible ( true );\n\n\tAnimatedSprite explosion;\n\texplosion.load ( \"Resource/mapas/explosion.tmx\" );\n\texplosion.setVisible ( false );\n\n\tAudioSample splExp;\n\tsplExp.load ( \"Resource/mapas/spl.wav\" );\n\tsplExp.setGain ( 0.4 );\n\n\t//------------------------------------------\n\n\tAudioStream musica;\n\tmusica.load ( \"Resource/audio/Artifact.ogg\", 4, 1024 );\n\n\t//--------------------------------------- ----\n\n\tFont texto;\n\ttexto.load ( \"Resource/ALGER.TTF\", 40 );\n\ttexto.setColorFont ( Color ( 255, 255, 255 ) );\n\n\t//-------------------------------------------\n\n\tTimeHandler t;\n\tt.start();\n\t\n\tTMXTileMap mapa;\n\tmapa.load ( \"Resource/rpg/mapa.tmx\" );\n\tt.pause();\n\tcout \u003c\u003c t.getTicks() \u003c\u003c endl;\n\n\tmapa.setScreenDimension ( video.getWidth(), video.getHeight() );\n\n\t//-------------------------------------------\n\n\tstd::vector\u003cLayer*\u003e layerManager;\n\n\tlayerManager.push_back ( mapa.getLayer ( \"Piso\" ) );\n\tlayerManager.push_back ( \u0026spr );\n\tlayerManager.push_back ( \u0026enemy );\n\tlayerManager.push_back ( \u0026explosion );\n\tlayerManager.push_back ( mapa.getLayer ( \"Objetos\" ) );\n\tlayerManager.push_back ( mapa.getLayer ( \"Arvores\" ) );\n\tlayerManager.push_back ( mapa.getLayer ( \"Colisao\" ) );\n\n\tTiledLayer* l = mapa.getLayer ( \"Colisao\" );\n\n\tint movex = 0;\n\tint movey = 0;\n\tint x = 0, j = 0, colFlag = 0;\n\tint varCtr = 0;\n\n\tBoundingBox bb;\n\n\t//-----------------------------------------\n\n\tdouble div = 1.0 / FPS;\n\tbool sair  = false;\n\n\tTimeHandler fpsTimer;\n\n\t//-----------------------------------------\n\n\tALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue();\n\tALLEGRO_TIMER *timer             = al_create_timer ( div );\n\n\tal_register_event_source ( event_queue, al_get_display_event_source ( video ) );\n\tal_register_event_source ( event_queue, al_get_timer_event_source ( timer ) );\n\n\tbool redraw = false;\n\n\t//double cTime;\n\tVector2D desloc ( 0 , 0 );\n\tVector2D desloc_enemy ( 0,0 );\n\n\tal_start_timer ( timer );\n\n\twhile ( !sair )\n\t{\n\n\t\tALLEGRO_EVENT ev;\n\n\t\tal_wait_for_event ( event_queue, \u0026ev );\n\n\t\tif ( ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE )\n\t\t{\n\t\t\tsair = true;\n\t\t}\n\t\telse if ( ev.type == ALLEGRO_EVENT_TIMER )\n\t\t{\n\n\t\t\t// Realiza um tipo de snapshoot no estado das teclas\n\t\t\tkeyboard-\u003eupdate();\n\t\t\tmouse-\u003eupdate();\n\n\t\t\t// Atualizamoa posicao do personagem de acordo com o sprite\n\t\t\tmovex   = 0;\n\t\t\tmovey   = 0;\n\t\t\tvarCtr +=1;\n\n\t\t\tif ( keyboard-\u003ekeyPressed ( KeyCode::KEY_RIGHT ) )\n\t\t\t{\n\t\t\t\tspr.setCurrentAnimation ( \"Direita\" );\n\t\t\t\tmovex = 5;\n\t\t\t}\n\n\t\t\tif ( keyboard-\u003ekeyPressed ( KeyCode::KEY_LEFT ) )\n\t\t\t{\n\t\t\t\tspr.setCurrentAnimation ( \"Esquerda\" );\n\t\t\t\tmovex = -5;\n\t\t\t}\n\n\t\t\tif ( keyboard-\u003ekeyPressed ( KeyCode::KEY_UP ) )\n\t\t\t{\n\t\t\t\tspr.setCurrentAnimation ( \"Costas\" );\n\t\t\t\tmovey = -5;\n\t\t\t}\n\n\t\t\tif ( keyboard-\u003ekeyPressed ( KeyCode::KEY_DOWN ) )\n\t\t\t{\n\t\t\t\tspr.setCurrentAnimation ( \"Frente\" );\n\t\t\t\tmovey = 5;\n\t\t\t}\n\n\t\t\tif ( keyboard-\u003ekeyRelease ( KeyCode::KEY_ESCAPE ) )\n\t\t\t{\n\t\t\t\tsair = true;\n\t\t\t}\n\n\t\t\tif ( keyboard-\u003ekeyTyped ( KeyCode::KEY_SPACE ) )\n\t\t\t{\n\t\t\t\tmusica.play();\n\t\t\t\ttexto.setText ( \"play\" );\n\t\t\t}\n\t\t\telse if ( keyboard-\u003ekeyTyped ( KeyCode::KEY_P ) )\n\t\t\t{\n\t\t\t\tmusica.pause();\n\t\t\t\ttexto.setText ( \"pause\" );\n\t\t\t}\n\t\t\telse if ( keyboard-\u003ekeyTyped ( KeyCode::KEY_S ) )\n\t\t\t{\n\t\t\t\tmusica.stop();\n\t\t\t\ttexto.setText ( \"stop\" );\n\t\t\t}\n\n\t\t\tif ( keyboard-\u003ekeyTyped ( KeyCode::KEY_V ) )\n\t\t\t{\n\t\t\t\tl-\u003esetVisible ( !l-\u003eisVisible() );\n\t\t\t}\n\n\n\t\t\tif ( varCtr \u003c 30 )\n\t\t\t{\n\t\t\t\tenemy.setCurrentAnimation ( \"Esquerda\" );\n\t\t\t\tx = -5;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tenemy.setCurrentAnimation ( \"Direita\" );\n\t\t\t\tx = +5;\n\n\t\t\t\tif ( varCtr \u003e 60 )\n\t\t\t\t\tvarCtr = 0;\n\t\t\t}\n\n\t\t\tdesloc_enemy.setCoordinates ( x,0 );\n\t\t\tenemy.move ( desloc_enemy );\n\t\t\tenemy.nextFrame();\n\n\t\t\tif ( ( colFlag \u003e 0 ) \u0026\u0026 ( colFlag \u003c 9 ) )\n\t\t\t{\n\t\t\t\texplosion.nextFrame();\n\t\t\t\tcolFlag+=1;\n\t\t\t}\n\t\t\telse if ( colFlag == 9 )\n\t\t\t{\n\t\t\t\texplosion.setVisible ( false );\n\t\t\t\tcolFlag = 0;\n\t\t\t}\n\n\t\t\tif ( spr.collidesWith ( \u0026enemy ) )\n\t\t\t{\n\t\t\t\ttexto.setText ( \"Game Over\" );\n\t\t\t\tfloat xTexto = video.getWidth() * 0.5  - texto.getTextWidth() * 0.5;\n\t\t\t\tfloat yTexto = video.getHeight() * 0.5 - texto.getLineHeight() * 0.5;\n\t\t\t\ttexto.setPosition ( Vector2D ( xTexto, yTexto ) );\n\n\t\t\t\tVector2D v = spr.getPosition();\n\t\t\t\tv.setCoordinates ( v.getX() - 32, v.getY() - 48 );\n\n\t\t\t\texplosion.setPosition ( v );\n\t\t\t\texplosion.setVisible ( true );\n\n\t\t\t\tsplExp.play();\n\t\t\t\tmusica.pause();\n\n\t\t\t\tcolFlag = 1;\n\n\t\t\t\tspr.setPosition ( Vector2D ( -1.0f, -1.0f ) );\n\t\t\t\tspr.setVisible ( false );\n\n\t\t\t}//if\n\n\t\t\tif ( mouse-\u003ebuttonPressed ( 1 ) )\n\t\t\t{\n\n\t\t\t\tVector2D v1 = mouse-\u003egetPosition();\n\t\t\t\tbb = enemy.getBoundingBox();\n\t\t\t\tBoundingBox teste ( v1,0,0 );\n\n\t\t\t\tif ( bb.checkCollision ( teste ) )\n\t\t\t\t{\n\t\t\t\t\tVector2D v = enemy.getPosition();\n\t\t\t\t\tv.setCoordinates ( v.getX() - 32, v.getY() - 48 );\n\n\t\t\t\t\texplosion.setPosition ( v );\n\t\t\t\t\texplosion.setVisible ( true );\n\n\t\t\t\t\tcolFlag = 1;\n\n\t\t\t\t\tif ( j == 0 )\n\t\t\t\t\t\tsplExp.play();\n\n\t\t\t\t\texplosion.nextFrame();\n\n\t\t\t\t\tenemy.setPosition ( Vector2D ( -100.0f, -100.0f ) );\n\t\t\t\t\tenemy.setVisible ( false );\n\n\t\t\t\t}//if\n\t\t\t}//if\n\n\t\t\t// Verificamos se podemos nos movimentar no eixo X\n\t\t\tif ( l-\u003echeckCollision ( spr, movex, 0, 2 ) )\n\t\t\t{\n\t\t\t\tmovex = 0;\n\t\t\t}\n\n\t\t\tif ( l-\u003echeckCollision ( spr, 0, movey, 2 ) )\n\t\t\t{\n\t\t\t\tmovey = 0;\n\t\t\t}\n\n\t\t\tif ( movex || movey )\n\t\t\t{\n\t\t\t\tdesloc.setCoordinates ( movex, movey );\n\t\t\t\tspr.move ( desloc );\n\t\t\t\tspr.nextFrame();\n\t\t\t}\n\n\t\t\tredraw = true;\n\n\t\t}//if timer\n\n\t\tif ( redraw \u0026\u0026 al_is_event_queue_empty ( event_queue ) )\n\t\t{\n\n\t\t\tredraw = false;\n\n\t\t\t// Desenhamos cada uma das camadas\n\t\t\tal_hold_bitmap_drawing ( true );\n\n\t\t\tfor ( unsigned int i = 0; i \u003c layerManager.size(); i++ )\n\t\t\t{\n\t\t\t\tlayerManager.at ( i )-\u003edraw();\n\t\t\t}\n\n\t\t\ttexto.drawText();\n\n\t\t\tal_hold_bitmap_drawing ( false );\n\n\t\t\t// Atualizamos a tela\n\t\t\tvideo.refresh();\n\n\t\t}\n\n\t}//while\n\n\tal_destroy_event_queue ( event_queue );\n\tal_destroy_timer ( timer );\n\n\treturn 0;\n\n}\n\n```\n\n## Contributing\n\nIf you'd like to contribute, please create a fork and issue pull requests! I am\nvery open to newcomers, and will need all the help we can get to make the best\nGame Library available.\n\n### Dependences\n\nLudic Game Library makes use of other libraries to perform some of their routines:\n\n* Allegro 5.0.10 - http://liballeg.org/\n* TinyXML - http://www.grinninglizard.com/tinyxml/ - under ZLIB License\n* zlib 1.2.3 - http://www.zlib.net - under zlib License\n* Support for tile maps and animations made with Tiled. - http://www.mapeditor.org/\n\n### I found a bug!\n\nPlease report any and all bugs using the project issue\ntracker. Be as precise as possible so that the bug can be found easier. Thanks!\n\n## License\n\nLudic Game Library is released under the MIT License. This license is very simple and very permissive, go to the LICENSE file on the root of the distribution for its complete text. Just remember that Ludic Game Library uses other external libraries, and they have their own licenses that must be respected.\n\n## Credits\n\nCopyright (C) 2013-2015 by Michell Stuttgart Faria, Paulo Vicente Gomes dos Santos and Alfredo José de Paula Barbosa.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstuttgart%2Fludic-game-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmstuttgart%2Fludic-game-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstuttgart%2Fludic-game-library/lists"}