change the scene management system
This commit is contained in:
parent
5ea6564840
commit
527ff05b2c
1
.gitignore
vendored
1
.gitignore
vendored
@ -60,3 +60,4 @@ ewol_release
|
||||
ehthumbs.db
|
||||
Icon?
|
||||
Thumbs.db
|
||||
Sources/libewol/ewol/os/AndroidAbstraction.cpp
|
||||
|
@ -156,6 +156,20 @@ void ewol::SetTitle(etk::UString title)
|
||||
guiInterface::SetTitle(title);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
* @param destination the widget where the event mitgh be generated now
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
|
||||
{
|
||||
eSystem::InputEventTransfertWidget(source, destination);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Command line arguments
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -76,6 +76,13 @@ namespace ewol {
|
||||
|
||||
// get current time in ms...
|
||||
int64_t GetTime(void);
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
* @param destination the widget where the event mitgh be generated now
|
||||
* @return ---
|
||||
*/
|
||||
void InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination);
|
||||
};
|
||||
|
||||
#else
|
||||
|
@ -51,6 +51,7 @@ ewol::GameElement::GameElement(SceneElement & sceneElement, etk::UString& tmpNam
|
||||
m_canBeCibled = false;
|
||||
m_canHaveImpact = true;
|
||||
m_life = 0;
|
||||
m_enable = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,6 +58,7 @@ namespace ewol {
|
||||
bool m_canBeCibled; //!< This is for automatic finding on an ennemy
|
||||
bool m_canHaveImpact; //!< detection of impact is done with this ...
|
||||
float m_specialParam[NB_SPECIAL_PARAM]; //!< specific game user parameter
|
||||
bool m_enable; //!< Use to add element that can not be detected by the other when user select a place
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor : here are requested all the needed sprite and effect that can be used in the game
|
||||
@ -79,18 +80,20 @@ namespace ewol {
|
||||
|
||||
bool HasName(etk::UString tmpName) { return (tmpName == m_fileNameConfig); };
|
||||
bool IsVisible(void) { return m_visible; };
|
||||
void SetVisible(bool state) { m_visible = state; };
|
||||
void SetVisible(bool state) { m_visible = state; StatusUpdate();};
|
||||
bool IsEnable(void) { return m_enable; };
|
||||
void SetEnable(bool state) { m_enable = state; StatusUpdate();};
|
||||
Vector2D<float> PositionGet(void) { return m_position; };
|
||||
void PositionSet(Vector2D<float> state) { m_position = state; };
|
||||
void PositionSet(float xxx, float yyy) { m_position.x = xxx; m_position.y = yyy; };
|
||||
void PositionSet(Vector2D<float> state) { m_position = state; StatusUpdate();};
|
||||
void PositionSet(float xxx, float yyy) { m_position.x = xxx; m_position.y = yyy; StatusUpdate();};
|
||||
float SpeedGet(void) { return m_speed; };
|
||||
void SpeedSet(float state) { m_speed = state; };
|
||||
void SpeedSet(float state) { m_speed = state; StatusUpdate();};
|
||||
float MassGet(void) { return m_mass; };
|
||||
void MassSet(float state) { m_mass = state; };
|
||||
void MassSet(float state) { m_mass = state; StatusUpdate();};
|
||||
float SizeGet(void) { return m_size; };
|
||||
void SizeSet(float state) { m_size = state; };
|
||||
void SizeSet(float state) { m_size = state; StatusUpdate();};
|
||||
float DisplaySizeGet(void) { return m_sizeDisplay; };
|
||||
void DisplaySizeSet(float state) { m_sizeDisplay = state; };
|
||||
void DisplaySizeSet(float state) { m_sizeDisplay = state; StatusUpdate();};
|
||||
float AngleGet(void) { return m_angle; };
|
||||
void AngleSet(float state)
|
||||
{
|
||||
@ -101,21 +104,22 @@ namespace ewol {
|
||||
while (m_angle < -M_PI) {
|
||||
m_angle += 2.0*M_PI;
|
||||
}
|
||||
StatusUpdate();
|
||||
};
|
||||
float PowerGet(void) { return m_power; };
|
||||
void PowerSet(float state) { m_power = state; };
|
||||
void PowerSet(float state) { m_power = state; StatusUpdate();};
|
||||
bool CanBeCibledGet(void) { return m_canBeCibled; };
|
||||
void CanBeCibledSet(bool state) { m_canBeCibled = state; };
|
||||
void CanBeCibledSet(bool state) { m_canBeCibled = state; StatusUpdate();};
|
||||
bool CanHaveImpactGet(void) { return m_canHaveImpact; };
|
||||
void CanHaveImpactSet(bool state) { m_canHaveImpact = state; };
|
||||
void CanHaveImpactSet(bool state) { m_canHaveImpact = state; StatusUpdate();};
|
||||
|
||||
int32_t GetType(void) { return m_type; }; // TODO : DEPRECATED ...
|
||||
int32_t TypeGet(void) { return m_type; };
|
||||
uint16_t GroupGet(void) { return m_group; };
|
||||
void GroupSet(uint16_t state) { m_group = state; };
|
||||
void GroupSet(uint16_t state) { m_group = state; StatusUpdate();};
|
||||
|
||||
float SpecialParamGet(int32_t id) { if (id<0 || id>=NB_SPECIAL_PARAM) {return 0.0;} return m_specialParam[id]; };
|
||||
void SpecialParamSet(int32_t id, float state) { if (id<0 || id>=NB_SPECIAL_PARAM) {return;} m_specialParam[id]=state; };
|
||||
void SpecialParamSet(int32_t id, float state) { if (id<0 || id>=NB_SPECIAL_PARAM) {return;} m_specialParam[id]=state; StatusUpdate();};
|
||||
|
||||
/**
|
||||
* @brief Periodicly this fuction will be call tu change property of all the dynamic obbjects
|
||||
@ -145,6 +149,7 @@ namespace ewol {
|
||||
virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power) { return false; } ;
|
||||
|
||||
virtual void Message(etk::UString control, etk::UString message) { } ;
|
||||
virtual void StatusUpdate(void) { };
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -213,7 +213,7 @@ ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement)
|
||||
}
|
||||
|
||||
|
||||
uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t groupId)
|
||||
uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
float lastQuadDistance = 9999999999999999.0;
|
||||
@ -222,6 +222,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t g
|
||||
EWOL_ERROR("incorect group number : " << groupId);
|
||||
return 0;
|
||||
}
|
||||
maxRange = maxRange*maxRange;
|
||||
while (groupEnemy[groupId][jjj] != -1) {
|
||||
int32_t gId = groupEnemy[groupId][jjj];
|
||||
if (gId == groupId) {
|
||||
@ -229,10 +230,15 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t g
|
||||
}
|
||||
for (int32_t iii=0; iii<listAnimatedElements[gId].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[gId][iii]) {
|
||||
if (true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
if( true == listAnimatedElements[gId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if (distance <= lastQuadDistance) {
|
||||
if( distance <= lastQuadDistance
|
||||
&& ( ( maxRange>0
|
||||
&& maxRange >= lastQuadDistance)
|
||||
|| maxRange==0)
|
||||
) {
|
||||
lastQuadDistance = distance;
|
||||
result = createUniqueId(listAnimatedElements[gId][iii]->GetUniqueId(), iii);
|
||||
}
|
||||
@ -244,6 +250,89 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t g
|
||||
return result;
|
||||
}
|
||||
|
||||
void ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list)
|
||||
{
|
||||
// remove all elements..
|
||||
list.Clear();
|
||||
int32_t jjj=0;
|
||||
if (groupId <0 || groupId >= MAX_GROUP_NUMBER) {
|
||||
EWOL_ERROR("incorect group number : " << groupId);
|
||||
return;
|
||||
}
|
||||
maxRange = maxRange*maxRange;
|
||||
while (groupEnemy[groupId][jjj] != -1) {
|
||||
int32_t gId = groupEnemy[groupId][jjj];
|
||||
if (gId == groupId) {
|
||||
EWOL_ERROR("groupId=" << gId << " is ennemy of groupId:" << groupId);
|
||||
}
|
||||
for (int32_t iii=0; iii<listAnimatedElements[gId].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[gId][iii]) {
|
||||
if( true == listAnimatedElements[gId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if(maxRange >= distance) {
|
||||
uint32_t tmpp = createUniqueId(listAnimatedElements[gId][iii]->GetUniqueId(), iii);
|
||||
list.PushBack(tmpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
jjj++;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t groupId, uint32_t us)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
float lastQuadDistance = 9999999999999999.0;
|
||||
if (groupId <0 || groupId >= MAX_GROUP_NUMBER) {
|
||||
EWOL_ERROR("incorect group number : " << groupId);
|
||||
return 0;
|
||||
}
|
||||
int32_t gId = groupId;
|
||||
for (int32_t iii=0; iii<listAnimatedElements[gId].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[gId][iii]) {
|
||||
if( true == listAnimatedElements[gId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if( distance <= lastQuadDistance
|
||||
&& us != listAnimatedElements[gId][iii]->GetUniqueId() ) {
|
||||
lastQuadDistance = distance;
|
||||
result = createUniqueId(listAnimatedElements[gId][iii]->GetUniqueId(), iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list, uint32_t us)
|
||||
{
|
||||
// remove all elements..
|
||||
list.Clear();
|
||||
if (groupId <0 || groupId >= MAX_GROUP_NUMBER) {
|
||||
EWOL_ERROR("incorect group number : " << groupId);
|
||||
return;
|
||||
}
|
||||
maxRange = maxRange*maxRange;
|
||||
for (int32_t iii=0; iii<listAnimatedElements[groupId].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[groupId][iii]) {
|
||||
if( true == listAnimatedElements[groupId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[groupId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[groupId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if( maxRange >= distance
|
||||
&& us != listAnimatedElements[groupId][iii]->GetUniqueId() ) {
|
||||
uint32_t tmpp = createUniqueId(listAnimatedElements[groupId][iii]->GetUniqueId(), iii);
|
||||
list.PushBack(tmpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
|
||||
{
|
||||
@ -251,7 +340,8 @@ bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float>
|
||||
if (group != jjj) {
|
||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||
if (true == listAnimatedElements[jjj][iii]->HaveImpact(group, type, position, size )) {
|
||||
if( true == listAnimatedElements[jjj][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[jjj][iii]->HaveImpact(group, type, position, size )) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -266,7 +356,8 @@ void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D<float>
|
||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||
if (true == listAnimatedElements[jjj][iii]->Explosion(group, type, position, pxAtenuation, power) ) {
|
||||
if( true == listAnimatedElements[jjj][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[jjj][iii]->Explosion(group, type, position, pxAtenuation, power) ) {
|
||||
RmElement(jjj, iii);
|
||||
}
|
||||
}
|
||||
@ -282,11 +373,13 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D<float> position, int32_t m
|
||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if (distance <= lastQuadDistance) {
|
||||
lastQuadDistance = distance;
|
||||
result = createUniqueId(listAnimatedElements[jjj][iii]->GetUniqueId(), iii);
|
||||
if( true == listAnimatedElements[jjj][iii]->IsEnable()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if (distance <= lastQuadDistance) {
|
||||
lastQuadDistance = distance;
|
||||
result = createUniqueId(listAnimatedElements[jjj][iii]->GetUniqueId(), iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,10 @@ namespace ewol {
|
||||
uint32_t AddElement(int32_t group, ewol::GameElement* newElement);
|
||||
uint32_t AddElementNamed(int32_t group, etk::UString &elementName);
|
||||
ewol::GameElement* GetElement(uint32_t idElement);
|
||||
uint32_t GetNearestEnemy(Vector2D<float> position, int32_t groupId);
|
||||
uint32_t GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange=0);
|
||||
void GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list);
|
||||
uint32_t GetNearestFriend(Vector2D<float> position, int32_t groupId, uint32_t us);
|
||||
void GetNearestFriend(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list, uint32_t us);
|
||||
bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
|
||||
void Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
|
||||
uint32_t GetElementAtPos(Vector2D<float> position, int32_t maxDistanceDetection);
|
||||
|
@ -44,6 +44,20 @@ static ewol::Windows* windowsCurrent = NULL;
|
||||
static Vector2D<int32_t> windowsSize(320, 480);
|
||||
static ewol::eSystemInput l_managementInput;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
* @param destination the widget where the event mitgh be generated now
|
||||
* @return ---
|
||||
*/
|
||||
void eSystem::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
|
||||
{
|
||||
l_managementInput.TransfertEvent(source, destination);
|
||||
}
|
||||
|
||||
|
||||
enum {
|
||||
THREAD_INIT,
|
||||
THREAD_RECALCULATE_SIZE,
|
||||
|
@ -135,6 +135,13 @@ namespace eSystem
|
||||
*/
|
||||
void ForceRedrawAll(void);
|
||||
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
* @param destination the widget where the event mitgh be generated now
|
||||
* @return ---
|
||||
*/
|
||||
void InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination);
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,9 +75,70 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp
|
||||
eventTable[idInput].isDown = false;
|
||||
eventTable[idInput].isInside = false;
|
||||
eventTable[idInput].nbClickEvent = 0;
|
||||
eventTable[idInput].posEvent.x = 0;
|
||||
eventTable[idInput].posEvent.y = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief generate the event on the destinated widger
|
||||
* @param[in] type Type of the event that might be sended
|
||||
* @param[in] destWidget Pointer on the requested widget that element might be sended
|
||||
* @param[in] IdInput Id of the event (PC : [0..9] and touch : [1..9])
|
||||
* @param[in] typeEvent type of the eventg generated
|
||||
* @param[in] pos position of the event
|
||||
* @return true if event has been greped
|
||||
*/
|
||||
bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
{
|
||||
if (NULL != destWidget) {
|
||||
if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) {
|
||||
return destWidget->OnEventInput(type, IdInput, typeEvent, pos);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
* @param destination the widget where the event mitgh be generated now
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::eSystemInput::TransfertEvent(ewol::Widget* source, ewol::Widget* destination)
|
||||
{
|
||||
if( NULL == source
|
||||
|| NULL == destination) {
|
||||
// prevent errors ...
|
||||
return;
|
||||
}
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
if (m_eventInputSaved[iii].curentWidgetEvent == source) {
|
||||
// inform the widget that it does not receive the event now
|
||||
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent);
|
||||
localEventInput(ewol::INPUT_TYPE_FINGER, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_ABORT, m_eventInputSaved[iii].posEvent);
|
||||
// set the new widget ...
|
||||
m_eventInputSaved[iii].curentWidgetEvent = destination;
|
||||
// inform the widget that he receive the event property now...
|
||||
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent);
|
||||
localEventInput(ewol::INPUT_TYPE_FINGER, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_TRANSFERT, m_eventInputSaved[iii].posEvent);
|
||||
}
|
||||
if (m_eventMouseSaved[iii].curentWidgetEvent == source) {
|
||||
// inform the widget that it does not receive the event now
|
||||
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent);
|
||||
localEventInput(ewol::INPUT_TYPE_MOUSE, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_ABORT, m_eventMouseSaved[iii].posEvent);
|
||||
// set the new widget ...
|
||||
m_eventMouseSaved[iii].curentWidgetEvent = destination;
|
||||
// inform the widget that he receive the event property now...
|
||||
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent);
|
||||
localEventInput(ewol::INPUT_TYPE_MOUSE, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_TRANSFERT, m_eventMouseSaved[iii].posEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject
|
||||
@ -134,28 +195,6 @@ ewol::eSystemInput::~eSystemInput(void)
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief generate the event on the destinated widger
|
||||
* @param[in] type Type of the event that might be sended
|
||||
* @param[in] destWidget Pointer on the requested widget that element might be sended
|
||||
* @param[in] IdInput Id of the event (PC : [0..9] and touch : [1..9])
|
||||
* @param[in] typeEvent type of the eventg generated
|
||||
* @param[in] pos position of the event
|
||||
* @return true if event has been greped
|
||||
*/
|
||||
bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
{
|
||||
if (NULL != destWidget) {
|
||||
if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) {
|
||||
return destWidget->OnEventInput(type, IdInput, typeEvent, pos);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the system event id in the correct EWOL id depending of the system management mode
|
||||
* This function find the next input id unused on the specifiic widget ==> on PC, the ID does not change (IHM is not the same
|
||||
@ -218,6 +257,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D
|
||||
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) ) ) {
|
||||
eventTable[pointerID].isInside = false;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
|
||||
}
|
||||
if (false == eventTable[pointerID].isInside) {
|
||||
@ -238,9 +278,11 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D
|
||||
}
|
||||
eventTable[pointerID].destinationInputId = 0;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
|
||||
}
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos);
|
||||
} else if (true == eventTable[pointerID].isUsed) {
|
||||
if (true == eventTable[pointerID].isInside) {
|
||||
@ -250,6 +292,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D
|
||||
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) {
|
||||
eventTable[pointerID].isInside = false;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
|
||||
}
|
||||
} else {
|
||||
@ -259,10 +302,12 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D
|
||||
&& (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) >= pos.y ) ) {
|
||||
eventTable[pointerID].isInside = true;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
|
||||
}
|
||||
}
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos);
|
||||
}
|
||||
}
|
||||
@ -308,6 +353,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
eventTable[pointerID].lastTimeEvent = currentTime;
|
||||
// generate DOWN Event
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
|
||||
} else {
|
||||
// Mark it used :
|
||||
@ -333,6 +379,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
}
|
||||
// generate DOWN Event
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
|
||||
}
|
||||
} else {
|
||||
@ -347,6 +394,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
} else {
|
||||
// generate UP Event
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos);
|
||||
// generate event (single)
|
||||
if( abs(eventTable[pointerID].downStart.x - pos.x) < localLimit.DpiOffset
|
||||
@ -366,6 +414,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
// generate event SINGLE :
|
||||
eventTable[pointerID].nbClickEvent++;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [" << eventTable[pointerID].nbClickEvent << "] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type,
|
||||
eventTable[pointerID].curentWidgetEvent,
|
||||
eventTable[pointerID].destinationInputId,
|
||||
|
@ -41,6 +41,7 @@ namespace ewol
|
||||
Vector2D<float> origin;
|
||||
Vector2D<float> size;
|
||||
Vector2D<float> downStart;
|
||||
Vector2D<float> posEvent;
|
||||
bool isDown;
|
||||
bool isInside;
|
||||
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
|
||||
@ -87,7 +88,15 @@ namespace ewol
|
||||
* @return ---
|
||||
*/
|
||||
void NewLayerSet(void);
|
||||
/**
|
||||
* @brief This is to transfert the event from one widget to another one
|
||||
* @param source the widget where the event came from
|
||||
* @param destination the widget where the event mitgh be generated now
|
||||
* @return ---
|
||||
*/
|
||||
void TransfertEvent(ewol::Widget* source, ewol::Widget* destination);
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -186,6 +186,7 @@ void ewol::List::OnRegenerateDisplay(void)
|
||||
Vector2D<float> textPos;
|
||||
textPos.x = tmpOriginX;
|
||||
textPos.y = displayPositionY;
|
||||
tmpText->SetColor(fg);
|
||||
tmpText->Text(textPos/*, drawClipping*/, myTextToWrite);
|
||||
AddOObject(tmpText);
|
||||
// madding move ...
|
||||
|
@ -127,9 +127,11 @@ void ewol::Scene::PeriodicCall(int64_t localTime)
|
||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) {
|
||||
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
||||
// check if the element request an auto Kill ...
|
||||
if (true == m_sceneElement.listAnimatedElements[jjj][iii]->Process(m_lastCallTime, CYCLIC_CALL_PERIODE_US) ) {
|
||||
m_sceneElement.RmElement(jjj, iii);
|
||||
if(true == m_sceneElement.listAnimatedElements[jjj][iii]->IsEnable() ) {
|
||||
// check if the element request an auto Kill ...
|
||||
if (true == m_sceneElement.listAnimatedElements[jjj][iii]->Process(m_lastCallTime, CYCLIC_CALL_PERIODE_US) ) {
|
||||
m_sceneElement.RmElement(jjj, iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ namespace ewol {
|
||||
EVENT_INPUT_TYPE_UP,
|
||||
EVENT_INPUT_TYPE_ENTER,
|
||||
EVENT_INPUT_TYPE_LEAVE,
|
||||
EVENT_INPUT_TYPE_ABORT, // SPecial event generate when an upper classes get an event ... (TBD)
|
||||
EVENT_INPUT_TYPE_ABORT, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
|
||||
EVENT_INPUT_TYPE_TRANSFERT, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
|
||||
} eventInputType_te;
|
||||
|
||||
typedef enum {
|
||||
|
Loading…
Reference in New Issue
Block a user