libmx-dev Documentation

MX Cross Platform C++ Library


MX Summary

MX is a cross platform library for creating multi-threaded multimedia applications. It is a layer above SDL ( Simple DirectMedia Layer ), but provides more than just using SDL alone. SDL can be downloaded @ http://libsdl.org Some of MX's features include png graphics without SDL_image and its own font rendering system.

Design concept

There is one main class which you will make one instance of. However this class must inhert from a abstract class which contains majority of the code for the programs window and render loop. You will use two pure virtual functions eventPassed and renderScreen for the applications event proccessing and drawing to the screen. All other parts of the application will be in classes that will have instances inside the one main class.

Installation

First you will need to download MX, you can grab a up to date tarball from the SVN by following this link: libmx.tar.gz or use svn command line tool, to download the newest. ( $ svn co svn://lostsidedead.com/haze/trunk/libmx )
Or perhaps you dont feel like compiling you can download a binary package:

(K/X/E/U)buntu Linux
[X86] libmx-dev-0.3-x86.deb
[X64] libmx-dev-0.3.1-amd64.deb

Mingw32:
[WIN32] libmx-0.3.1-win32.zip

Mac OS X (intel Leopard):
[OSX] libmx-0.3.1-OSX.zip

Or other binary packages depending on your platform. View the Releases Folder

Second if you are going to compile, you will first have to compile the the depedencys of the library, libpng, zlib, and SDL (1.2.13 prefered) once these are compiled and installed you should cd into the directory containing autogen.sh for checking out the source it would be the location where you checked out/tricolor After your in the directory bootstrap the programs configuration files like this.

$ ./autogen.sh

Then configure: (note you can use --prefix --host --target for cross compilng)

$ ./configure

Then make

$
make

If you wish to install: as root or sudo

$ sudo make install

Other configure arguments:

--enable-tests - enables the program tests of mx to be compiled
--enable-subtext - enables subtext in tricolor


Compiling a app using MX

If you have pkg-config (if you dont download it) then to compile a program it could be as easy as:

$ g++ main.cpp `pkg-config mx sdl --cflags --libs` -o test



examples for MX can be found in the Web SVN

Example App Skeleton

#include<mx.h>

class window : public mx::mxWnd {

public:
	window() : mxWnd(640, 480, 0) 
	{ 
		// init code here
	} 

	virtual void eventPassed(SDL_Event &e)
	{

		switch(e.type)
		{
		case SDL_QUIT:
			quit();
			break;
		}

		if(e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_ESCAPE) quit();

	}

	virtual void renderScreen()
	{
		// draw here
		SDL_FillRect(front, 0, SDL_MapRGB(front, 255,255,255));

		front.Flip();
	}

};


int main(int argc, char **argv)
{

	try
	{
		window w;
		return w.messageLoop();
	}
	catch(mx::mxException<std::string> &e)
	{
		e.printError(std::cerr);
	}
	catch(std::exception &e)
	{
		std::cerr << e.what() << "\n";
	}
	catch(...)
	{
		std::cout << "unhandled exception\n";
	}

	return EXIT_FAILURE;

}


Download Skeleton.cpp

Download a demo using libmx-dev: Mutatris
View Mutatris source code Mutatris in WebSVN

Documentation in Windows Help Format (CHM)


Generated on Sun May 25 22:31:11 2008 for libmx-dev by  doxygen 1.5.5