2011-10-19 14:16:31 +02:00
|
|
|
/**
|
|
|
|
*******************************************************************************
|
2011-11-23 11:37:38 +01:00
|
|
|
* @file etk/Types.h
|
2011-10-19 14:16:31 +02:00
|
|
|
* @brief Ewol Tool Kit : generique define type
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @date 08/06/2010
|
|
|
|
* @par Project
|
|
|
|
* Ewol TK
|
|
|
|
*
|
|
|
|
* @par Copyright
|
|
|
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
|
|
*
|
|
|
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY.
|
|
|
|
*
|
|
|
|
* Licence summary :
|
|
|
|
* You can modify and redistribute the sources code and binaries.
|
|
|
|
* You can send me the bug-fix
|
|
|
|
*
|
|
|
|
* Term of the licence in in the file licence.txt.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ETK_TYPES_H__
|
|
|
|
#define __ETK_TYPES_H__
|
|
|
|
|
|
|
|
// includes system, malloc, EXIT_SUCCESS
|
|
|
|
#include <stdlib.h>
|
|
|
|
// includes fopen, fwrite, fseek, ftell
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2011-10-20 10:17:00 +02:00
|
|
|
|
2011-10-19 14:16:31 +02:00
|
|
|
#ifndef __int8_t_defined
|
|
|
|
# define __int8_t_defined
|
|
|
|
typedef signed char int8_t;
|
|
|
|
typedef signed short int int16_t;
|
|
|
|
typedef int int32_t;
|
|
|
|
typedef signed long long int int64_t;
|
|
|
|
#endif
|
|
|
|
|
2011-10-20 10:17:00 +02:00
|
|
|
#ifndef __uint8_t_defined
|
|
|
|
# define __uint8_t_defined
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
typedef unsigned short int uint16_t;
|
2011-10-20 18:24:43 +02:00
|
|
|
typedef unsigned int uint32_t;
|
2011-11-02 17:10:11 +01:00
|
|
|
# if __WORDSIZE == 64
|
|
|
|
typedef unsigned long int uint64_t;
|
|
|
|
# else
|
|
|
|
typedef unsigned long long int uint64_t;
|
|
|
|
# endif
|
2011-10-20 10:17:00 +02:00
|
|
|
#endif
|
2011-11-06 20:24:44 +01:00
|
|
|
typedef int32_t uniChar_t;
|
2011-11-02 17:10:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-20 18:24:43 +02:00
|
|
|
#define etk_min(elemA, elemB) ((elemA)<(elemB)) ? (elemA) : (elemB)
|
|
|
|
#define etk_max(elemA, elemB) ((elemA)<(elemB)) ? (elemB) : (elemA)
|
|
|
|
#define etk_avg(minimim, elem, maximum) ((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem)
|
2011-10-19 14:16:31 +02:00
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2011-11-10 18:23:19 +01:00
|
|
|
#ifdef EWOL_PECISION_DOUBLE
|
|
|
|
typedef double etkFloat_t;
|
|
|
|
#define oglTypeFloat_t GL_DOUBLE
|
|
|
|
#else
|
|
|
|
typedef float etkFloat_t;
|
|
|
|
#define oglTypeFloat_t GL_FLOAT
|
|
|
|
#endif
|
|
|
|
|
2011-10-29 17:32:11 +02:00
|
|
|
struct etkPointAndPositionDouble{
|
2011-11-10 18:23:19 +01:00
|
|
|
etkFloat_t x;
|
|
|
|
etkFloat_t y;
|
2011-10-19 14:16:31 +02:00
|
|
|
};
|
2011-10-29 17:32:11 +02:00
|
|
|
|
|
|
|
struct etkPointAndPositionInt{
|
|
|
|
int32_t x;
|
|
|
|
int32_t y;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef etkPointAndPositionDouble point_ts;
|
|
|
|
typedef etkPointAndPositionDouble position_ts;
|
|
|
|
typedef etkPointAndPositionDouble size_ts;
|
|
|
|
typedef etkPointAndPositionInt intSize_ts;
|
2011-10-30 14:52:55 +01:00
|
|
|
|
|
|
|
typedef struct {
|
2011-11-10 18:23:19 +01:00
|
|
|
etkFloat_t x;
|
|
|
|
etkFloat_t y;
|
|
|
|
etkFloat_t z;
|
2011-10-30 14:52:55 +01:00
|
|
|
}coord3D_ts;
|
|
|
|
typedef struct {
|
2011-11-10 18:23:19 +01:00
|
|
|
etkFloat_t x;
|
|
|
|
etkFloat_t y;
|
2011-10-30 14:52:55 +01:00
|
|
|
}coord2D_ts;
|
|
|
|
typedef struct {
|
2011-11-10 18:23:19 +01:00
|
|
|
etkFloat_t u;
|
|
|
|
etkFloat_t v;
|
2011-10-30 14:52:55 +01:00
|
|
|
}texCoord_ts;
|
|
|
|
typedef struct {
|
2011-11-10 18:23:19 +01:00
|
|
|
etkFloat_t red;
|
|
|
|
etkFloat_t green;
|
|
|
|
etkFloat_t blue;
|
|
|
|
etkFloat_t alpha;
|
2011-10-30 14:52:55 +01:00
|
|
|
}color_ts;
|
2011-10-19 14:16:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|