/*
	Twilight Prophecy 3D/Multimedia SDK
	A multi-platform development system for virtual reality and multimedia.

	Copyright (C) 1997-2001 by Twilight 3D Finland Oy Ltd.
*/

/*
TODO: reference implementation in this folder: "../win32/config.hpp"
*/

#ifndef PRCORE_CONFIGURED
#if defined( __linux__ )
#define PRCORE_CONFIGURED

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> // for va_start

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>

#include <GL/glx.h> // only load GLX extension
// platform
	#define __LINUX__
	#define PRCORE_PLATFORM_LINUX
	
// interface
	#define PREXPORT
	#define PRIMPORT
	#define PRAPI

#define __cdecl // not a part of ANSI C++


// additional defines

#define min(X,Y) (X <? Y)
#define max(X,Y) (X >? Y)
        
// having problems with this too :)
// window.cpp: In method `TestWindow::TestWindow()':
//window.cpp:54: no matching function for call to `TestWindow::Open (int, int, char[5], NULL)'
//../../prcore/include/window.hpp:41: candidates are: ::prcore::WindowBase::Open(int, int, const char *, int)
// this fixes despite warning
#ifndef NULL
       #define NULL 0
#endif

	// flags
	#define PR_LITTLE_ENDIAN
	#define PR_X86_SIMD


	// types
        typedef	signed char	int8;
	typedef	signed short		int16;
	typedef signed int		int32;
	typedef signed long long	int64;
	typedef	unsigned char		uint8;
	typedef	unsigned short		uint16;
	typedef unsigned int		uint32;
	typedef unsigned long long	uint64;



#ifdef PRCORE_IMPLEMENT_MAIN
extern int prmain(int argc, char** argv);
int main(int argc, char** argv)
{
  return prmain(argc, argv);
}
#endif

	// window handle
	struct WinHandle
	{
		//TODO

	  Display *dpy;
	  Window win;
	  Atom delete_atom;
	  XVisualInfo *VisualInfo;
	  
	  Pixmap EmptyPixmap;
	  Cursor EmptyCursor;
	};


	// string compare
	inline int stricmp(const char* a, const char* b)
	{
		return strcasecmp(a,b);
	}
	


#endif
#endif
