first step for abstraction of the hardware

This commit is contained in:
Edouard Dupin 2011-10-20 10:17:00 +02:00
parent 257c7354d6
commit 57d1d2ec74
13 changed files with 417 additions and 21 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@
###################################
CVS
.svn
Object/
Object_*
doxygen/API/
doxygen/ALL/

View File

@ -40,6 +40,29 @@ VERSION_TAG_SHORT=$(shell git describe --tags --abbrev=0)
VERSION_BUILD_TIME=$(shell date)
#$(info $(VERSION_BUILD_TIME))
###############################################################################
### Platform specificity : ###
###############################################################################
SUPPORTED_PLATFORM=X11 DoubleBuffer IPhone Android
DEFAULT_PLATFORM=X11
# default platform can be overridden
PLATFORM?=$(DEFAULT_PLATFORM)
ifeq ($(PLATFORM), X11)
CXXFILES += base/guiX11.cpp
else ifeq ($(PLATFORM), DoubleBuffer)
CXXFILES += base/guiDoubleBuffer.cpp
else ifeq ($(PLATFORM), IPhone)
CXXFILES += base/guiIPhone.cpp
else ifeq ($(PLATFORM), Android)
CXXFILES += base/guiAndroid.cpp
else
$(error you must specify a corect platform : make PLATFORM=$(SUPPORTED_PLATFORM))
endif
$(info Build for $(PLATFORM))
###############################################################################
### Compilateur base system ###
###############################################################################
@ -53,9 +76,14 @@ DEBUG:=1
### Compilation Define ###
###############################################################################
ifeq ("$(DEBUG)", "0")
DEFINE= -DETK_DEBUG_LEVEL=1 -DNDEBUG -DETK_VERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
DEFINE = -DETK_DEBUG_LEVEL=1
DEFINE+= -DEWOL_DEBUG_LEVEL=1
DEFINE+= -DNDEBUG
DEFINE+= -DEWOL_VERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
else
DEFINE= -DETK_DEBUG_LEVEL=3 -DETK_VERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
DEFINE = -DETK_DEBUG_LEVEL=3
DEFINE+= -DEWOL_DEBUG_LEVEL=3
DEFINE+= -DEWOL_VERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
endif
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
@ -66,7 +94,7 @@ X11FLAGS= -lX11 -lGL -lGLU -lXrandr
###############################################################################
# basic X11 librairy ==> show if we can une under lib ...
CXXFLAGS= $(X11FLAGS)
CXXFLAGS= $(X11FLAGS) -D__PLATFORM__=$(PLATFORM)
ifeq ("$(DEBUG)", "0")
# Enable debug (cgdb ***)
@ -100,7 +128,7 @@ PROG_NAME=ewol
FILE_DIRECTORY=Sources
OUTPUT_NAME_RELEASE=$(PROG_NAME)_release
OUTPUT_NAME_DEBUG=$(PROG_NAME)_debug
OBJECT_DIR=Object
OBJECT_DIR=Object_$(PLATFORM)
ifeq ("$(DEBUG)", "0")
OBJECT_DIRECTORY=$(OBJECT_DIR)/release
@ -122,7 +150,7 @@ MAKE_DEPENDENCE=Makefile
###############################################################################
# Ewol Tool Kit :
CXXFILES = etk/etkDebug.cpp \
CXXFILES += etk/etkDebug.cpp \
etk/etkDebugInternal.cpp \
etk/etkMemory.cpp \
etk/etkString.cpp \

View File

@ -0,0 +1,48 @@
/**
*******************************************************************************
* @file guiAndroid.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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.
*
*******************************************************************************
*/
#include <ewolDebug.h>
#include <guiAndroid.h>
#undef __class__
#define __class__ "guiAbstraction"
void guiAbstraction::Init(int32_t argc, char *argv[])
{
EWOL_INFO("INIT for Android environement");
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Start Running");
EWOL_INFO("Stop Running");
}
void guiAbstraction::UnInit(void)
{
EWOL_INFO("UN-INIT for Android environement");
}

40
Sources/base/guiAndroid.h Normal file
View File

@ -0,0 +1,40 @@
/**
*******************************************************************************
* @file guiAndroid.h
* @brief Gui abstraction layer (header)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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 __GUI_ABSTRACTION_H__
#define __GUI_ABSTRACTION_H__
#include <etkTypes.h>
namespace guiAbstraction
{
void Init(int32_t argc, char *argv[]);
void Run(void);
void UnInit(void);
};
#endif

View File

@ -0,0 +1,46 @@
/**
*******************************************************************************
* @file guiDoubleBuffer.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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.
*
*******************************************************************************
*/
#include <ewolDebug.h>
#include <guiDoubleBuffer.h>
#undef __class__
#define __class__ "guiAbstraction"
void guiAbstraction::Init(int32_t argc, char *argv[])
{
EWOL_INFO("INIT for DoubleBuffer environement");
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Start Running");
EWOL_INFO("Stop Running");
}
void guiAbstraction::UnInit(void)
{
EWOL_INFO("UN-INIT for DoubleBuffer environement");
}

View File

@ -0,0 +1,40 @@
/**
*******************************************************************************
* @file guiDoubleBuffer.h
* @brief Gui abstraction layer (header)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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 __GUI_ABSTRACTION_H__
#define __GUI_ABSTRACTION_H__
#include <etkTypes.h>
namespace guiAbstraction
{
void Init(int32_t argc, char *argv[]);
void Run(void);
void UnInit(void);
};
#endif

View File

@ -0,0 +1,46 @@
/**
*******************************************************************************
* @file guiIPhone.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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.
*
*******************************************************************************
*/
#include <ewolDebug.h>
#include <guiIPhone.h>
#undef __class__
#define __class__ "guiAbstraction"
void guiAbstraction::Init(int32_t argc, char *argv[])
{
EWOL_INFO("INIT for IPhone environement");
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Start Running");
EWOL_INFO("Stop Running");
}
void guiAbstraction::UnInit(void)
{
EWOL_INFO("UN-INIT for IPhone environement");
}

39
Sources/base/guiIPhone.h Normal file
View File

@ -0,0 +1,39 @@
/**
*******************************************************************************
* @file guiIPhone.h
* @brief Gui abstraction layer (header)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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 __GUI_ABSTRACTION_H__
#define __GUI_ABSTRACTION_H__
#include <etkTypes.h>
namespace guiAbstraction
{
void Init(int32_t argc, char *argv[]);
void Run(void);
void UnInit(void);
};
#endif

48
Sources/base/guiX11.cpp Normal file
View File

@ -0,0 +1,48 @@
/**
*******************************************************************************
* @file guiX11.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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.
*
*******************************************************************************
*/
#include <ewolDebug.h>
#include <guiX11.h>
#undef __class__
#define __class__ "guiAbstraction"
void guiAbstraction::Init(int32_t argc, char *argv[])
{
EWOL_INFO("INIT for X11 environement");
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Start Running");
EWOL_INFO("Stop Running");
}
void guiAbstraction::UnInit(void)
{
EWOL_INFO("UN-INIT for X11 environement");
}

40
Sources/base/guiX11.h Normal file
View File

@ -0,0 +1,40 @@
/**
*******************************************************************************
* @file guiX11.h
* @brief Gui abstraction layer (header)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @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 __GUI_ABSTRACTION_H__
#define __GUI_ABSTRACTION_H__
#include <etkTypes.h>
namespace guiAbstraction
{
void Init(int32_t argc, char *argv[]);
void Run(void);
void UnInit(void);
};
#endif

View File

@ -33,6 +33,7 @@
#include <string.h>
#include <assert.h>
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char int8_t;
@ -41,11 +42,13 @@
typedef signed long long int int64_t;
#endif
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned long int uint32_t;
typedef unsigned long long int uint64_t;
#ifndef __uint8_t_defined
# define __uint8_t_defined
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned long int uint32_t;
typedef unsigned long long int uint64_t;
#endif
#define etk_min(elemA, elemB) ((elemA)<(elemB)) ? (elemA) : (elemB)
#define etk_max(elemA, elemB) ((elemA)<(elemB)) ? (elemB) : (elemA)

View File

@ -22,23 +22,21 @@
*******************************************************************************
*/
/*
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/glx.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xrender.h>
*/
#include "ewol.h"
// need to run xcompmgr to have transparency
#if 0
static Atom del_atom;
static Display *Xdisplay;
static GLXFBConfig fbconfig;
@ -243,16 +241,33 @@ static void Draw(void)
/* Swapbuffers */
glXSwapBuffers(Xdisplay, GLXWindowHandle);
}
#endif
#if __PLATFORM__ == X11
#include "guiX11.h"
#elif __PLATFORM__ == DoubleBuffer
#include "guiDoubleBuffer.h"
#elif __PLATFORM__ == Android
#include "guiAndroid.h"
#elif __PLATFORM__ == IPhone
#include "guiIPhone.h"
#else
#error you need to specify a platform ...
#endif
void ewol::Init(int argc, char *argv[])
{
createX11Window();
createTheRenderContext();
guiAbstraction::Init(argc, argv);
//createX11Window();
//createTheRenderContext();
}
void ewol::Run(void)
{
guiAbstraction::Run();
/*
// main cycle
while(1) {
XEvent event;
@ -279,11 +294,12 @@ void ewol::Run(void)
Draw();
usleep( 100000 );
}
*/
}
void ewol::UnInit(void)
{
guiAbstraction::UnInit();
}

View File

@ -26,8 +26,10 @@
#ifndef __EWOL_H__
#define __EWOL_H__
#include <etkTypes.h>
namespace ewol {
void Init(int argc, char *argv[]);
void Init(int32_t argc, char *argv[]);
void Run(void);
void UnInit(void);
};