[DEV] continue integration
This commit is contained in:
parent
7c605538ca
commit
ca11f9e116
@ -0,0 +1,131 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <gale/Application.h>
|
||||
#include <gale/context/Context.h>
|
||||
|
||||
|
||||
gale::Application::Application() {
|
||||
GALE_INFO("Constructor Gale Application");
|
||||
}
|
||||
|
||||
gale::Application::~Application() {
|
||||
GALE_INFO("destructor of Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onCreate(gale::Context& _context) {
|
||||
GALE_INFO("Create Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onStart(gale::Context& _context) {
|
||||
GALE_INFO("Start Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onResume(gale::Context& _context) {
|
||||
GALE_INFO("Resume Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onRun(gale::Context& _context) {
|
||||
GALE_INFO("Run Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onPause(gale::Context& _context) {
|
||||
GALE_INFO("Pause Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onStop(gale::Context& _context) {
|
||||
GALE_INFO("Stop Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::onDestroy(gale::Context& _context) {
|
||||
GALE_INFO("Destroy Gale Application");
|
||||
}
|
||||
|
||||
void gale::Application::exit(int32_t _value) {
|
||||
GALE_INFO("Exit Requested");
|
||||
}
|
||||
|
||||
void gale::Application::onPointer(enum gale::key::type _type, int32_t _pointerID, const vec2& _pos, gale::key::status _state) {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::onKeyboard(gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
char32_t _value,
|
||||
gale::key::status _state) {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::keyboardShow() {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::keyboardHide() {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::onResize(const vec2& _size) {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::setSize(const vec2& _size) {
|
||||
|
||||
}
|
||||
|
||||
vec2 gale::Application::getSize() const {
|
||||
return vec2(0,0);
|
||||
}
|
||||
|
||||
void gale::Application::onMovePosition(const vec2& _size) {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::setPosition(const vec2& _size) {
|
||||
|
||||
}
|
||||
|
||||
vec2 gale::Application::getPosition() const {
|
||||
return vec2(0,0);
|
||||
}
|
||||
|
||||
void gale::Application::setTitle(const std::string& _title) {
|
||||
|
||||
}
|
||||
|
||||
std::string gale::Application::getTitle() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void gale::Application::setIcon(const std::string& _iconFile) {
|
||||
|
||||
}
|
||||
|
||||
std::string gale::Application::getIcon() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void gale::Application::setCursor(enum gale::context::cursor _newCursor) {
|
||||
|
||||
}
|
||||
|
||||
enum gale::context::cursor gale::Application::getCursor() {
|
||||
return gale::context::cursor_arrow;
|
||||
}
|
||||
|
||||
void gale::Application::openURL(const std::string& _url) {
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::setOrientation(enum gale::orientation _orientation) {
|
||||
|
||||
}
|
||||
|
||||
enum gale::orientation gale::Application::getOrientation() {
|
||||
return gale::orientation_screenAuto;
|
||||
}
|
@ -9,40 +9,173 @@
|
||||
#ifndef __GALE_CONTEXT_APPLICATION_H__
|
||||
#define __GALE_CONTEXT_APPLICATION_H__
|
||||
|
||||
#include <memory>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <gale/orientation.h>
|
||||
#include <gale/key/status.h>
|
||||
#include <gale/key/type.h>
|
||||
#include <gale/key/Special.h>
|
||||
#include <gale/context/cursor.h>
|
||||
|
||||
namespace gale {
|
||||
class Context;
|
||||
class Application : public std::enable_shared_from_this<gale::Application> {
|
||||
public:
|
||||
Application() {};
|
||||
virtual ~Application() {};
|
||||
Application();
|
||||
virtual ~Application();
|
||||
public:
|
||||
/**
|
||||
* @brief Initialize the Application
|
||||
* @param[in] _context Current gale context
|
||||
* @param[in] _initId Initialzation ID (start at 0 and will increment wile returning true)
|
||||
* @return true if the init is fisnished
|
||||
* @return false need more inits
|
||||
* @brief The application is created.
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual bool init(gale::Context& _context, size_t _initId) = 0;
|
||||
virtual void onCreate(gale::Context& _context);
|
||||
/**
|
||||
* @brief The application is ended ==> call this function before ended
|
||||
* @brief The application is started.
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual void unInit(gale::Context& _context) = 0;
|
||||
virtual void onStart(gale::Context& _context);
|
||||
/**
|
||||
* @brief The application is resumed (now visible).
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual void onResume(gale::Context& _context);
|
||||
/**
|
||||
* @brief Call periodicly the application to draw all it is needed to draw ... (access on the openGL Context).
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual void onRun(gale::Context& _context);
|
||||
/**
|
||||
* @brief The application is Hide / not visible.
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual void onPause(gale::Context& _context);
|
||||
/**
|
||||
* @brief The application is stopped.
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual void onStop(gale::Context& _context);
|
||||
/**
|
||||
* @brief The application is remoed (call destructor just adter it.).
|
||||
* @param[in] _context Current gale context.
|
||||
*/
|
||||
virtual void onDestroy(gale::Context& _context);
|
||||
/**
|
||||
* @brief Exit the application (not availlable on IOs, ==> the user will not understand the comportement. He will think the application crash)
|
||||
* @param[in] _value value to return on the program
|
||||
*/
|
||||
virtual void exit(int32_t _value);
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input (finger, mouse, stilet)
|
||||
* @param[in] _event Event properties
|
||||
* @brief Get touch/mouse/... event.
|
||||
* @param[in] _type Type of pointer event
|
||||
* @param[in] _pointerID Pointer id of the touch event.
|
||||
* @param[in] _pos Position of the event (can be <0 if out of window).
|
||||
* @param[in] _state Key state (up/down/move)
|
||||
*/
|
||||
virtual void onEventInput(const ewol::event::Input& _event);
|
||||
virtual void onPointer(enum gale::key::type _type, int32_t _pointerID, const vec2& _pos, gale::key::status _state);
|
||||
/**
|
||||
* @brief Entry event.
|
||||
* represent the physical event :
|
||||
* - Keyboard (key event and move event)
|
||||
* - Accelerometer
|
||||
* - Joystick
|
||||
* @param[in] _event Event properties
|
||||
* @brief Get keyborad value input.
|
||||
* @param[in] _special Current special key status (ctrl/alt/shift ...).
|
||||
* @param[in] _type Type of the event.
|
||||
* @param[in] _value Unicode value of the char pushed (viable only if _type==gale::key::keyboard_char).
|
||||
* @param[in] _state State of the key (up/down/upRepeate/downRepeate)
|
||||
*/
|
||||
virtual void onEventEntry(const ewol::event::Entry& _event);
|
||||
virtual void onKeyboard(gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
char32_t _value,
|
||||
gale::key::status _state);
|
||||
/**
|
||||
* @brief Show the virtal keyboard (if possible : only on iOs/Android)
|
||||
*/
|
||||
virtual void keyboardShow();
|
||||
/**
|
||||
* @brief Hide the virtal keyboard (if possible : only on iOs/Android)
|
||||
*/
|
||||
virtual void keyboardHide();
|
||||
public:
|
||||
/**
|
||||
* @brief Event generated when user change the size of the window.
|
||||
* @param[in] _size New size of the window.
|
||||
*/
|
||||
virtual void onResize(const vec2& _size);
|
||||
/**
|
||||
* @brief Set the size of the window (if possible: Android and Ios does not support it)
|
||||
* @param[in] _size New size of the window.
|
||||
* @return
|
||||
*/
|
||||
virtual void setSize(const vec2& _size);
|
||||
/**
|
||||
* @brief Get the size of the window.
|
||||
* @return Current size of the window.
|
||||
*/
|
||||
virtual vec2 getSize() const;
|
||||
public:
|
||||
/**
|
||||
* @brief Event generated when user change the position of the window.
|
||||
* @param[in] _size New position of the window.
|
||||
*/
|
||||
virtual void onMovePosition(const vec2& _size);
|
||||
/**
|
||||
* @brief Set the position of the window (if possible: Android and Ios does not support it)
|
||||
* @param[in] _size New position of the window.
|
||||
*/
|
||||
virtual void setPosition(const vec2& _size);
|
||||
/**
|
||||
* @brief Get the position of the window.
|
||||
* @return Current position of the window.
|
||||
*/
|
||||
virtual vec2 getPosition() const;
|
||||
public:
|
||||
/**
|
||||
* @brief Set the title of the application
|
||||
* @param[in] _title New title to set at the application (if possible: Android and Ios does not support it)
|
||||
*/
|
||||
virtual void setTitle(const std::string& _title);
|
||||
/**
|
||||
* @brief Get the current title of the application
|
||||
* @return Current title
|
||||
*/
|
||||
virtual std::string getTitle();
|
||||
public:
|
||||
/**
|
||||
* @brief set the Icon of the application.
|
||||
* @param[in] _iconFile File name icon (.bmp/.png).
|
||||
*/
|
||||
virtual void setIcon(const std::string& _iconFile);
|
||||
/**
|
||||
* @brief Get the current filename of the application.
|
||||
* @return Filename of the icon.
|
||||
*/
|
||||
virtual std::string getIcon();
|
||||
public:
|
||||
/**
|
||||
* @brief Set the cursor type.
|
||||
* @param[in] _newCursor Selected cursor.
|
||||
*/
|
||||
virtual void setCursor(enum gale::context::cursor _newCursor);
|
||||
/**
|
||||
* @brief Get the cursor type.
|
||||
* @return the current cursor.
|
||||
*/
|
||||
virtual enum gale::context::cursor getCursor();
|
||||
public:
|
||||
/**
|
||||
* @brief Open an URL on an internal brother.
|
||||
* @param[in] _url URL to open.
|
||||
*/
|
||||
virtual void openURL(const std::string& _url);
|
||||
public:
|
||||
/**
|
||||
* @brief set the screen orientation (if possible : only on iOs/Android)
|
||||
* @param[in] _orientation New orientation.
|
||||
*/
|
||||
virtual void setOrientation(enum gale::orientation _orientation);
|
||||
/**
|
||||
* @brief get the screen orientation (if possible : only on iOs/Android)
|
||||
* @return Current orientation.
|
||||
*/
|
||||
virtual enum gale::orientation getOrientation();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class AndroidContext : public gale::Context {
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
AndroidContext(gale::context::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) :
|
||||
AndroidContext(gale::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) :
|
||||
gale::Context(_application),
|
||||
m_javaApplicationType(_typeAPPL),
|
||||
m_JavaVirtualMachinePointer(nullptr),
|
||||
@ -468,7 +468,7 @@ class AndroidContext : public gale::Context {
|
||||
};
|
||||
|
||||
static std::vector<AndroidContext*> s_listInstance;
|
||||
gale::context::Application* s_applicationInit = NULL;
|
||||
gale::Application* s_applicationInit = NULL;
|
||||
|
||||
extern "C" {
|
||||
/* Call to initialize the graphics state */
|
||||
@ -509,7 +509,7 @@ extern "C" {
|
||||
GALE_DEBUG("*******************************************");
|
||||
AndroidContext* tmpContext = nullptr;
|
||||
s_applicationInit = NULL;
|
||||
gale::context::Application* localApplication = NULL;
|
||||
gale::Application* localApplication = NULL;
|
||||
// call the basic init of all application (that call us ...)
|
||||
main(0,NULL);
|
||||
localApplication = s_applicationInit;
|
||||
@ -898,7 +898,7 @@ extern "C" {
|
||||
};
|
||||
|
||||
|
||||
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) {
|
||||
int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
|
||||
s_applicationInit = _application;
|
||||
return 0;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace gale {
|
||||
enum gale::context::clipBoard::clipboardListe clipboardID;
|
||||
// InputId
|
||||
enum gale::key::type inputType;
|
||||
int32_t inputId;
|
||||
int32_t inputId;
|
||||
// generic dimentions
|
||||
vec2 dimention;
|
||||
// keyboard events :
|
||||
@ -116,20 +116,20 @@ namespace gale {
|
||||
eSystemMessage() :
|
||||
TypeMessage(msgNone),
|
||||
clipboardID(gale::context::clipBoard::clipboardStd),
|
||||
inputType(gale::key::typeUnknow),
|
||||
inputType(gale::key::type_unknow),
|
||||
inputId(-1),
|
||||
dimention(0,0),
|
||||
repeateKey(false),
|
||||
stateIsDown(false),
|
||||
keyboardChar(0),
|
||||
keyboardMove(gale::key::keyboardUnknow)
|
||||
keyboardMove(gale::key::keyboard_unknow)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
void gale::Context::inputEventTransfertWidget(std::shared_ptr<gale::Widget> _source,
|
||||
std::shared_ptr<gale::Widget> _destination) {
|
||||
m_input.transfertEvent(_source, _destination);
|
||||
@ -143,6 +143,7 @@ void gale::Context::inputEventGrabPointer(std::shared_ptr<gale::Widget> _widget)
|
||||
void gale::Context::inputEventUnGrabPointer() {
|
||||
m_input.unGrabPointer();
|
||||
}
|
||||
#endif
|
||||
|
||||
void gale::Context::processEvents() {
|
||||
int32_t nbEvent = 0;
|
||||
@ -160,8 +161,9 @@ void gale::Context::processEvents() {
|
||||
case eSystemMessage::msgInit:
|
||||
// this is due to the openGL context
|
||||
/*bool returnVal = */
|
||||
m_application->init(*this, m_initStepId);
|
||||
m_initStepId++;
|
||||
m_application->onCreate(*this);
|
||||
m_application->onStart(*this);
|
||||
m_application->onResume(*this);
|
||||
break;
|
||||
case eSystemMessage::msgRecalculateSize:
|
||||
forceRedrawAll();
|
||||
@ -174,17 +176,18 @@ void gale::Context::processEvents() {
|
||||
break;
|
||||
case eSystemMessage::msgInputMotion:
|
||||
//GALE_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
||||
m_input.motion(data->inputType, data->inputId, data->dimention);
|
||||
// TODO : m_input.motion(data->inputType, data->inputId, data->dimention);
|
||||
break;
|
||||
case eSystemMessage::msgInputState:
|
||||
//GALE_DEBUG("Receive MSG : THREAD_INPUT_STATE");
|
||||
m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention);
|
||||
// TODO : m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention);
|
||||
break;
|
||||
case eSystemMessage::msgKeyboardKey:
|
||||
case eSystemMessage::msgKeyboardMove:
|
||||
//GALE_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
||||
// store the keyboard special key status for mouse event...
|
||||
m_input.setLastKeyboardSpecial(data->keyboardSpecial);
|
||||
// TODO : m_input.setLastKeyboardSpecial(data->keyboardSpecial);
|
||||
#if 0
|
||||
if (nullptr != m_windowsCurrent) {
|
||||
if (false == m_windowsCurrent->onEventShortCut(data->keyboardSpecial,
|
||||
data->keyboardChar,
|
||||
@ -231,14 +234,17 @@ void gale::Context::processEvents() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case eSystemMessage::msgClipboardArrive:
|
||||
#if 0
|
||||
{
|
||||
std::shared_ptr<gale::Widget> tmpWidget = m_widgetManager.focusGet();
|
||||
if (tmpWidget != nullptr) {
|
||||
tmpWidget->onEventClipboard(data->clipboardID);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case eSystemMessage::msgHide:
|
||||
GALE_DEBUG("Receive MSG : msgHide");
|
||||
@ -282,12 +288,12 @@ void gale::Context::setArchiveDir(int _mode, const char* _str) {
|
||||
|
||||
|
||||
|
||||
gale::Context::Context(gale::context::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
//m_application(std::make_shared<gale::context::Application>(_application)),
|
||||
gale::Context::Context(gale::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
//m_application(std::make_shared<gale::Application>(_application)),
|
||||
m_application(_application),
|
||||
m_objectManager(*this),
|
||||
//m_objectManager(*this),
|
||||
m_previousDisplayTime(0),
|
||||
m_input(*this),
|
||||
// TODO : m_input(*this),
|
||||
#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__IOs))
|
||||
m_displayFps(true),
|
||||
#else
|
||||
@ -297,7 +303,6 @@ gale::Context::Context(gale::context::Application* _application, int32_t _argc,
|
||||
m_FpsSystemContext("Context ", false),
|
||||
m_FpsSystem( "Draw ", true),
|
||||
m_FpsFlush( "Flush ", false),
|
||||
m_windowsCurrent(nullptr),
|
||||
m_windowsSize(320,480),
|
||||
m_initStepId(0) {
|
||||
// set a basic
|
||||
@ -353,11 +358,11 @@ gale::Context::Context(gale::context::Application* _application, int32_t _argc,
|
||||
// force a recalculation
|
||||
requestUpdateSize();
|
||||
#if defined(__GALE_ANDROID_ORIENTATION_LANDSCAPE__)
|
||||
forceOrientation(gale::screenLandscape);
|
||||
forceOrientation(gale::orientation_screenLandscape);
|
||||
#elif defined(__GALE_ANDROID_ORIENTATION_PORTRAIT__)
|
||||
forceOrientation(gale::screenPortrait);
|
||||
forceOrientation(gale::orientation_screenPortrait);
|
||||
#else
|
||||
forceOrientation(gale::screenAuto);
|
||||
forceOrientation(gale::orientation_screenAuto);
|
||||
#endif
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
@ -369,25 +374,25 @@ gale::Context::~Context() {
|
||||
// TODO : Clean the message list ...
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
// Remove current windows
|
||||
m_windowsCurrent.reset();
|
||||
// clean all widget and sub widget with their resources:
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
//m_objectManager.cleanInternalRemoved();
|
||||
// call application to uninit
|
||||
m_application->unInit(*this);
|
||||
m_application->onPause(*this);
|
||||
m_application->onStop(*this);
|
||||
m_application->onDestroy(*this);
|
||||
m_application.reset();
|
||||
// clean all messages
|
||||
m_msgSystem.clean();
|
||||
// internal clean elements
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
//m_objectManager.cleanInternalRemoved();
|
||||
m_resourceManager.cleanInternalRemoved();
|
||||
|
||||
GALE_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
|
||||
m_objectManager.displayListObject();
|
||||
//m_objectManager.displayListObject();
|
||||
// Resource is an lower element as objects ...
|
||||
m_resourceManager.unInit();
|
||||
// now All must be removed !!!
|
||||
m_objectManager.unInit();
|
||||
//m_objectManager.unInit();
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
GALE_INFO(" == > Gale system Un-Init (END)");
|
||||
@ -432,7 +437,7 @@ void gale::Context::OS_SetInputMotion(int _pointerID, const vec2& _pos ) {
|
||||
return;
|
||||
}
|
||||
data->TypeMessage = eSystemMessage::msgInputMotion;
|
||||
data->inputType = gale::key::typeFinger;
|
||||
data->inputType = gale::key::type_finger;
|
||||
data->inputId = _pointerID;
|
||||
data->dimention = _pos;
|
||||
m_msgSystem.post(data);
|
||||
@ -445,7 +450,7 @@ void gale::Context::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _
|
||||
return;
|
||||
}
|
||||
data->TypeMessage = eSystemMessage::msgInputState;
|
||||
data->inputType = gale::key::typeFinger;
|
||||
data->inputType = gale::key::type_finger;
|
||||
data->inputId = _pointerID;
|
||||
data->stateIsDown = _isDown;
|
||||
data->dimention = _pos;
|
||||
@ -459,7 +464,7 @@ void gale::Context::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) {
|
||||
return;
|
||||
}
|
||||
data->TypeMessage = eSystemMessage::msgInputMotion;
|
||||
data->inputType = gale::key::typeMouse;
|
||||
data->inputType = gale::key::type_mouse;
|
||||
data->inputId = _pointerID;
|
||||
data->dimention = _pos;
|
||||
m_msgSystem.post(data);
|
||||
@ -472,7 +477,7 @@ void gale::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _
|
||||
return;
|
||||
}
|
||||
data->TypeMessage = eSystemMessage::msgInputState;
|
||||
data->inputType = gale::key::typeMouse;
|
||||
data->inputType = gale::key::type_mouse;
|
||||
data->inputId = _pointerID;
|
||||
data->stateIsDown = _isDown;
|
||||
data->dimention = _pos;
|
||||
@ -480,9 +485,9 @@ void gale::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetKeyboard(gale::key::Special& _special,
|
||||
char32_t _myChar,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey) {
|
||||
char32_t _myChar,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey) {
|
||||
gale::eSystemMessage *data = new gale::eSystemMessage();
|
||||
if (data == nullptr) {
|
||||
GALE_ERROR("allocationerror of message");
|
||||
@ -575,7 +580,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
processEvents();
|
||||
if (m_initStepId < m_application->getNbStepInit()) {
|
||||
{
|
||||
gale::eSystemMessage *data = new gale::eSystemMessage();
|
||||
if (data == nullptr) {
|
||||
GALE_ERROR("allocation error of message");
|
||||
@ -585,18 +590,20 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
}
|
||||
}
|
||||
// call all the widget that neded to do something periodicly
|
||||
m_objectManager.timeCall(currentTime);
|
||||
// TODO : m_objectManager.timeCall(currentTime);
|
||||
// check if the user selected a windows
|
||||
#if 0
|
||||
if (nullptr != m_windowsCurrent) {
|
||||
// Redraw all needed elements
|
||||
m_windowsCurrent->onRegenerateDisplay();
|
||||
}
|
||||
#endif
|
||||
if (m_displayFps == true) {
|
||||
m_FpsSystemEvent.incrementCounter();
|
||||
m_FpsSystemEvent.toc();
|
||||
}
|
||||
//! bool needRedraw = gale::widgetManager::isDrawingNeeded();
|
||||
needRedraw = m_widgetManager.isDrawingNeeded();
|
||||
// TODO : needRedraw = m_widgetManager.isDrawingNeeded();
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
@ -608,6 +615,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
if (m_displayFps == true) {
|
||||
m_FpsSystemContext.tic();
|
||||
}
|
||||
#if 0
|
||||
if (nullptr != m_windowsCurrent) {
|
||||
if( true == needRedraw
|
||||
|| true == _displayEveryTime) {
|
||||
@ -617,10 +625,12 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (m_displayFps == true) {
|
||||
m_FpsSystemContext.toc();
|
||||
m_FpsSystem.tic();
|
||||
}
|
||||
#if 0
|
||||
if (nullptr != m_windowsCurrent) {
|
||||
if( true == needRedraw
|
||||
|| true == _displayEveryTime) {
|
||||
@ -629,6 +639,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
hasDisplayDone = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (m_displayFps == true) {
|
||||
m_FpsSystem.toc();
|
||||
m_FpsFlush.tic();
|
||||
@ -660,7 +671,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
m_resourceManager.updateContext();
|
||||
// release open GL Context
|
||||
gale::openGL::unLock();
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
// TODO : m_objectManager.cleanInternalRemoved();
|
||||
m_resourceManager.cleanInternalRemoved();
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
@ -669,43 +680,31 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
||||
}
|
||||
|
||||
void gale::Context::resetIOEvent() {
|
||||
m_input.newLayerSet();
|
||||
// TODO : m_input.newLayerSet();
|
||||
}
|
||||
|
||||
void gale::Context::OS_OpenGlContextDestroy() {
|
||||
m_resourceManager.contextHasBeenDestroyed();
|
||||
}
|
||||
|
||||
void gale::Context::setWindows(const std::shared_ptr<gale::widget::Windows>& _windows) {
|
||||
// remove current focus :
|
||||
m_widgetManager.focusSetDefault(nullptr);
|
||||
m_widgetManager.focusRelease();
|
||||
// set the new pointer as windows system
|
||||
m_windowsCurrent = _windows;
|
||||
// set the new default focus :
|
||||
m_widgetManager.focusSetDefault(_windows);
|
||||
// request all the widget redrawing
|
||||
forceRedrawAll();
|
||||
}
|
||||
|
||||
std::shared_ptr<gale::widget::Windows> gale::Context::getWindows() {
|
||||
return m_windowsCurrent;
|
||||
};
|
||||
|
||||
void gale::Context::forceRedrawAll() {
|
||||
#if 0
|
||||
if (m_windowsCurrent == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void gale::Context::OS_Stop() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
GALE_INFO("OS_Stop...");
|
||||
#if 0
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->sysOnKill();
|
||||
}
|
||||
#endif
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
@ -715,9 +714,11 @@ void gale::Context::OS_Suspend() {
|
||||
lockContext();
|
||||
GALE_INFO("OS_Suspend...");
|
||||
m_previousDisplayTime = -1;
|
||||
#if 0
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateSuspend();
|
||||
}
|
||||
#endif
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
@ -727,10 +728,12 @@ void gale::Context::OS_Resume() {
|
||||
lockContext();
|
||||
GALE_INFO("OS_Resume...");
|
||||
m_previousDisplayTime = gale::getTime();
|
||||
m_objectManager.timeCallResume(m_previousDisplayTime);
|
||||
// TODO : m_objectManager.timeCallResume(m_previousDisplayTime);
|
||||
#if 0
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateResume();
|
||||
}
|
||||
#endif
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
@ -738,9 +741,11 @@ void gale::Context::OS_Foreground() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
GALE_INFO("OS_Foreground...");
|
||||
#if 0
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateForeground();
|
||||
}
|
||||
#endif
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
@ -749,9 +754,11 @@ void gale::Context::OS_Background() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
GALE_INFO("OS_Background...");
|
||||
#if 0
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateBackground();
|
||||
}
|
||||
#endif
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
@ -790,7 +797,7 @@ void gale::Context::keyboardHide() {
|
||||
GALE_INFO("keyboardHide: NOT implemented ...");
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
bool gale::Context::systemKeyboradEvent(enum gale::key::keyboardSystem _key, bool _down) {
|
||||
if (m_windowsCurrent == nullptr) {
|
||||
return false;
|
||||
@ -799,4 +806,5 @@ bool gale::Context::systemKeyboradEvent(enum gale::key::keyboardSystem _key, boo
|
||||
bool ret = m_windowsCurrent->onEventHardwareInput(_key, _down);
|
||||
unLockContext();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -14,32 +14,24 @@
|
||||
#include <gale/gale.h>
|
||||
#include <gale/key/key.h>
|
||||
#include <gale/resource/Manager.h>
|
||||
#include <gale/context/Application.h>
|
||||
#include <gale/Application.h>
|
||||
#include <gale/context/clipBoard.h>
|
||||
#include <gale/context/commandLine.h>
|
||||
#include <gale/context/InputManager.h>
|
||||
// TODO : #include <gale/context/InputManager.h>
|
||||
#include <gale/context/Fps.h>
|
||||
#include <memory>
|
||||
#include <gale/orientation.h>
|
||||
|
||||
namespace gale {
|
||||
/**
|
||||
* @not-in-doc
|
||||
*/
|
||||
class eSystemMessage;
|
||||
/**
|
||||
* @not-in-doc
|
||||
*/
|
||||
enum orientation{
|
||||
screenAuto = 0,
|
||||
screenLandscape,
|
||||
screenPortrait
|
||||
};
|
||||
|
||||
class Context/* : private gale::object::RemoveEvent */{
|
||||
private:
|
||||
std::shared_ptr<gale::context::Application> m_application; //!< Application handle
|
||||
std::shared_ptr<gale::Application> m_application; //!< Application handle
|
||||
public:
|
||||
std::shared_ptr<gale::context::Application> getApplication() {
|
||||
std::shared_ptr<gale::Application> getApplication() {
|
||||
return m_application;
|
||||
}
|
||||
private:
|
||||
@ -55,7 +47,7 @@ namespace gale {
|
||||
return m_resourceManager;
|
||||
};
|
||||
public:
|
||||
Context(gale::context::Application* _application, int32_t _argc=0, const char* _argv[]=nullptr);
|
||||
Context(gale::Application* _application, int32_t _argc=0, const char* _argv[]=nullptr);
|
||||
virtual ~Context();
|
||||
protected:
|
||||
/**
|
||||
@ -70,7 +62,7 @@ namespace gale {
|
||||
void unLockContext();
|
||||
private:
|
||||
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
||||
gale::context::InputManager m_input;
|
||||
// TODO : gale::context::InputManager m_input;
|
||||
etk::Fifo<gale::eSystemMessage*> m_msgSystem;
|
||||
bool m_displayFps;
|
||||
gale::context::Fps m_FpsSystemEvent;
|
||||
@ -138,19 +130,6 @@ namespace gale {
|
||||
* @brief The application request that the Window will be killed
|
||||
*/
|
||||
virtual void stop();
|
||||
private:
|
||||
std::shared_ptr<gale::widget::Windows> m_windowsCurrent; //!< curent displayed windows
|
||||
public:
|
||||
/**
|
||||
* @brief set the current windows to display :
|
||||
* @param _windows Windows that might be displayed
|
||||
*/
|
||||
void setWindows(const std::shared_ptr<gale::widget::Windows>& _windows);
|
||||
/**
|
||||
* @brief get the current windows that is displayed
|
||||
* @return the current handle on the windows (can be null)
|
||||
*/
|
||||
std::shared_ptr<gale::widget::Windows> getWindows();
|
||||
private:
|
||||
vec2 m_windowsSize; //!< current size of the system
|
||||
public:
|
||||
@ -203,6 +182,7 @@ namespace gale {
|
||||
void forceRedrawAll();
|
||||
|
||||
// TODO : Later ...
|
||||
#if 0
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
@ -218,6 +198,7 @@ namespace gale {
|
||||
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
|
||||
*/
|
||||
void inputEventUnGrabPointer();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief display the virtal keyboard (for touch system only)
|
||||
@ -268,7 +249,7 @@ namespace gale {
|
||||
* @brief set the cursor display type.
|
||||
* @param[in] _newCursor selected new cursor.
|
||||
*/
|
||||
virtual void setCursor(enum gale::context::cursorDisplay _newCursor) { };
|
||||
virtual void setCursor(enum gale::context::cursor _newCursor) { };
|
||||
/**
|
||||
* @brief set the Icon of the program
|
||||
* @param[in] _inputFile new filename icon of the curent program.
|
||||
@ -307,13 +288,16 @@ namespace gale {
|
||||
*/
|
||||
void setInitImage(const std::string& _fileName);
|
||||
protected:
|
||||
#if 0
|
||||
TODO : Rework this ==> but how ...
|
||||
/**
|
||||
* @brief HARDWARE keyboard event from the system
|
||||
* @param[in] _key event type
|
||||
* @param[in] _status Up or down status
|
||||
* @return Keep the event or not
|
||||
*/
|
||||
virtual bool systemKeyboradEvent(enum gale::key::keyboardSystem _key, bool _down);
|
||||
virtual bool systemKeyboradEvent(enum gale::key::keyboard _key, bool _down);
|
||||
#endif
|
||||
};
|
||||
/**
|
||||
* @brief From everyware in the program, we can get the context inteface.
|
||||
|
@ -54,7 +54,7 @@ class MacOSInterface : public gale::Context {
|
||||
private:
|
||||
gale::key::Special m_guiKeyBoardMode;
|
||||
public:
|
||||
MacOSInterface(gale::context::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
MacOSInterface(gale::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
gale::Context(_application, _argc, _argv) {
|
||||
// nothing to do ...
|
||||
}
|
||||
@ -233,13 +233,13 @@ void IOs::foreground() {
|
||||
|
||||
static int l_argc = 0;
|
||||
static const char **l_argv = nullptr;
|
||||
static gale::context::Application* l_application;
|
||||
static gale::Application* l_application;
|
||||
/**
|
||||
* @brief Main of the program
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) {
|
||||
int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
|
||||
l_argc = _argc;
|
||||
l_argv = _argv;
|
||||
l_application = _application;
|
||||
|
@ -48,7 +48,7 @@ class WindowsContext : public gale::Context {
|
||||
bool m_run = true;
|
||||
bool m_clipBoardOwnerStd = false;
|
||||
public:
|
||||
WindowsContext(gale::context::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
WindowsContext(gale::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
gale::Context(_application, _argc, _argv) {
|
||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) {
|
||||
m_inputIsPressed[iii] = false;
|
||||
@ -478,7 +478,7 @@ class WindowsContext : public gale::Context {
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) {
|
||||
int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err) {
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <gale/gale.h>
|
||||
#include <gale/key/key.h>
|
||||
#include <gale/context/commandLine.h>
|
||||
#include <gale/widget/Manager.h>
|
||||
#include <gale/resource/Manager.h>
|
||||
#include <gale/context/Context.h>
|
||||
#include <gale/Dimension.h>
|
||||
@ -97,7 +96,7 @@ extern "C" {
|
||||
} Hints;
|
||||
}
|
||||
|
||||
#include <egami/egami.h>
|
||||
// TODO : #include <egami/egami.h>
|
||||
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
@ -140,10 +139,10 @@ class X11Interface : public gale::Context {
|
||||
Atom XAtomeTargetTarget;
|
||||
Atom XAtomeGALE;
|
||||
Atom XAtomeDeleteWindows;
|
||||
enum gale::context::cursorDisplay m_currentCursor; //!< select the current cursor to display :
|
||||
enum gale::context::cursor m_currentCursor; //!< select the current cursor to display :
|
||||
char32_t m_lastKeyPressed; //!< The last element key presed...
|
||||
public:
|
||||
X11Interface(gale::context::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
X11Interface(gale::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
gale::Context(_application, _argc, _argv),
|
||||
m_display(nullptr),
|
||||
m_originX(0),
|
||||
@ -169,7 +168,7 @@ class X11Interface : public gale::Context {
|
||||
XAtomeTargetTarget(0),
|
||||
XAtomeGALE(0),
|
||||
XAtomeDeleteWindows(0),
|
||||
m_currentCursor(gale::context::cursorArrow),
|
||||
m_currentCursor(gale::context::cursor_arrow),
|
||||
m_lastKeyPressed(0) {
|
||||
X11_INFO("X11:INIT");
|
||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
@ -770,7 +769,7 @@ class X11Interface : public gale::Context {
|
||||
}
|
||||
*/
|
||||
/****************************************************************************************/
|
||||
virtual void setCursor(enum gale::context::cursorDisplay _newCursor) {
|
||||
virtual void setCursor(enum gale::context::cursor _newCursor) {
|
||||
if (_newCursor != m_currentCursor) {
|
||||
X11_DEBUG("X11-API: set New Cursor : " << _newCursor);
|
||||
// undefine previous cursors ...
|
||||
@ -779,7 +778,7 @@ class X11Interface : public gale::Context {
|
||||
m_currentCursor = _newCursor;
|
||||
Cursor myCursor = None;
|
||||
switch (m_currentCursor) {
|
||||
case gale::context::cursorNone:
|
||||
case gale::context::cursor_none:
|
||||
{
|
||||
Pixmap bitmapNoData;
|
||||
XColor black;
|
||||
@ -792,61 +791,61 @@ class X11Interface : public gale::Context {
|
||||
&black, &black, 0, 0);
|
||||
}
|
||||
break;
|
||||
case gale::context::cursorLeftArrow:
|
||||
case gale::context::cursor_leftArrow:
|
||||
myCursor = XCreateFontCursor(m_display, XC_top_left_arrow);
|
||||
break;
|
||||
case gale::context::cursorInfo:
|
||||
case gale::context::cursor_info:
|
||||
myCursor = XCreateFontCursor(m_display, XC_hand1);
|
||||
break;
|
||||
case gale::context::cursorDestroy:
|
||||
case gale::context::cursor_destroy:
|
||||
myCursor = XCreateFontCursor(m_display, XC_pirate);
|
||||
break;
|
||||
case gale::context::cursorHelp:
|
||||
case gale::context::cursor_help:
|
||||
myCursor = XCreateFontCursor(m_display, XC_question_arrow);
|
||||
break;
|
||||
case gale::context::cursorCycle:
|
||||
case gale::context::cursor_cycle:
|
||||
myCursor = XCreateFontCursor(m_display, XC_exchange);
|
||||
break;
|
||||
case gale::context::cursorSpray:
|
||||
case gale::context::cursor_spray:
|
||||
myCursor = XCreateFontCursor(m_display, XC_spraycan);
|
||||
break;
|
||||
case gale::context::cursorWait:
|
||||
case gale::context::cursor_wait:
|
||||
myCursor = XCreateFontCursor(m_display, XC_watch);
|
||||
break;
|
||||
case gale::context::cursorText:
|
||||
case gale::context::cursor_text:
|
||||
myCursor = XCreateFontCursor(m_display, XC_xterm);
|
||||
break;
|
||||
case gale::context::cursorCrossHair:
|
||||
case gale::context::cursor_crossHair:
|
||||
myCursor = XCreateFontCursor(m_display, XC_crosshair);
|
||||
break;
|
||||
case gale::context::cursorSlideUpDown:
|
||||
case gale::context::cursor_slideUpDown:
|
||||
myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow);
|
||||
break;
|
||||
case gale::context::cursorSlideLeftRight:
|
||||
case gale::context::cursor_slideLeftRight:
|
||||
myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow);
|
||||
break;
|
||||
case gale::context::cursorResizeUp:
|
||||
case gale::context::cursor_resizeUp:
|
||||
myCursor = XCreateFontCursor(m_display, XC_top_side);
|
||||
break;
|
||||
case gale::context::cursorResizeDown:
|
||||
case gale::context::cursor_resizeDown:
|
||||
myCursor = XCreateFontCursor(m_display, XC_bottom_side);
|
||||
break;
|
||||
case gale::context::cursorResizeLeft:
|
||||
case gale::context::cursor_resizeLeft:
|
||||
myCursor = XCreateFontCursor(m_display, XC_left_side);
|
||||
break;
|
||||
case gale::context::cursorResizeRight:
|
||||
case gale::context::cursor_resizeRight:
|
||||
myCursor = XCreateFontCursor(m_display, XC_right_side);
|
||||
break;
|
||||
case gale::context::cursorCornerTopLeft:
|
||||
case gale::context::cursor_cornerTopLeft:
|
||||
myCursor = XCreateFontCursor(m_display, XC_top_left_corner);
|
||||
break;
|
||||
case gale::context::cursorCornerTopRight:
|
||||
case gale::context::cursor_cornerTopRight:
|
||||
myCursor = XCreateFontCursor(m_display, XC_top_right_corner);
|
||||
break;
|
||||
case gale::context::cursorCornerButtomLeft:
|
||||
case gale::context::cursor_cornerButtomLeft:
|
||||
myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner);
|
||||
break;
|
||||
case gale::context::cursorCornerButtomRight:
|
||||
case gale::context::cursor_cornerButtomRight:
|
||||
myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner);
|
||||
break;
|
||||
default :
|
||||
@ -1061,6 +1060,8 @@ class X11Interface : public gale::Context {
|
||||
}
|
||||
/****************************************************************************************/
|
||||
void setIcon(const std::string& _inputFile) {
|
||||
// TODO : ...
|
||||
#if 0
|
||||
egami::Image dataImage;
|
||||
// load data
|
||||
if (false == egami::load(dataImage, _inputFile)) {
|
||||
@ -1195,7 +1196,7 @@ class X11Interface : public gale::Context {
|
||||
myImage->data = nullptr;
|
||||
XDestroyImage(myImage);
|
||||
delete[] tmpVal;
|
||||
|
||||
#endif
|
||||
}
|
||||
/****************************************************************************************/
|
||||
static void setVSync(bool _sync) {
|
||||
@ -1322,7 +1323,7 @@ class X11Interface : public gale::Context {
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) {
|
||||
int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
X11Interface* interface = new X11Interface(_application, _argc, _argv);
|
||||
if (interface == nullptr) {
|
||||
|
@ -8,37 +8,32 @@
|
||||
|
||||
#include <gale/context/cursor.h>
|
||||
|
||||
static const char* cursorDescriptionString[gale::context::cursorCount+1] = {
|
||||
"cursorArrow",
|
||||
"cursorLeftArrow",
|
||||
"cursorInfo",
|
||||
"cursorDestroy",
|
||||
"cursorHelp",
|
||||
"cursorCycle",
|
||||
"cursorSpray",
|
||||
"cursorWait",
|
||||
"cursorText",
|
||||
"cursorCrossHair",
|
||||
"cursorSlideUpDown",
|
||||
"cursorSlideLeftRight",
|
||||
"cursorResizeUp",
|
||||
"cursorResizeDown",
|
||||
"cursorResizeLeft",
|
||||
"cursorResizeRight",
|
||||
"cursorCornerTopLeft",
|
||||
"cursorCornerTopRight",
|
||||
"cursorCornerButtomLeft",
|
||||
"cursorCornerButtomRight",
|
||||
"cursorNone",
|
||||
"cursorCount"
|
||||
static const char* cursorDescriptionString[] = {
|
||||
"cursor_arrow",
|
||||
"cursor_leftArrow",
|
||||
"cursor_info",
|
||||
"cursor_destroy",
|
||||
"cursor_help",
|
||||
"cursor_cycle",
|
||||
"cursor_spray",
|
||||
"cursor_wait",
|
||||
"cursor_text",
|
||||
"cursor_crossHair",
|
||||
"cursor_slideUpDown",
|
||||
"cursor_slideLeftRight",
|
||||
"cursor_resizeUp",
|
||||
"cursor_resizeDown",
|
||||
"cursor_resizeLeft",
|
||||
"cursor_resizeRight",
|
||||
"cursor_cornerTopLeft",
|
||||
"cursor_cornerTopRight",
|
||||
"cursor_cornerButtomLeft",
|
||||
"cursor_cornerButtomRight",
|
||||
"cursor_none"
|
||||
};
|
||||
|
||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::cursorDisplay _obj) {
|
||||
if (_obj >= 0 && _obj <gale::context::cursorCount) {
|
||||
_os << cursorDescriptionString[_obj];
|
||||
} else {
|
||||
_os << "[ERROR]";
|
||||
}
|
||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::cursor _obj) {
|
||||
_os << cursorDescriptionString[_obj];
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
@ -13,36 +13,34 @@
|
||||
|
||||
namespace gale {
|
||||
namespace context {
|
||||
enum cursorDisplay {
|
||||
cursorArrow, // this is the normal arrow ...
|
||||
cursorLeftArrow,
|
||||
cursorInfo,
|
||||
cursorDestroy,
|
||||
cursorHelp,
|
||||
cursorCycle,
|
||||
cursorSpray,
|
||||
cursorWait,
|
||||
cursorText,
|
||||
cursorCrossHair,
|
||||
cursorSlideUpDown, //!< change the position (slide) vertical
|
||||
cursorSlideLeftRight, //!< change the position (slide) horizontal
|
||||
cursorResizeUp,
|
||||
cursorResizeDown,
|
||||
cursorResizeLeft,
|
||||
cursorResizeRight,
|
||||
cursorCornerTopLeft,
|
||||
cursorCornerTopRight,
|
||||
cursorCornerButtomLeft,
|
||||
cursorCornerButtomRight,
|
||||
cursorNone,
|
||||
// just for the count:
|
||||
cursorCount
|
||||
enum cursor {
|
||||
cursor_arrow, // this is the normal arrow ...
|
||||
cursor_leftArrow,
|
||||
cursor_info,
|
||||
cursor_destroy,
|
||||
cursor_help,
|
||||
cursor_cycle,
|
||||
cursor_spray,
|
||||
cursor_wait,
|
||||
cursor_text,
|
||||
cursor_crossHair,
|
||||
cursor_slideUpDown, //!< change the position (slide) vertical
|
||||
cursor_slideLeftRight, //!< change the position (slide) horizontal
|
||||
cursor_resizeUp,
|
||||
cursor_resizeDown,
|
||||
cursor_resizeLeft,
|
||||
cursor_resizeRight,
|
||||
cursor_cornerTopLeft,
|
||||
cursor_cornerTopRight,
|
||||
cursor_cornerButtomLeft,
|
||||
cursor_cornerButtomRight,
|
||||
cursor_none
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @brief Debug operator To display the curent element in a Human readable information
|
||||
*/
|
||||
std::ostream& operator <<(std::ostream& _os, const enum gale::context::cursorDisplay _obj);
|
||||
std::ostream& operator <<(std::ostream& _os, const enum gale::context::cursor _obj);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define __GALE_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <gale/context/Application.h>
|
||||
#include <gale/Application.h>
|
||||
|
||||
namespace gale {
|
||||
/**
|
||||
@ -25,7 +25,7 @@ namespace gale {
|
||||
* @param[in] _argv Standard argv
|
||||
* @return normal error int for the application error management
|
||||
*/
|
||||
int32_t run(gale::context::Application* _application, int32_t _argc = 0, const char* _argv[] = NULL);
|
||||
int32_t run(gale::Application* _application, int32_t _argc = 0, const char* _argv[] = NULL);
|
||||
/**
|
||||
* @brief get GALE version
|
||||
* @return The string that describe gale version
|
||||
|
@ -8,73 +8,55 @@
|
||||
|
||||
#include <gale/key/keyboard.h>
|
||||
|
||||
static const char* keyboardDescriptionString[gale::key::keyboardCount+1] = {
|
||||
"keyboardUnknow",
|
||||
"keyboardChar",
|
||||
"keyboardLeft",
|
||||
"keyboardRight",
|
||||
"keyboardUp",
|
||||
"keyboardDown",
|
||||
"keyboardPageUp",
|
||||
"keyboardPageDown",
|
||||
"keyboardStart",
|
||||
"keyboardEnd",
|
||||
"keyboardPrint",
|
||||
"keyboardStopDefil",
|
||||
"keyboardWait",
|
||||
"keyboardInsert",
|
||||
"keyboardF1",
|
||||
"keyboardF2",
|
||||
"keyboardF3",
|
||||
"keyboardF4",
|
||||
"keyboardF5",
|
||||
"keyboardF6",
|
||||
"keyboardF7",
|
||||
"keyboardF8",
|
||||
"keyboardF9",
|
||||
"keyboardF10",
|
||||
"keyboardF11",
|
||||
"keyboardF12",
|
||||
"keyboardCapLock",
|
||||
"keyboardShiftLeft",
|
||||
"keyboardShiftRight",
|
||||
"keyboardCtrlLeft",
|
||||
"keyboardCtrlRight",
|
||||
"keyboardMetaLeft",
|
||||
"keyboardMetaRight",
|
||||
"keyboardAlt",
|
||||
"keyboardAltGr",
|
||||
"keyboardContextMenu",
|
||||
"keyboardNumLock",
|
||||
"keyboardCount"
|
||||
static const char* keyboardDescriptionString[] = {
|
||||
"keyboard_unknow",
|
||||
"keyboard_char",
|
||||
"keyboard_left",
|
||||
"keyboard_right",
|
||||
"keyboard_up",
|
||||
"keyboard_down",
|
||||
"keyboard_pageUp",
|
||||
"keyboard_pageDown",
|
||||
"keyboard_start",
|
||||
"keyboard_end",
|
||||
"keyboard_print",
|
||||
"keyboard_stopDefil",
|
||||
"keyboard_wait",
|
||||
"keyboard_insert",
|
||||
"keyboard_f1",
|
||||
"keyboard_f2",
|
||||
"keyboard_f3",
|
||||
"keyboard_f4",
|
||||
"keyboard_f5",
|
||||
"keyboard_f6",
|
||||
"keyboard_f7",
|
||||
"keyboard_f8",
|
||||
"keyboard_f9",
|
||||
"keyboard_f10",
|
||||
"keyboard_f11",
|
||||
"keyboard_f12",
|
||||
"keyboard_capLock",
|
||||
"keyboard_shiftLeft",
|
||||
"keyboard_shiftRight",
|
||||
"keyboard_ctrlLeft",
|
||||
"keyboard_ctrlRight",
|
||||
"keyboard_metaLeft",
|
||||
"keyboard_metaRight",
|
||||
"keyboard_alt",
|
||||
"keyboard_altGr",
|
||||
"keyboard_contextMenu",
|
||||
"keyboard_numLock",
|
||||
// harware section:
|
||||
"keyboard_volumeUp",
|
||||
"keyboard_volumeDown",
|
||||
"keyboard_menu",
|
||||
"keyboard_camera",
|
||||
"keyboard_home",
|
||||
"keyboard_power",
|
||||
"keyboard_back",
|
||||
};
|
||||
|
||||
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboard _obj) {
|
||||
if (_obj >= 0 && _obj <gale::key::keyboardCount) {
|
||||
_os << keyboardDescriptionString[_obj];
|
||||
} else {
|
||||
_os << "[ERROR]";
|
||||
}
|
||||
_os << keyboardDescriptionString[_obj];
|
||||
return _os;
|
||||
}
|
||||
|
||||
static const char* keyboardSystemDescriptionString[gale::key::keyboardSystemCount+1] = {
|
||||
"keyboardSystemUnknow",
|
||||
"keyboardSystemVolumeUp",
|
||||
"keyboardSystemVolumeDown",
|
||||
"keyboardSystemMenu",
|
||||
"keyboardSystemCamera",
|
||||
"keyboardSystemHome",
|
||||
"keyboardSystemPower",
|
||||
"keyboardSystemBack",
|
||||
"keyboardSystemCount"
|
||||
};
|
||||
|
||||
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboardSystem _obj) {
|
||||
if (_obj >= 0 && _obj <gale::key::keyboardSystemCount) {
|
||||
_os << keyboardSystemDescriptionString[_obj];
|
||||
} else {
|
||||
_os << "[ERROR]";
|
||||
}
|
||||
return _os;
|
||||
}
|
@ -18,62 +18,56 @@ namespace gale {
|
||||
* @warning If you modify Id of these element check the java interface file of constant : GaleConstant.java
|
||||
*/
|
||||
enum keyboard {
|
||||
keyboardUnknow = 0, //!< Unknown keyboard key
|
||||
keyboardChar, //!< Char input is arrived ...
|
||||
keyboardLeft, //!< Left key <--
|
||||
keyboardRight, //!< Right key -->
|
||||
keyboardUp, //!< Up key ^
|
||||
keyboardDown, //!< Down key \/
|
||||
keyboardPageUp, //!< Page Up key
|
||||
keyboardPageDown, //!< page down key
|
||||
keyboardStart, //!< Start key
|
||||
keyboardEnd, //!< End key
|
||||
keyboardPrint, //!< print screen key.
|
||||
keyboardStopDefil, //!< Stop display key.
|
||||
keyboardWait, //!< Wait key.
|
||||
keyboardInsert, //!< insert key.
|
||||
keyboardF1, //!< F1 key.
|
||||
keyboardF2, //!< F2 key.
|
||||
keyboardF3, //!< F3 key.
|
||||
keyboardF4, //!< F4 key.
|
||||
keyboardF5, //!< F5 key.
|
||||
keyboardF6, //!< F6 key.
|
||||
keyboardF7, //!< F7 key.
|
||||
keyboardF8, //!< F8 key.
|
||||
keyboardF9, //!< F9 key.
|
||||
keyboardF10, //!< F10 key.
|
||||
keyboardF11, //!< F11 key.
|
||||
keyboardF12, //!< F12 key.
|
||||
keyboardCapLock, //!< Capital Letter Lock key.
|
||||
keyboardShiftLeft, //!< Shift left key.
|
||||
keyboardShiftRight, //!< Shift right key.
|
||||
keyboardCtrlLeft, //!< Control left key.
|
||||
keyboardCtrlRight, //!< Control right key.
|
||||
keyboardMetaLeft, //!< Meta left key (apple key or windows key).
|
||||
keyboardMetaRight, //!< Meta right key (apple key or windows key).
|
||||
keyboardAlt, //!< Alt key.
|
||||
keyboardAltGr, //!< Alt ground key.
|
||||
keyboardContextMenu, //!< Contextual menu key.
|
||||
keyboardNumLock, //!< Numerical Lock key.
|
||||
keyboardCount //!< number of posible key
|
||||
keyboard_unknow = 0, //!< Unknown keyboard key
|
||||
keyboard_char, //!< Char input is arrived ...
|
||||
keyboard_left, //!< Left key <--
|
||||
keyboard_right, //!< Right key -->
|
||||
keyboard_up, //!< Up key ^
|
||||
keyboard_down, //!< Down key \/
|
||||
keyboard_pageUp, //!< Page Up key
|
||||
keyboard_pageDown, //!< page down key
|
||||
keyboard_start, //!< Start key
|
||||
keyboard_end, //!< End key
|
||||
keyboard_print, //!< print screen key.
|
||||
keyboard_stopDefil, //!< Stop display key.
|
||||
keyboard_wait, //!< Wait key.
|
||||
keyboard_insert, //!< insert key.
|
||||
keyboard_f1, //!< F1 key.
|
||||
keyboard_f2, //!< F2 key.
|
||||
keyboard_f3, //!< F3 key.
|
||||
keyboard_f4, //!< F4 key.
|
||||
keyboard_f5, //!< F5 key.
|
||||
keyboard_f6, //!< F6 key.
|
||||
keyboard_f7, //!< F7 key.
|
||||
keyboard_f8, //!< F8 key.
|
||||
keyboard_f9, //!< F9 key.
|
||||
keyboard_f10, //!< F10 key.
|
||||
keyboard_f11, //!< F11 key.
|
||||
keyboard_f12, //!< F12 key.
|
||||
keyboard_capLock, //!< Capital Letter Lock key.
|
||||
keyboard_shiftLeft, //!< Shift left key.
|
||||
keyboard_shiftRight, //!< Shift right key.
|
||||
keyboard_ctrlLeft, //!< Control left key.
|
||||
keyboard_ctrlRight, //!< Control right key.
|
||||
keyboard_metaLeft, //!< Meta left key (apple key or windows key).
|
||||
keyboard_metaRight, //!< Meta right key (apple key or windows key).
|
||||
keyboard_alt, //!< Alt key.
|
||||
keyboard_altGr, //!< Alt ground key.
|
||||
keyboard_contextMenu, //!< Contextual menu key.
|
||||
keyboard_numLock, //!< Numerical Lock key
|
||||
// harware section:
|
||||
keyboard_volumeUp, //!< Hardware volume UP key
|
||||
keyboard_volumeDown, //!< Hardware volume DOWN key
|
||||
keyboard_menu, //!< Hardware Menu key
|
||||
keyboard_camera, //!< Hardware Camera key
|
||||
keyboard_home, //!< Hardware Home key
|
||||
keyboard_power, //!< Hardware Power key
|
||||
keyboard_back //!< Hardware Back key
|
||||
};
|
||||
/**
|
||||
* @brief Debug operator To display the curent element in a Human redeable information
|
||||
*/
|
||||
std::ostream& operator <<(std::ostream& _os, const enum gale::key::keyboard _obj);
|
||||
|
||||
enum keyboardSystem {
|
||||
keyboardSystemUnknow = 0, //!< Unknown keyboard system key
|
||||
keyboardSystemVolumeUp, //!< Hardware volume UP key
|
||||
keyboardSystemVolumeDown, //!< Hardware volume DOWN key
|
||||
keyboardSystemMenu, //!< Hardware Menu key
|
||||
keyboardSystemCamera, //!< Hardware Camera key
|
||||
keyboardSystemHome, //!< Hardware Home key
|
||||
keyboardSystemPower, //!< Hardware Power key
|
||||
keyboardSystemBack, //!< Hardware Back key
|
||||
keyboardSystemCount //!< number of posible System key
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const enum gale::key::keyboardSystem _obj);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -8,30 +8,27 @@
|
||||
|
||||
#include <gale/key/status.h>
|
||||
|
||||
static const char* statusDescriptionString[gale::key::statusCount+1] = {
|
||||
"statusUnknow",
|
||||
"statusDown",
|
||||
"statusMove",
|
||||
"statusSingle",
|
||||
"statusDouble",
|
||||
"statusTriple",
|
||||
"statusQuad",
|
||||
"statusQuinte",
|
||||
"statusUp",
|
||||
"statusUpAfter",
|
||||
"statusEnter",
|
||||
"statusLeave",
|
||||
"statusAbort",
|
||||
"statusTransfert",
|
||||
"statusCount"
|
||||
static const char* statusDescriptionString[] = {
|
||||
"status_unknow",
|
||||
"status_down",
|
||||
"status_downRepeate",
|
||||
"status_move",
|
||||
"status_single",
|
||||
"status_double",
|
||||
"status_triple",
|
||||
"status_quad",
|
||||
"status_quinte",
|
||||
"status_up",
|
||||
"status_upRepeate",
|
||||
"status_upAfter",
|
||||
"status_enter",
|
||||
"status_leave",
|
||||
"status_abort",
|
||||
"status_transfert"
|
||||
};
|
||||
|
||||
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::status _obj) {
|
||||
if (_obj >= 0 && _obj <gale::key::statusCount) {
|
||||
_os << statusDescriptionString[_obj];
|
||||
} else {
|
||||
_os << "[ERROR]";
|
||||
}
|
||||
_os << statusDescriptionString[_obj];
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
@ -17,21 +17,22 @@ namespace gale {
|
||||
* @brief Keybord event or joyestick event
|
||||
*/
|
||||
enum status {
|
||||
statusUnknow = 0,
|
||||
statusDown, // availlable on Keyboard too
|
||||
statusMove,
|
||||
statusSingle,
|
||||
statusDouble,
|
||||
statusTriple,
|
||||
statusQuad,
|
||||
statusQuinte,
|
||||
statusUp, // availlable on Keyboard too
|
||||
statusUpAfter, // mouse input & finger input this appear after the single event (depending on some case...)
|
||||
statusEnter,
|
||||
statusLeave,
|
||||
statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
|
||||
statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
|
||||
statusCount, // number max of imput possible
|
||||
status_unknow = 0,
|
||||
status_down, // availlable on Keyboard too
|
||||
status_downRepeate, // availlable on Keyboard too: the down event us in repeate cycle
|
||||
status_move,
|
||||
status_single,
|
||||
status_double,
|
||||
status_triple,
|
||||
status_quad,
|
||||
status_quinte,
|
||||
status_up, // availlable on Keyboard too
|
||||
status_upRepeate, // availlable on Keyboard too: the up event us in repeate cycle
|
||||
status_upAfter, // mouse input & finger input this appear after the single event (depending on some case...)
|
||||
status_enter,
|
||||
status_leave,
|
||||
status_abort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
|
||||
status_transfert // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
|
||||
};
|
||||
/**
|
||||
* @brief Debug operator To display the curent element in a Human redeable information
|
||||
|
@ -9,20 +9,15 @@
|
||||
#include <gale/key/type.h>
|
||||
|
||||
|
||||
static const char* typeDescriptionString[gale::key::typeCount+1] = {
|
||||
"typeUnknow",
|
||||
"typeMouse",
|
||||
"typeFinger",
|
||||
"typeStylet",
|
||||
"typeCount"
|
||||
static const char* typeDescriptionString[] = {
|
||||
"type_unknow",
|
||||
"type_mouse",
|
||||
"type_finger",
|
||||
"type_stylet"
|
||||
};
|
||||
|
||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::key::type _obj) {
|
||||
if (_obj >= 0 && _obj < gale::key::typeCount) {
|
||||
_os << typeDescriptionString[_obj];
|
||||
} else {
|
||||
_os << "[ERROR]";
|
||||
}
|
||||
_os << typeDescriptionString[_obj];
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,10 @@ namespace gale {
|
||||
* @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different
|
||||
*/
|
||||
enum type {
|
||||
typeUnknow = 0, //!< Unknow input Type
|
||||
typeMouse, //!< Mouse type
|
||||
typeFinger, //!< Finger type
|
||||
typeStylet, //!< Stylet type
|
||||
typeCount //!< number of types
|
||||
type_unknow = 0, //!< Unknow input Type
|
||||
type_mouse, //!< Mouse type
|
||||
type_finger, //!< Finger type
|
||||
type_stylet, //!< Stylet type
|
||||
};
|
||||
};
|
||||
/**
|
||||
|
22
gale/orientation.cpp
Normal file
22
gale/orientation.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <gale/orientation.h>
|
||||
|
||||
static const char* listValues[] = {
|
||||
"orientation_screenAuto",
|
||||
"orientation_screenLandscape",
|
||||
"orientation_screenPortrait"
|
||||
};
|
||||
|
||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::orientation _obj) {
|
||||
_os << listValues[_obj];
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
22
gale/orientation.h
Normal file
22
gale/orientation.h
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __GALE_ORIENTATION_H__
|
||||
#define __GALE_ORIENTATION_H__
|
||||
|
||||
namespace gale {
|
||||
enum orientation {
|
||||
orientation_screenAuto = 0,
|
||||
orientation_screenLandscape,
|
||||
orientation_screenPortrait
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, enum gale::orientation _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -21,7 +21,9 @@ def create(target):
|
||||
myModule.add_src_file([
|
||||
'gale/gale.cpp',
|
||||
'gale/debug.cpp',
|
||||
'gale/Dimension.cpp'
|
||||
'gale/Dimension.cpp',
|
||||
'gale/orientation.cpp',
|
||||
'gale/Application.cpp',
|
||||
])
|
||||
|
||||
# context :
|
||||
@ -30,7 +32,7 @@ def create(target):
|
||||
'gale/context/commandLine.cpp',
|
||||
'gale/context/Context.cpp',
|
||||
'gale/context/cursor.cpp',
|
||||
'gale/context/InputManager.cpp'
|
||||
#'gale/context/InputManager.cpp'
|
||||
])
|
||||
if target.name=="Linux":
|
||||
myModule.add_src_file('gale/context/X11/Context.cpp')
|
||||
@ -106,6 +108,7 @@ def create(target):
|
||||
])
|
||||
|
||||
if target.name=="Linux":
|
||||
# todo : myModule.add_module_depend(['egami'])
|
||||
myModule.add_export_flag('link', '-lGL')
|
||||
#`pkg-config --cflags directfb` `pkg-config --libs directfb`
|
||||
#ifeq ("$(CONFIG___GALE_LINUX_GUI_MODE_X11__)","y")
|
||||
|
Loading…
x
Reference in New Issue
Block a user