Code Monkey home page Code Monkey logo

sbdl's Introduction

SBDL (Sadegh & Borjian Directmedia Layer)

A wrapper around SDL2 which make use of SDL much simpler

Motivation

For years in Shahid Beheshti University, ITP final project was a game written using SDL library. Since the bare SDL library is too verbose and hard to use for first-year students in college, each year TAs create their own wrapper for SDL to ease the SDL for students. This library is successor of Hash<Written for ITP96Fall> and Genio2<Written for ITP95Fall> with great experience which we learned from those libraries.

Mohammad Sadegh Dehghan & Amin Borjian wrote this library to fulfill all the needs of a first-term student for ITP97Fall course and all upcoming ITP courses in future.

Basic Usage

  1. Put include directories of SDL2,SDL2_image,SDL2_ttf,SDL2_mixer in your compiler's include directory.
  2. Put lib directories of SDL2,SDL2_image,SDL2_ttf,SDL2_mixer in your linker's path.
  3. Put SDL2Main.lib,SDL2.lib,SDL2_image.lib,SDL2_mixer.lib,SDL2_ttf.lib in linker's dependencies.
  4. Start Coding:
#include "SBDL.h"

using namespace std;

int main(int argc, char *argv[])
{
	const int window_width = 500;
	const int window_height = 500;
	SBDL::InitEngine("SBDL Test", window_width, window_height);

	const int FPS = 60; //frame per second
	const int delay = 1000 / FPS; //delay we need at each frame


	while (SBDL::isRunning()) {
		int startTime = SBDL::getTime();
		
		SBDL::updateEvents();
		SBDL::clearRenderScreen();

		//Game logic code

		SBDL::updateRenderScreen();
		
		int elapsedTime = SBDL::getTime() - startTime;
		if (elapsedTime < delay)
			SBDL::delay(delay - elapsedTime);

	}
}

Contribution

If you find any bugs,need a new feature,etc feel free to create an issue[https://github.com/MSDehghan/SBDL/issues]

Pull requests are also appreciated.

License

This library is released under GPL v3

sbdl's People

Contributors

borjianamin98 avatar msdehghan avatar

Watchers

 avatar

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.