Giter VIP home page Giter VIP logo

flat's Introduction

Flat

maintenance Build Status Build status codecov Codacy Badge CodeFactor Join the chat at https://gitter.im/flat2d/Lobby HitCount

About

Flat is a 2D game engine based on SDL2. It's currently in progress with no deadline for completion. It will be completed when I'm happy with it. The main goal was to create an engine where writing code was what you mainly did. No drag and drop UIs no autogenerated code. Just pure C++ to make your game. The engine is growing rather frequently and the API changes a lot. But the API should be kept up to date if I'm doing my job right.

Features

  • Simple collision handling
  • Parallax effects
  • Music and sound
  • Game controller support
  • hiDPI screen support

Compiling

Before compiling you need to install SDL2, SDL2_image, SDL2_mixer and SDL2_ttf

  • Clone the project and navigate to the root folder
  • mkdir build
  • cd build
  • cmake ..
  • make

Getting started

#include <iostream>
#include <flat/flat.h>

int main(int argc, char* argv[])
{
	std::cout << "Loading Flat" << std::endl;
	flat2d::FlatBuilder *flat = new flat2d::FlatBuilder();
	flat->loadSDL("Flat Demo", 60, 800, 600);
	flat2d::GameEngine *engine = flat->getGameEngine();

	flat2d::EntityContainer *container = flat->getGameData()->getEntityContainer();
	// You can register your objects to the container here. Objects extend the Entity class in flat

	// Create the callback methods
	auto stateCallback = [](flat2d::GameData *gameData) -> flat2d::GameStateAction {
		return flat2d::GameStateAction::NOOP;
	};
	auto handleCallback = [](const SDL_Event& event) -> void {
		// Nothing to do here
	};

	std::cout << "Starting the engine" << std::endl;
	// stateCallback and handleCallback can be omitted if you don't need them
	engine->run(stateCallback, handleCallback);
	std::cout << "Exiting" << std::endl;

	delete flat;
}

Contributing

If you have some feature idea that you'd like to see added to flat you are most welcome to fork the project and create a pull request with your idea in code form or create an issue and I'll have a look at it.

At the moment of writing (2018-02-20) I'm working on a good old C game project and flat isn't getting the frequent updates that one might expect. But I love to code so I don't mind some ideas thrown into the mix. The project isn't dead is the point I want to make by this.

Demos

Just Don't Die

Examples

Documentation

flat's People

Contributors

gitter-badger avatar hxhieu avatar liquidityc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flat's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.