[DEV] continue converging

This commit is contained in:
Edouard DUPIN 2015-08-11 21:10:16 +02:00
parent 9dea7c306e
commit 291da66c15
5 changed files with 36 additions and 58 deletions

View File

@ -85,7 +85,7 @@ void gale::Application::keyboardHide() {
} }
void gale::Application::onResize(const vec2& _size) { void gale::Application::onResize(const ivec2& _size) {
} }

View File

@ -110,7 +110,7 @@ namespace gale {
* @brief Event generated when user change the size of the window. * @brief Event generated when user change the size of the window.
* @param[in] _size New size of the window. * @param[in] _size New size of the window.
*/ */
virtual void onResize(const vec2& _size); virtual void onResize(const ivec2& _size);
/** /**
* @brief Set the size of the window (if possible: Android and Ios does not support it) * @brief Set the size of the window (if possible: Android and Ios does not support it)
* @param[in] _size New size of the window. * @param[in] _size New size of the window.

View File

@ -176,65 +176,43 @@ void gale::Context::processEvents() {
break; break;
case eSystemMessage::msgInputMotion: case eSystemMessage::msgInputMotion:
//GALE_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); //GALE_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
// TODO : m_input.motion(data->inputType, data->inputId, data->dimention); if (m_application == nullptr) {
return;
}
m_application->onPointer(data->inputType,
data->inputId,
data->dimention,
gale::key::status_move);
break; break;
case eSystemMessage::msgInputState: case eSystemMessage::msgInputState:
//GALE_DEBUG("Receive MSG : THREAD_INPUT_STATE"); //GALE_DEBUG("Receive MSG : THREAD_INPUT_STATE");
// TODO : m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention); if (m_application == nullptr) {
return;
}
m_application->onPointer(data->inputType,
data->inputId,
data->dimention,
(data->stateIsDown==true?gale::key::status_down:gale::key::status_up));
break; break;
case eSystemMessage::msgKeyboardKey: case eSystemMessage::msgKeyboardKey:
case eSystemMessage::msgKeyboardMove: case eSystemMessage::msgKeyboardMove:
//GALE_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); //GALE_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
// store the keyboard special key status for mouse event... if (m_application == nullptr) {
// TODO : m_input.setLastKeyboardSpecial(data->keyboardSpecial); return;
#if 0 } else {
if (nullptr != m_windowsCurrent) { gale::key::status state = data->stateIsDown==true?gale::key::status_down:gale::key::status_up;
if (false == m_windowsCurrent->onEventShortCut(data->keyboardSpecial, if (data->repeateKey == true) {
data->keyboardChar, if (state == gale::key::status_down) {
data->keyboardMove, state = gale::key::status_downRepeate;
data->stateIsDown) ) { } else {
// get the current focused Widget : state = gale::key::status_upRepeate;
std::shared_ptr<gale::Widget> tmpWidget = m_widgetManager.focusGet();
if (nullptr != tmpWidget) {
// check if the widget allow repeating key events.
//GALE_DEBUG("repeating test :" << data->repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data->stateIsDown);
if( false == data->repeateKey
|| ( true == data->repeateKey
&& true == tmpWidget->getKeyboardRepeate()) ) {
// check Widget shortcut
if (false == tmpWidget->onEventShortCut(data->keyboardSpecial,
data->keyboardChar,
data->keyboardMove,
data->stateIsDown) ) {
// generate the direct event ...
if (data->TypeMessage == eSystemMessage::msgKeyboardKey) {
gale::event::EntrySystem tmpEntryEvent(gale::key::keyboardChar,
gale::key::statusUp,
data->keyboardSpecial,
data->keyboardChar);
if(true == data->stateIsDown) {
tmpEntryEvent.m_event.setStatus(gale::key::statusDown);
}
tmpWidget->systemEventEntry(tmpEntryEvent);
} else { // THREAD_KEYBORAD_MOVE
GALE_DEBUG("THREAD_KEYBORAD_MOVE" << data->keyboardMove << " " << data->stateIsDown);
gale::event::EntrySystem tmpEntryEvent(data->keyboardMove,
gale::key::statusUp,
data->keyboardSpecial,
0);
if(true == data->stateIsDown) {
tmpEntryEvent.m_event.setStatus(gale::key::statusDown);
}
tmpWidget->systemEventEntry(tmpEntryEvent);
}
} else {
GALE_DEBUG("remove Repeate key ...");
}
}
} }
} }
m_application->onKeyboard(data->keyboardSpecial,
data->keyboardMove,
data->keyboardChar,
state);
} }
#endif
break; break;
case eSystemMessage::msgClipboardArrive: case eSystemMessage::msgClipboardArrive:
{ {
@ -304,7 +282,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
m_windowsSize(320,480), m_windowsSize(320,480),
m_initStepId(0) { m_initStepId(0) {
// set a basic // set a basic
etk::thread::setName("gale"); etk::thread::setName("galeThread");
if (m_application == nullptr) { if (m_application == nullptr) {
GALE_CRITICAL("Can not start context with no Application ==> rtfm ..."); GALE_CRITICAL("Can not start context with no Application ==> rtfm ...");
} }
@ -673,12 +651,10 @@ void gale::Context::OS_OpenGlContextDestroy() {
} }
void gale::Context::forceRedrawAll() { void gale::Context::forceRedrawAll() {
#if 0 if (m_application == nullptr) {
if (m_windowsCurrent == nullptr) {
return; return;
} }
m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y())); m_application->onResize(m_windowsSize);
#endif
} }
void gale::Context::OS_Stop() { void gale::Context::OS_Stop() {

View File

@ -134,13 +134,13 @@ namespace gale {
*/ */
virtual void stop(); virtual void stop();
private: private:
vec2 m_windowsSize; //!< current size of the system ivec2 m_windowsSize; //!< current size of the system
public: public:
/** /**
* @brief get the current windows size * @brief get the current windows size
* @return the current size ... * @return the current size ...
*/ */
const vec2& getSize() { const ivec2& getSize() {
return m_windowsSize; return m_windowsSize;
}; };
/** /**

View File

@ -112,7 +112,9 @@ void gale::resource::Texture::setTexture(const std::shared_ptr<std::vector<char>
enum gale::resource::Texture::color _dataColorSpace) { enum gale::resource::Texture::color _dataColorSpace) {
m_data = _data; m_data = _data;
m_size = _size; m_size = _size;
m_endPointSize = _size;
m_dataType = _dataType; m_dataType = _dataType;
m_dataColorSpace = _dataColorSpace; m_dataColorSpace = _dataColorSpace;
// TODO : Reload ... // TODO : Reload ...
flush();
} }