[DEV] update the change on 'enum' to 'enum class'
This commit is contained in:
parent
a51d682cdc
commit
e6f2e6febc
@ -13,8 +13,8 @@ gale::Application::Application() :
|
|||||||
m_needRedraw(true),
|
m_needRedraw(true),
|
||||||
m_title("gale"),
|
m_title("gale"),
|
||||||
m_iconName(""),
|
m_iconName(""),
|
||||||
m_cursor(gale::context::cursor_arrow),
|
m_cursor(gale::context::cursor::arrow),
|
||||||
m_orientation(gale::orientation_screenAuto) {
|
m_orientation(gale::orientation::screenAuto) {
|
||||||
GALE_VERBOSE("Constructor Gale Application");
|
GALE_VERBOSE("Constructor Gale Application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ namespace gale {
|
|||||||
* @brief Get keyborad value input.
|
* @brief Get keyborad value input.
|
||||||
* @param[in] _special Current special key status (ctrl/alt/shift ...).
|
* @param[in] _special Current special key status (ctrl/alt/shift ...).
|
||||||
* @param[in] _type Type of the event.
|
* @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] _value Unicode value of the char pushed (viable only if _type==gale::key::keyboard::character).
|
||||||
* @param[in] _state State of the key (up/down/upRepeate/downRepeate)
|
* @param[in] _state State of the key (up/down/upRepeate/downRepeate)
|
||||||
*/
|
*/
|
||||||
virtual void onKeyboard(const gale::key::Special& _special,
|
virtual void onKeyboard(const gale::key::Special& _special,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
static bool isInit = false;
|
static bool isInit = false;
|
||||||
static vec2 ratio(9999999,888888);
|
static vec2 ratio(9999999,888888);
|
||||||
static vec2 invRatio(1,1);
|
static vec2 invRatio(1,1);
|
||||||
static gale::Dimension windowsSize(vec2(9999999,888888), gale::Dimension::Pixel);
|
static gale::Dimension windowsSize(vec2(9999999,888888), gale::distance::pixel);
|
||||||
|
|
||||||
static const float inchToMillimeter = 1.0f/25.4f;
|
static const float inchToMillimeter = 1.0f/25.4f;
|
||||||
static const float footToMillimeter = 1.0f/304.8f;
|
static const float footToMillimeter = 1.0f/304.8f;
|
||||||
@ -30,10 +30,10 @@ void gale::Dimension::init() {
|
|||||||
if (true == isInit) {
|
if (true == isInit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gale::Dimension conversion(vec2(72,72), gale::Dimension::Inch);
|
gale::Dimension conversion(vec2(72,72), gale::distance::inch);
|
||||||
ratio = conversion.getMillimeter();
|
ratio = conversion.getMillimeter();
|
||||||
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
|
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
|
||||||
windowsSize.set(vec2(200,200), gale::Dimension::Pixel);
|
windowsSize.set(vec2(200,200), gale::distance::pixel);
|
||||||
isInit = true;
|
isInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,10 +41,10 @@ void gale::Dimension::unInit() {
|
|||||||
isInit = false;
|
isInit = false;
|
||||||
ratio.setValue(9999999,888888);
|
ratio.setValue(9999999,888888);
|
||||||
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
|
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
|
||||||
windowsSize.set(vec2(9999999,88888), gale::Dimension::Pixel);
|
windowsSize.set(vec2(9999999,88888), gale::distance::pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gale::Dimension::setPixelRatio(const vec2& _ratio, enum gale::Dimension::distance _type) {
|
void gale::Dimension::setPixelRatio(const vec2& _ratio, enum gale::distance _type) {
|
||||||
gale::Dimension::init();
|
gale::Dimension::init();
|
||||||
GALE_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type);
|
GALE_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type);
|
||||||
gale::Dimension conversion(_ratio, _type);
|
gale::Dimension conversion(_ratio, _type);
|
||||||
@ -59,54 +59,54 @@ void gale::Dimension::setPixelWindowsSize(const vec2& _size) {
|
|||||||
GALE_VERBOSE("Set a new Windows property size " << windowsSize << "px");
|
GALE_VERBOSE("Set a new Windows property size " << windowsSize << "px");
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 gale::Dimension::getWindowsSize(enum gale::Dimension::distance _type) {
|
vec2 gale::Dimension::getWindowsSize(enum gale::distance _type) {
|
||||||
return windowsSize.get(_type);
|
return windowsSize.get(_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
float gale::Dimension::getWindowsDiag(enum gale::Dimension::distance _type) {
|
float gale::Dimension::getWindowsDiag(enum gale::distance _type) {
|
||||||
vec2 size = gale::Dimension::getWindowsSize(_type);
|
vec2 size = gale::Dimension::getWindowsSize(_type);
|
||||||
return size.length();
|
return size.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
gale::Dimension::Dimension() :
|
gale::Dimension::Dimension() :
|
||||||
m_data(0,0),
|
m_data(0,0),
|
||||||
m_type(gale::Dimension::Pixel) {
|
m_type(gale::distance::pixel) {
|
||||||
// notinh to do ...
|
// notinh to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
gale::Dimension::Dimension(const vec2& _size, enum gale::Dimension::distance _type) :
|
gale::Dimension::Dimension(const vec2& _size, enum gale::distance _type) :
|
||||||
m_data(0,0),
|
m_data(0,0),
|
||||||
m_type(gale::Dimension::Pixel) {
|
m_type(gale::distance::pixel) {
|
||||||
set(_size, _type);
|
set(_size, _type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gale::Dimension::set(std::string _config) {
|
void gale::Dimension::set(std::string _config) {
|
||||||
m_data.setValue(0,0);
|
m_data.setValue(0,0);
|
||||||
m_type = gale::Dimension::Pixel;
|
m_type = gale::distance::pixel;
|
||||||
enum distance type = gale::Dimension::Pixel;
|
enum distance type = gale::distance::pixel;
|
||||||
if (etk::end_with(_config, "%", false) == true) {
|
if (etk::end_with(_config, "%", false) == true) {
|
||||||
type = gale::Dimension::Pourcent;
|
type = gale::distance::pourcent;
|
||||||
_config.erase(_config.size()-1, 1);
|
_config.erase(_config.size()-1, 1);
|
||||||
} else if (etk::end_with(_config, "px",false) == true) {
|
} else if (etk::end_with(_config, "px",false) == true) {
|
||||||
type = gale::Dimension::Pixel;
|
type = gale::distance::pixel;
|
||||||
_config.erase(_config.size()-2, 2);
|
_config.erase(_config.size()-2, 2);
|
||||||
} else if (etk::end_with(_config, "ft",false) == true) {
|
} else if (etk::end_with(_config, "ft",false) == true) {
|
||||||
type = gale::Dimension::foot;
|
type = gale::distance::foot;
|
||||||
_config.erase(_config.size()-2, 2);
|
_config.erase(_config.size()-2, 2);
|
||||||
} else if (etk::end_with(_config, "in",false) == true) {
|
} else if (etk::end_with(_config, "in",false) == true) {
|
||||||
type = gale::Dimension::Inch;
|
type = gale::distance::inch;
|
||||||
_config.erase(_config.size()-2, 2);
|
_config.erase(_config.size()-2, 2);
|
||||||
} else if (etk::end_with(_config, "km",false) == true) {
|
} else if (etk::end_with(_config, "km",false) == true) {
|
||||||
type = gale::Dimension::Kilometer;
|
type = gale::distance::kilometer;
|
||||||
_config.erase(_config.size()-2, 2);
|
_config.erase(_config.size()-2, 2);
|
||||||
} else if (etk::end_with(_config, "mm",false) == true) {
|
} else if (etk::end_with(_config, "mm",false) == true) {
|
||||||
type = gale::Dimension::Millimeter;
|
type = gale::distance::millimeter;
|
||||||
_config.erase(_config.size()-2, 2);
|
_config.erase(_config.size()-2, 2);
|
||||||
} else if (etk::end_with(_config, "cm",false) == true) {
|
} else if (etk::end_with(_config, "cm",false) == true) {
|
||||||
type = gale::Dimension::Centimeter;
|
type = gale::distance::centimeter;
|
||||||
_config.erase(_config.size()-2, 2);
|
_config.erase(_config.size()-2, 2);
|
||||||
} else if (etk::end_with(_config, "m",false) == true) {
|
} else if (etk::end_with(_config, "m",false) == true) {
|
||||||
type = gale::Dimension::Meter;
|
type = gale::distance::meter;
|
||||||
_config.erase(_config.size()-1, 1);
|
_config.erase(_config.size()-1, 1);
|
||||||
} else {
|
} else {
|
||||||
GALE_CRITICAL("Can not parse dimention : \"" << _config << "\"");
|
GALE_CRITICAL("Can not parse dimention : \"" << _config << "\"");
|
||||||
@ -126,87 +126,87 @@ gale::Dimension::operator std::string() const {
|
|||||||
str = get(getType());
|
str = get(getType());
|
||||||
|
|
||||||
switch(getType()) {
|
switch(getType()) {
|
||||||
case gale::Dimension::Pourcent:
|
case gale::distance::pourcent:
|
||||||
str += "%";
|
str += "%";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Pixel:
|
case gale::distance::pixel:
|
||||||
str += "px";
|
str += "px";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Meter:
|
case gale::distance::meter:
|
||||||
str += "m";
|
str += "m";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Centimeter:
|
case gale::distance::centimeter:
|
||||||
str += "cm";
|
str += "cm";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Millimeter:
|
case gale::distance::millimeter:
|
||||||
str += "mm";
|
str += "mm";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Kilometer:
|
case gale::distance::kilometer:
|
||||||
str += "km";
|
str += "km";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Inch:
|
case gale::distance::inch:
|
||||||
str += "in";
|
str += "in";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::foot:
|
case gale::distance::foot:
|
||||||
str += "ft";
|
str += "ft";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 gale::Dimension::get(enum gale::Dimension::distance _type) const {
|
vec2 gale::Dimension::get(enum gale::distance _type) const {
|
||||||
switch(_type) {
|
switch(_type) {
|
||||||
case gale::Dimension::Pourcent:
|
case gale::distance::pourcent:
|
||||||
return getPourcent();
|
return getPourcent();
|
||||||
case gale::Dimension::Pixel:
|
case gale::distance::pixel:
|
||||||
return getPixel();
|
return getPixel();
|
||||||
case gale::Dimension::Meter:
|
case gale::distance::meter:
|
||||||
return getMeter();
|
return getMeter();
|
||||||
case gale::Dimension::Centimeter:
|
case gale::distance::centimeter:
|
||||||
return getCentimeter();
|
return getCentimeter();
|
||||||
case gale::Dimension::Millimeter:
|
case gale::distance::millimeter:
|
||||||
return getMillimeter();
|
return getMillimeter();
|
||||||
case gale::Dimension::Kilometer:
|
case gale::distance::kilometer:
|
||||||
return getKilometer();
|
return getKilometer();
|
||||||
case gale::Dimension::Inch:
|
case gale::distance::inch:
|
||||||
return getInch();
|
return getInch();
|
||||||
case gale::Dimension::foot:
|
case gale::distance::foot:
|
||||||
return getFoot();
|
return getFoot();
|
||||||
}
|
}
|
||||||
return vec2(0,0);
|
return vec2(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gale::Dimension::set(const vec2& _size, enum gale::Dimension::distance _type) {
|
void gale::Dimension::set(const vec2& _size, enum gale::distance _type) {
|
||||||
// set min max on input to limit error :
|
// set min max on input to limit error :
|
||||||
vec2 size(std::avg(0.0f,_size.x(),9999999.0f),
|
vec2 size(std::avg(0.0f,_size.x(),9999999.0f),
|
||||||
std::avg(0.0f,_size.y(),9999999.0f));
|
std::avg(0.0f,_size.y(),9999999.0f));
|
||||||
switch(_type) {
|
switch(_type) {
|
||||||
case gale::Dimension::Pourcent: {
|
case gale::distance::pourcent: {
|
||||||
vec2 size2(std::avg(0.0f,_size.x(),100.0f),
|
vec2 size2(std::avg(0.0f,_size.x(),100.0f),
|
||||||
std::avg(0.0f,_size.y(),100.0f));
|
std::avg(0.0f,_size.y(),100.0f));
|
||||||
m_data = vec2(size2.x()*0.01f, size2.y()*0.01f);
|
m_data = vec2(size2.x()*0.01f, size2.y()*0.01f);
|
||||||
//GALE_VERBOSE("Set % : " << size2 << " == > " << m_data);
|
//GALE_VERBOSE("Set % : " << size2 << " == > " << m_data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case gale::Dimension::Pixel:
|
case gale::distance::pixel:
|
||||||
m_data = size;
|
m_data = size;
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Meter:
|
case gale::distance::meter:
|
||||||
m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y());
|
m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y());
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Centimeter:
|
case gale::distance::centimeter:
|
||||||
m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y());
|
m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y());
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Millimeter:
|
case gale::distance::millimeter:
|
||||||
m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y());
|
m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y());
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Kilometer:
|
case gale::distance::kilometer:
|
||||||
m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y());
|
m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y());
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Inch:
|
case gale::distance::inch:
|
||||||
m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y());
|
m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y());
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::foot:
|
case gale::distance::foot:
|
||||||
m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y());
|
m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ void gale::Dimension::set(const vec2& _size, enum gale::Dimension::distance _typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec2 gale::Dimension::getPixel() const {
|
vec2 gale::Dimension::getPixel() const {
|
||||||
if (m_type!=gale::Dimension::Pourcent) {
|
if (m_type!=gale::distance::pourcent) {
|
||||||
return m_data;
|
return m_data;
|
||||||
} else {
|
} else {
|
||||||
vec2 windDim = windowsSize.getPixel();
|
vec2 windDim = windowsSize.getPixel();
|
||||||
@ -225,7 +225,7 @@ vec2 gale::Dimension::getPixel() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec2 gale::Dimension::getPourcent() const {
|
vec2 gale::Dimension::getPourcent() const {
|
||||||
if (m_type!=gale::Dimension::Pourcent) {
|
if (m_type!=gale::distance::pourcent) {
|
||||||
vec2 windDim = windowsSize.getPixel();
|
vec2 windDim = windowsSize.getPixel();
|
||||||
//GALE_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ...
|
//GALE_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ...
|
||||||
//printf(" windows dimention : %f,%f", windDim.x(),windDim.y());
|
//printf(" windows dimention : %f,%f", windDim.x(),windDim.y());
|
||||||
@ -259,30 +259,30 @@ vec2 gale::Dimension::getFoot() const {
|
|||||||
return gale::Dimension::getMillimeter()*millimeterToFoot;
|
return gale::Dimension::getMillimeter()*millimeterToFoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, enum gale::Dimension::distance _obj) {
|
std::ostream& gale::operator <<(std::ostream& _os, enum gale::distance _obj) {
|
||||||
switch(_obj) {
|
switch(_obj) {
|
||||||
case gale::Dimension::Pourcent:
|
case gale::distance::pourcent:
|
||||||
_os << "%";
|
_os << "%";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Pixel:
|
case gale::distance::pixel:
|
||||||
_os << "px";
|
_os << "px";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Meter:
|
case gale::distance::meter:
|
||||||
_os << "m";
|
_os << "m";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Centimeter:
|
case gale::distance::centimeter:
|
||||||
_os << "cm";
|
_os << "cm";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Millimeter:
|
case gale::distance::millimeter:
|
||||||
_os << "mm";
|
_os << "mm";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Kilometer:
|
case gale::distance::kilometer:
|
||||||
_os << "km";
|
_os << "km";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::Inch:
|
case gale::distance::inch:
|
||||||
_os << "in";
|
_os << "in";
|
||||||
break;
|
break;
|
||||||
case gale::Dimension::foot:
|
case gale::distance::foot:
|
||||||
_os << "ft";
|
_os << "ft";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -10,22 +10,22 @@
|
|||||||
#include <etk/math/Vector2D.h>
|
#include <etk/math/Vector2D.h>
|
||||||
|
|
||||||
namespace gale {
|
namespace gale {
|
||||||
|
enum class distance {
|
||||||
|
pourcent=0,
|
||||||
|
pixel,
|
||||||
|
meter,
|
||||||
|
centimeter,
|
||||||
|
millimeter,
|
||||||
|
kilometer,
|
||||||
|
inch,
|
||||||
|
foot,
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief in the dimention class we store the data as the more usefull unit (pixel)
|
* @brief in the dimention class we store the data as the more usefull unit (pixel)
|
||||||
* but one case need to be dynamic the %, then when requested in % the register the % value
|
* but one case need to be dynamic the %, then when requested in % the register the % value
|
||||||
*/
|
*/
|
||||||
class Dimension {
|
class Dimension {
|
||||||
public:
|
public:
|
||||||
enum distance {
|
|
||||||
Pourcent=0,
|
|
||||||
Pixel,
|
|
||||||
Meter,
|
|
||||||
Centimeter,
|
|
||||||
Millimeter,
|
|
||||||
Kilometer,
|
|
||||||
Inch,
|
|
||||||
foot,
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
vec2 m_data;
|
vec2 m_data;
|
||||||
enum distance m_type;
|
enum distance m_type;
|
||||||
@ -39,14 +39,14 @@ namespace gale {
|
|||||||
* @param[in] _size Requested dimention
|
* @param[in] _size Requested dimention
|
||||||
* @param[in] _type Unit of the Dimention
|
* @param[in] _type Unit of the Dimention
|
||||||
*/
|
*/
|
||||||
Dimension(const vec2& _size, enum gale::Dimension::distance _type=gale::Dimension::Pixel);
|
Dimension(const vec2& _size, enum gale::distance _type=gale::distance::pixel);
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
* @param[in] _config dimension configuration.
|
* @param[in] _config dimension configuration.
|
||||||
*/
|
*/
|
||||||
Dimension(const std::string& _config) :
|
Dimension(const std::string& _config) :
|
||||||
m_data(0,0),
|
m_data(0,0),
|
||||||
m_type(gale::Dimension::Pixel) {
|
m_type(gale::distance::pixel) {
|
||||||
set(_config);
|
set(_config);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -55,7 +55,7 @@ namespace gale {
|
|||||||
*/
|
*/
|
||||||
Dimension(const char* _config) :
|
Dimension(const char* _config) :
|
||||||
m_data(0,0),
|
m_data(0,0),
|
||||||
m_type(gale::Dimension::Pixel) {
|
m_type(gale::distance::pixel) {
|
||||||
set(_config);
|
set(_config);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -180,7 +180,7 @@ namespace gale {
|
|||||||
* @param[in] type Unit type requested.
|
* @param[in] type Unit type requested.
|
||||||
* @note: same as @ref setPixelPerInch (internal manage convertion)
|
* @note: same as @ref setPixelPerInch (internal manage convertion)
|
||||||
*/
|
*/
|
||||||
static void setPixelRatio(const vec2& _ratio, enum gale::Dimension::distance _type);
|
static void setPixelRatio(const vec2& _ratio, enum gale::distance _type);
|
||||||
/**
|
/**
|
||||||
* @brief set the current Windows size
|
* @brief set the current Windows size
|
||||||
* @param[in] size size of the current windows in pixel.
|
* @param[in] size size of the current windows in pixel.
|
||||||
@ -191,16 +191,16 @@ namespace gale {
|
|||||||
* @param[in] type Unit type requested.
|
* @param[in] type Unit type requested.
|
||||||
* @return the requested size
|
* @return the requested size
|
||||||
*/
|
*/
|
||||||
static vec2 getWindowsSize(enum gale::Dimension::distance _type);
|
static vec2 getWindowsSize(enum gale::distance _type);
|
||||||
/**
|
/**
|
||||||
* @brief get the Windows diagonal size in the request unit
|
* @brief get the Windows diagonal size in the request unit
|
||||||
* @param[in] type Unit type requested.
|
* @param[in] type Unit type requested.
|
||||||
* @return the requested size
|
* @return the requested size
|
||||||
*/
|
*/
|
||||||
static float getWindowsDiag(enum gale::Dimension::distance _type);
|
static float getWindowsDiag(enum gale::distance _type);
|
||||||
|
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream& _os, enum gale::Dimension::distance _obj);
|
std::ostream& operator <<(std::ostream& _os, enum gale::distance _obj);
|
||||||
std::ostream& operator <<(std::ostream& _os, const gale::Dimension& _obj);
|
std::ostream& operator <<(std::ostream& _os, const gale::Dimension& _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
gale::Thread::Thread() :
|
gale::Thread::Thread() :
|
||||||
m_state(state_stop),
|
m_state(state::stop),
|
||||||
#if !defined(__TARGET_OS__Android)
|
#if !defined(__TARGET_OS__Android)
|
||||||
m_thread(nullptr),
|
m_thread(nullptr),
|
||||||
#endif
|
#endif
|
||||||
@ -35,9 +35,9 @@ gale::Thread::~Thread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gale::Thread::start() {
|
void gale::Thread::start() {
|
||||||
if (m_state == state_stop) {
|
if (m_state == state::stop) {
|
||||||
GALE_DEBUG("Allocate std::thread [START]");
|
GALE_DEBUG("Allocate std::thread [START]");
|
||||||
m_state = state_starting;
|
m_state = state::starting;
|
||||||
m_context = &gale::getContext();
|
m_context = &gale::getContext();
|
||||||
#if defined(__TARGET_OS__Android)
|
#if defined(__TARGET_OS__Android)
|
||||||
pthread_create(&m_thread, nullptr, &gale::Thread::threadCallback, this);
|
pthread_create(&m_thread, nullptr, &gale::Thread::threadCallback, this);
|
||||||
@ -57,17 +57,17 @@ void gale::Thread::start() {
|
|||||||
//gale::contextRegisterThread(m_thread);
|
//gale::contextRegisterThread(m_thread);
|
||||||
|
|
||||||
GALE_DEBUG("Allocate std::thread [set State]");
|
GALE_DEBUG("Allocate std::thread [set State]");
|
||||||
m_state = state_running;
|
m_state = state::running;
|
||||||
GALE_DEBUG("Allocate std::thread [STOP]");
|
GALE_DEBUG("Allocate std::thread [STOP]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gale::Thread::stop() {
|
void gale::Thread::stop() {
|
||||||
if (m_state == state_stop) {
|
if (m_state == state::stop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while ( m_state == state_running
|
while ( m_state == state::running
|
||||||
|| m_state == state_starting) {
|
|| m_state == state::starting) {
|
||||||
// requesting a stop ...
|
// requesting a stop ...
|
||||||
GALE_INFO("wait Thread stopping");
|
GALE_INFO("wait Thread stopping");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
@ -87,25 +87,25 @@ void gale::Thread::stop() {
|
|||||||
m_thread.reset();
|
m_thread.reset();
|
||||||
#endif
|
#endif
|
||||||
GALE_DEBUG("stop std::thread [set state]");
|
GALE_DEBUG("stop std::thread [set state]");
|
||||||
m_state = state_stop;
|
m_state = state::stop;
|
||||||
GALE_DEBUG("stop std::thread [STOP]");
|
GALE_DEBUG("stop std::thread [STOP]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void gale::Thread::threadCall() {
|
void gale::Thread::threadCall() {
|
||||||
GALE_DEBUG("THREAD MAIN [START]");
|
GALE_DEBUG("THREAD MAIN [START]");
|
||||||
gale::setContext(m_context);
|
gale::setContext(m_context);
|
||||||
while (m_state != state_stopping) {
|
while (m_state != state::stopping) {
|
||||||
if (m_state == state_starting) {
|
if (m_state == state::starting) {
|
||||||
GALE_DEBUG("run std::thread [NOTHING to do]");
|
GALE_DEBUG("run std::thread [NOTHING to do]");
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (onThreadCall() == true) {
|
if (onThreadCall() == true) {
|
||||||
GALE_DEBUG("run std::thread [AUTO STOP]");
|
GALE_DEBUG("run std::thread [AUTO STOP]");
|
||||||
m_state = state_stopping;
|
m_state = state::stopping;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GALE_DEBUG("THREAD MAIN [STOP]");
|
GALE_DEBUG("THREAD MAIN [STOP]");
|
||||||
m_state = state_stopping;
|
m_state = state::stopping;
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,11 @@ namespace gale {
|
|||||||
*/
|
*/
|
||||||
class Thread {
|
class Thread {
|
||||||
private:
|
private:
|
||||||
enum state {
|
enum class state {
|
||||||
state_stop,
|
stop,
|
||||||
state_starting,
|
starting,
|
||||||
state_running,
|
running,
|
||||||
state_stopping
|
stopping
|
||||||
};
|
};
|
||||||
enum state m_state;
|
enum state m_state;
|
||||||
#if defined(__TARGET_OS__Android)
|
#if defined(__TARGET_OS__Android)
|
||||||
|
@ -441,8 +441,8 @@ class AndroidContext : public gale::Context {
|
|||||||
void ANDROID_SetKeyboard(char32_t _myChar, bool _isDown, bool _isARepeateKey=false) {
|
void ANDROID_SetKeyboard(char32_t _myChar, bool _isDown, bool _isARepeateKey=false) {
|
||||||
GALE_VERBOSE("ANDROID_SetKeyboard [BEGIN]");
|
GALE_VERBOSE("ANDROID_SetKeyboard [BEGIN]");
|
||||||
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_isARepeateKey,
|
_isARepeateKey,
|
||||||
_myChar);
|
_myChar);
|
||||||
GALE_VERBOSE("ANDROID_SetKeyboard [END]");
|
GALE_VERBOSE("ANDROID_SetKeyboard [END]");
|
||||||
@ -452,7 +452,7 @@ class AndroidContext : public gale::Context {
|
|||||||
GALE_VERBOSE("ANDROID_systemKeyboradEvent [BEGIN]");
|
GALE_VERBOSE("ANDROID_systemKeyboradEvent [BEGIN]");
|
||||||
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
||||||
_key,
|
_key,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up));
|
(_isDown==true?gale::key::status::down:gale::key::status_up));
|
||||||
GALE_VERBOSE("ANDROID_systemKeyboradEvent [END]");
|
GALE_VERBOSE("ANDROID_systemKeyboradEvent [END]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -464,7 +464,7 @@ class AndroidContext : public gale::Context {
|
|||||||
m_guiKeyBoardSpecialKeyMode.update(move, _isDown);
|
m_guiKeyBoardSpecialKeyMode.update(move, _isDown);
|
||||||
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
||||||
move,
|
move,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_isARepeateKey);
|
_isARepeateKey);
|
||||||
GALE_VERBOSE("ANDROID_SetKeyboardMove [END]");
|
GALE_VERBOSE("ANDROID_SetKeyboardMove [END]");
|
||||||
}
|
}
|
||||||
@ -701,8 +701,8 @@ extern "C" {
|
|||||||
// TODO : generate error in java to stop the current instance
|
// TODO : generate error in java to stop the current instance
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s_listInstance[_id]->OS_SetInput(gale::key::type_finger,
|
s_listInstance[_id]->OS_SetInput(gale::key::type::finger,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
_pointerID+1,
|
_pointerID+1,
|
||||||
vec2(_x,_y));
|
vec2(_x,_y));
|
||||||
}
|
}
|
||||||
@ -722,8 +722,8 @@ extern "C" {
|
|||||||
// TODO : generate error in java to stop the current instance
|
// TODO : generate error in java to stop the current instance
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s_listInstance[_id]->OS_SetInput(gale::key::type_finger,
|
s_listInstance[_id]->OS_SetInput(gale::key::type::finger,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_pointerID+1,
|
_pointerID+1,
|
||||||
vec2(_x,_y));
|
vec2(_x,_y));
|
||||||
}
|
}
|
||||||
@ -742,8 +742,8 @@ extern "C" {
|
|||||||
// TODO : generate error in java to stop the current instance
|
// TODO : generate error in java to stop the current instance
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s_listInstance[_id]->OS_SetInput(gale::key::type_mouse,
|
s_listInstance[_id]->OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
_pointerID+1,
|
_pointerID+1,
|
||||||
vec2(_x,_y));
|
vec2(_x,_y));
|
||||||
}
|
}
|
||||||
@ -763,8 +763,8 @@ extern "C" {
|
|||||||
// TODO : generate error in java to stop the current instance
|
// TODO : generate error in java to stop the current instance
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s_listInstance[_id]->OS_SetInput(gale::key::type_mouse,
|
s_listInstance[_id]->OS_SetInput(gale::key::type::mouse,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_pointerID+1,
|
_pointerID+1,
|
||||||
vec2(_x,_y));
|
vec2(_x,_y));
|
||||||
}
|
}
|
||||||
@ -832,7 +832,7 @@ extern "C" {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// set the internal system ratio properties ...
|
// set the internal system ratio properties ...
|
||||||
gale::Dimension::setPixelRatio(vec2(_ratioX,_ratioY), gale::Dimension::Inch);
|
gale::Dimension::setPixelRatio(vec2(_ratioX,_ratioY), gale::distance::inch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : set a return true or false if we want to grep this event ...
|
// TODO : set a return true or false if we want to grep this event ...
|
||||||
@ -852,25 +852,25 @@ extern "C" {
|
|||||||
switch (_keyVal) {
|
switch (_keyVal) {
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_VOLUME_UP:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_VOLUME_UP:
|
||||||
GALE_VERBOSE("IO keyboard Key system \"VOLUME_UP\" is down=" << _isdown);
|
GALE_VERBOSE("IO keyboard Key system \"VOLUME_UP\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_volumeUp, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::volumeUp, _isdown);
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_VOLUME_DOWN:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_VOLUME_DOWN:
|
||||||
GALE_DEBUG("IO keyboard Key system \"VOLUME_DOWN\" is down=" << _isdown);
|
GALE_DEBUG("IO keyboard Key system \"VOLUME_DOWN\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_volumeDown, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::volumeDown, _isdown);
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_MENU:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_MENU:
|
||||||
GALE_DEBUG("IO keyboard Key system \"MENU\" is down=" << _isdown);
|
GALE_DEBUG("IO keyboard Key system \"MENU\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_menu, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::menu, _isdown);
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_CAMERA:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_CAMERA:
|
||||||
GALE_DEBUG("IO keyboard Key system \"CAMERA\" is down=" << _isdown);
|
GALE_DEBUG("IO keyboard Key system \"CAMERA\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_camera, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::camera, _isdown);
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_HOME:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_HOME:
|
||||||
GALE_DEBUG("IO keyboard Key system \"HOME\" is down=" << _isdown);
|
GALE_DEBUG("IO keyboard Key system \"HOME\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_home, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::home, _isdown);
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_POWER:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_POWER:
|
||||||
GALE_DEBUG("IO keyboard Key system \"POWER\" is down=" << _isdown);
|
GALE_DEBUG("IO keyboard Key system \"POWER\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_power, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::power, _isdown);
|
||||||
case org_gale_GaleConstants_GALE_SYSTEM_KEY_BACK:
|
case org_gale_GaleConstants_GALE_SYSTEM_KEY_BACK:
|
||||||
GALE_DEBUG("IO keyboard Key system \"BACK\" is down=" << _isdown);
|
GALE_DEBUG("IO keyboard Key system \"BACK\" is down=" << _isdown);
|
||||||
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard_back, _isdown);
|
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(gale::key::keyboard::back, _isdown);
|
||||||
default:
|
default:
|
||||||
GALE_ERROR("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
|
GALE_ERROR("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
|
||||||
break;
|
break;
|
||||||
|
@ -287,11 +287,11 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
|
|||||||
// force a recalculation
|
// force a recalculation
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
#if defined(__GALE_ANDROID_ORIENTATION_LANDSCAPE__)
|
#if defined(__GALE_ANDROID_ORIENTATION_LANDSCAPE__)
|
||||||
forceOrientation(gale::orientation_screenLandscape);
|
forceOrientation(gale::orientation::screenLandscape);
|
||||||
#elif defined(__GALE_ANDROID_ORIENTATION_PORTRAIT__)
|
#elif defined(__GALE_ANDROID_ORIENTATION_PORTRAIT__)
|
||||||
forceOrientation(gale::orientation_screenPortrait);
|
forceOrientation(gale::orientation::screenPortrait);
|
||||||
#else
|
#else
|
||||||
forceOrientation(gale::orientation_screenAuto);
|
forceOrientation(gale::orientation::screenAuto);
|
||||||
#endif
|
#endif
|
||||||
if (m_imulationActive == true) {
|
if (m_imulationActive == true) {
|
||||||
// in simulation case:
|
// in simulation case:
|
||||||
@ -406,10 +406,10 @@ void gale::Context::OS_setKeyboard(const gale::key::Special& _special,
|
|||||||
bool _isARepeateKey,
|
bool _isARepeateKey,
|
||||||
char32_t _char) {
|
char32_t _char) {
|
||||||
if (_isARepeateKey == true) {
|
if (_isARepeateKey == true) {
|
||||||
if (_state == gale::key::status_down) {
|
if (_state == gale::key::status::down) {
|
||||||
_state = gale::key::status_downRepeate;
|
_state = gale::key::status::downRepeate;
|
||||||
} else {
|
} else {
|
||||||
_state = gale::key::status_upRepeate;
|
_state = gale::key::status::upRepeate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_imulationActive == true) {
|
if (m_imulationActive == true) {
|
||||||
|
@ -68,26 +68,26 @@ public:
|
|||||||
OS_Resize(vec2(_x,_y));
|
OS_Resize(vec2(_x,_y));
|
||||||
}
|
}
|
||||||
void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) {
|
void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) {
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_id,
|
_id,
|
||||||
vec2(_x, _y));
|
vec2(_x, _y));
|
||||||
}
|
}
|
||||||
void MAC_SetMouseMotion(int32_t _id, float _x, float _y) {
|
void MAC_SetMouseMotion(int32_t _id, float _x, float _y) {
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
_id,
|
_id,
|
||||||
vec2(_x, _y));
|
vec2(_x, _y));
|
||||||
}
|
}
|
||||||
void MAC_SetInputState(int32_t _id, bool _isDown, float _x, float _y) {
|
void MAC_SetInputState(int32_t _id, bool _isDown, float _x, float _y) {
|
||||||
OS_SetInput(gale::key::type_finger,
|
OS_SetInput(gale::key::type::finger,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_id,
|
_id,
|
||||||
vec2(_x, _y));
|
vec2(_x, _y));
|
||||||
}
|
}
|
||||||
void MAC_SetInputMotion(int32_t _id, float _x, float _y) {
|
void MAC_SetInputMotion(int32_t _id, float _x, float _y) {
|
||||||
OS_SetInput(gale::key::type_finger,
|
OS_SetInput(gale::key::type::finger,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
_id,
|
_id,
|
||||||
vec2(_x, _y));
|
vec2(_x, _y));
|
||||||
}
|
}
|
||||||
@ -105,26 +105,26 @@ public:
|
|||||||
enum gale::key::keyboard move;
|
enum gale::key::keyboard move;
|
||||||
switch(_unichar) {
|
switch(_unichar) {
|
||||||
case 0:
|
case 0:
|
||||||
move = gale::key::keyboard_up;
|
move = gale::key::keyboard::up;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
move = gale::key::keyboard_down;
|
move = gale::key::keyboard::down;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
move = gale::key::keyboard_left;
|
move = gale::key::keyboard::left;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
move = gale::key::keyboard_right;
|
move = gale::key::keyboard::right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
OS_setKeyboard(_special,
|
OS_setKeyboard(_special,
|
||||||
move,
|
move,
|
||||||
(_isDown==false?gale::key::status_down:gale::key::status_up),
|
(_isDown==false?gale::key::status::down:gale::key::status_up),
|
||||||
_isARepeateKey);
|
_isARepeateKey);
|
||||||
} else {
|
} else {
|
||||||
OS_setKeyboard(_special,
|
OS_setKeyboard(_special,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(_isDown==false?gale::key::status_down:gale::key::status_up),
|
(_isDown==false?gale::key::status::down:gale::key::status_up),
|
||||||
_isARepeateKey,
|
_isARepeateKey,
|
||||||
_unichar);
|
_unichar);
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ public:
|
|||||||
bool _isDown) {
|
bool _isDown) {
|
||||||
OS_setKeyboard(_special,
|
OS_setKeyboard(_special,
|
||||||
_move,
|
_move,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up));
|
(_isDown==true?gale::key::status::down:gale::key::status_up));
|
||||||
}
|
}
|
||||||
void openURL(const std::string& _url) {
|
void openURL(const std::string& _url) {
|
||||||
mm_openURL(_url.c_str());
|
mm_openURL(_url.c_str());
|
||||||
|
@ -136,7 +136,7 @@
|
|||||||
GALE_INFO("**** screen size:" << vec2(m_currentSize.width, m_currentSize.height));
|
GALE_INFO("**** screen size:" << vec2(m_currentSize.width, m_currentSize.height));
|
||||||
float ratio = [self getScreenPPP];
|
float ratio = [self getScreenPPP];
|
||||||
GALE_INFO("**** pixel ratio: " << ratio);
|
GALE_INFO("**** pixel ratio: " << ratio);
|
||||||
gale::Dimension::setPixelRatio(vec2(1.0f/ratio, 1.0f/ratio), gale::Dimension::Inch);
|
gale::Dimension::setPixelRatio(vec2(1.0f/ratio, 1.0f/ratio), gale::distance::inch);
|
||||||
IOs::resize(m_currentSize.width, m_currentSize.height);
|
IOs::resize(m_currentSize.width, m_currentSize.height);
|
||||||
CGRect localBounds = [self bounds];
|
CGRect localBounds = [self bounds];
|
||||||
GALE_INFO("**** localBounds:" << vec2(localBounds.size.width, localBounds.size.height));
|
GALE_INFO("**** localBounds:" << vec2(localBounds.size.width, localBounds.size.height));
|
||||||
|
@ -66,14 +66,14 @@ class MacOSInterface : public gale::Context {
|
|||||||
OS_Resize(vec2(_x,_y));
|
OS_Resize(vec2(_x,_y));
|
||||||
}
|
}
|
||||||
void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) {
|
void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) {
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
(_isDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
_id,
|
_id,
|
||||||
vec2(_x, _y));
|
vec2(_x, _y));
|
||||||
}
|
}
|
||||||
void MAC_SetMouseMotion(int32_t _id, float _x, float _y) {
|
void MAC_SetMouseMotion(int32_t _id, float _x, float _y) {
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
_id,
|
_id,
|
||||||
vec2(_x, _y));
|
vec2(_x, _y));
|
||||||
}
|
}
|
||||||
@ -91,28 +91,28 @@ class MacOSInterface : public gale::Context {
|
|||||||
enum gale::key::keyboard move;
|
enum gale::key::keyboard move;
|
||||||
switch(_unichar) {
|
switch(_unichar) {
|
||||||
case 0:
|
case 0:
|
||||||
move = gale::key::keyboard_up;
|
move = gale::key::keyboard::up;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
move = gale::key::keyboard_down;
|
move = gale::key::keyboard::down;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
move = gale::key::keyboard_left;
|
move = gale::key::keyboard::left;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
move = gale::key::keyboard_right;
|
move = gale::key::keyboard::right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
OS_setKeyboard(_special, move, (_isDown==false?gale::key::status_down:gale::key::status_up), _isAReapeateKey);
|
OS_setKeyboard(_special, move, (_isDown==false?gale::key::status::down:gale::key::status_up), _isAReapeateKey);
|
||||||
} else {
|
} else {
|
||||||
OS_setKeyboard(_special, gale::key::keyboard_char, (_isDown==false?gale::key::status_down:gale::key::status_up), _isAReapeateKey, _unichar);
|
OS_setKeyboard(_special, gale::key::keyboard::character, (_isDown==false?gale::key::status::down:gale::key::status_up), _isAReapeateKey, _unichar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MAC_SetKeyboardMove(gale::key::Special& _special,
|
void MAC_SetKeyboardMove(gale::key::Special& _special,
|
||||||
enum gale::key::keyboard _move,
|
enum gale::key::keyboard _move,
|
||||||
bool _isDown,
|
bool _isDown,
|
||||||
bool _isAReapeateKey) {
|
bool _isAReapeateKey) {
|
||||||
OS_setKeyboard(_special, _move, (_isDown==true?gale::key::status_down:gale::key::status_up), _isAReapeateKey);
|
OS_setKeyboard(_special, _move, (_isDown==true?gale::key::status::down:gale::key::status_up), _isAReapeateKey);
|
||||||
}
|
}
|
||||||
void openURL(const std::string& _url) {
|
void openURL(const std::string& _url) {
|
||||||
std::string req = "open " + _url;
|
std::string req = "open " + _url;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
gale::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
|
gale::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
|
||||||
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
|
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
|
||||||
gale::Dimension::Millimeter);
|
gale::distance::millimeter);
|
||||||
_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
|
_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
|
||||||
_redraw = true;
|
_redraw = true;
|
||||||
|
|
||||||
|
@ -92,21 +92,21 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
bool find = true;
|
bool find = true;
|
||||||
enum gale::key::keyboard keyInput;
|
enum gale::key::keyboard keyInput;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 63232: keyInput = gale::key::keyboard_up; break;
|
case 63232: keyInput = gale::key::keyboard::up; break;
|
||||||
case 63233: keyInput = gale::key::keyboard_down; break;
|
case 63233: keyInput = gale::key::keyboard::down; break;
|
||||||
case 63234: keyInput = gale::key::keyboard_left; break;
|
case 63234: keyInput = gale::key::keyboard::left; break;
|
||||||
case 63235: keyInput = gale::key::keyboard_right; break;
|
case 63235: keyInput = gale::key::keyboard::right; break;
|
||||||
case 63276: keyInput = gale::key::keyboard_pageUp; break;
|
case 63276: keyInput = gale::key::keyboard::pageUp; break;
|
||||||
case 63277: keyInput = gale::key::keyboard_pageDown; break;
|
case 63277: keyInput = gale::key::keyboard::pageDown; break;
|
||||||
case 63273: keyInput = gale::key::keyboard_start; break;
|
case 63273: keyInput = gale::key::keyboard::start; break;
|
||||||
case 63275: keyInput = gale::key::keyboard_end; break;
|
case 63275: keyInput = gale::key::keyboard::end; break;
|
||||||
/*
|
/*
|
||||||
case 78: keyInput = gale::key::keyboard_stopDefil; break;
|
case 78: keyInput = gale::key::keyboard::stopDefil; break;
|
||||||
case 127: keyInput = gale::key::keyboard_wait; break;
|
case 127: keyInput = gale::key::keyboard::wait; break;
|
||||||
*/
|
*/
|
||||||
case 63302:
|
case 63302:
|
||||||
find = false;
|
find = false;
|
||||||
keyInput = gale::key::keyboard_insert;
|
keyInput = gale::key::keyboard::insert;
|
||||||
if(_isDown == false) {
|
if(_isDown == false) {
|
||||||
if (true == guiKeyBoardMode.getInsert()) {
|
if (true == guiKeyBoardMode.getInsert()) {
|
||||||
guiKeyBoardMode.setInsert(false);
|
guiKeyBoardMode.setInsert(false);
|
||||||
@ -120,18 +120,18 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
MacOs::setKeyboardMove(guiKeyBoardMode, keyInput, false, thisIsAReapeateKey);
|
MacOs::setKeyboardMove(guiKeyBoardMode, keyInput, false, thisIsAReapeateKey);
|
||||||
break;
|
break;
|
||||||
//case 84: keyInput = gale::key::keyboardCenter; break; // Keypad
|
//case 84: keyInput = gale::key::keyboardCenter; break; // Keypad
|
||||||
case 63236: keyInput = gale::key::keyboard_f1; break;
|
case 63236: keyInput = gale::key::keyboard::f1; break;
|
||||||
case 63237: keyInput = gale::key::keyboard_f2; break;
|
case 63237: keyInput = gale::key::keyboard::f2; break;
|
||||||
case 63238: keyInput = gale::key::keyboard_f3; break;
|
case 63238: keyInput = gale::key::keyboard::f3; break;
|
||||||
case 63239: keyInput = gale::key::keyboard_f4; break;
|
case 63239: keyInput = gale::key::keyboard::f4; break;
|
||||||
case 63240: keyInput = gale::key::keyboard_f5; break;
|
case 63240: keyInput = gale::key::keyboard::f5; break;
|
||||||
case 63241: keyInput = gale::key::keyboard_f6; break;
|
case 63241: keyInput = gale::key::keyboard::f6; break;
|
||||||
case 63242: keyInput = gale::key::keyboard_f7; break;
|
case 63242: keyInput = gale::key::keyboard::f7; break;
|
||||||
case 63243: keyInput = gale::key::keyboard_f8; break;
|
case 63243: keyInput = gale::key::keyboard::f8; break;
|
||||||
case 63244: keyInput = gale::key::keyboard_f9; break;
|
case 63244: keyInput = gale::key::keyboard::f9; break;
|
||||||
case 63245: keyInput = gale::key::keyboard_f10; break;
|
case 63245: keyInput = gale::key::keyboard::f10; break;
|
||||||
case 63246: keyInput = gale::key::keyboard_f11; break;
|
case 63246: keyInput = gale::key::keyboard::f11; break;
|
||||||
case 63247: keyInput = gale::key::keyboard_f12; break;
|
case 63247: keyInput = gale::key::keyboard::f12; break;
|
||||||
case 63272: // Suppress
|
case 63272: // Suppress
|
||||||
find = false;
|
find = false;
|
||||||
MacOs::setKeyboard(guiKeyBoardMode, u32char::Delete, _isDown, thisIsAReapeateKey);
|
MacOs::setKeyboard(guiKeyBoardMode, u32char::Delete, _isDown, thisIsAReapeateKey);
|
||||||
@ -178,12 +178,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
GALE_VERBOSE("NSAlphaShiftKeyMask");
|
GALE_VERBOSE("NSAlphaShiftKeyMask");
|
||||||
if (guiKeyBoardMode.getCapsLock() == false) {
|
if (guiKeyBoardMode.getCapsLock() == false) {
|
||||||
guiKeyBoardMode.setCapsLock(true);
|
guiKeyBoardMode.setCapsLock(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_capLock, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::capLock, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getCapsLock() == true) {
|
if (guiKeyBoardMode.getCapsLock() == true) {
|
||||||
guiKeyBoardMode.setCapsLock(false);
|
guiKeyBoardMode.setCapsLock(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_capLock, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::capLock, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,12 +191,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
GALE_VERBOSE("NSShiftKeyMask");
|
GALE_VERBOSE("NSShiftKeyMask");
|
||||||
if (guiKeyBoardMode.getShift() == false) {
|
if (guiKeyBoardMode.getShift() == false) {
|
||||||
guiKeyBoardMode.setShift(true);
|
guiKeyBoardMode.setShift(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_shiftLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::shiftLeft, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getShift() == true) {
|
if (guiKeyBoardMode.getShift() == true) {
|
||||||
guiKeyBoardMode.setShift(false);
|
guiKeyBoardMode.setShift(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_shiftLeft, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::shiftLeft, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,13 +205,13 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
if (guiKeyBoardMode.getCtrl() == false) {
|
if (guiKeyBoardMode.getCtrl() == false) {
|
||||||
GALE_VERBOSE("NSControlKeyMask DOWN");
|
GALE_VERBOSE("NSControlKeyMask DOWN");
|
||||||
guiKeyBoardMode.setCtrl(true);
|
guiKeyBoardMode.setCtrl(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_ctrlLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getCtrl() == true) {
|
if (guiKeyBoardMode.getCtrl() == true) {
|
||||||
GALE_VERBOSE("NSControlKeyMask UP");
|
GALE_VERBOSE("NSControlKeyMask UP");
|
||||||
guiKeyBoardMode.setCtrl(false);
|
guiKeyBoardMode.setCtrl(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_ctrlLeft, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,12 +219,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
GALE_VERBOSE("NSAlternateKeyMask");
|
GALE_VERBOSE("NSAlternateKeyMask");
|
||||||
if (guiKeyBoardMode.getAlt() == false) {
|
if (guiKeyBoardMode.getAlt() == false) {
|
||||||
guiKeyBoardMode.setAlt(true);
|
guiKeyBoardMode.setAlt(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_alt, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::alt, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getAlt() == true) {
|
if (guiKeyBoardMode.getAlt() == true) {
|
||||||
guiKeyBoardMode.setAlt(false);
|
guiKeyBoardMode.setAlt(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_alt, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::alt, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,12 +232,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
GALE_VERBOSE("NSCommandKeyMask");
|
GALE_VERBOSE("NSCommandKeyMask");
|
||||||
if (guiKeyBoardMode.getMeta() == false) {
|
if (guiKeyBoardMode.getMeta() == false) {
|
||||||
guiKeyBoardMode.setMeta(true);
|
guiKeyBoardMode.setMeta(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_metaLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::metaLeft, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getMeta() == true) {
|
if (guiKeyBoardMode.getMeta() == true) {
|
||||||
guiKeyBoardMode.setMeta(false);
|
guiKeyBoardMode.setMeta(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_metaLeft, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::metaLeft, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,12 +245,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
GALE_VERBOSE("NSNumericPadKeyMask");
|
GALE_VERBOSE("NSNumericPadKeyMask");
|
||||||
if (guiKeyBoardMode.getNumLock() == false) {
|
if (guiKeyBoardMode.getNumLock() == false) {
|
||||||
guiKeyBoardMode.setNumLock(true);
|
guiKeyBoardMode.setNumLock(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_numLock, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::numLock, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getNumLock() == true) {
|
if (guiKeyBoardMode.getNumLock() == true) {
|
||||||
guiKeyBoardMode.setNumLock(false);
|
guiKeyBoardMode.setNumLock(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_numLock, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::numLock, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) {
|
if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) {
|
||||||
@ -258,8 +258,8 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
if (([theEvent modifierFlags] & NSFunctionKeyMask) != 0) {
|
if (([theEvent modifierFlags] & NSFunctionKeyMask) != 0) {
|
||||||
GALE_VERBOSE("NSFunctionKeyMask");
|
GALE_VERBOSE("NSFunctionKeyMask");
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_contextMenu, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::contextMenu, true, false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard_contextMenu, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::contextMenu, false, false);
|
||||||
}
|
}
|
||||||
GALE_VERBOSE("EVENT : " << int32_t([theEvent modifierFlags]));
|
GALE_VERBOSE("EVENT : " << int32_t([theEvent modifierFlags]));
|
||||||
}
|
}
|
||||||
|
@ -270,39 +270,39 @@ class WindowsContext : public gale::Context {
|
|||||||
enum gale::key::keyboard keyInput;
|
enum gale::key::keyboard keyInput;
|
||||||
switch (_wParam) {
|
switch (_wParam) {
|
||||||
//case 80: // keypad
|
//case 80: // keypad
|
||||||
case VK_UP: keyInput = gale::key::keyboard_up; break;
|
case VK_UP: keyInput = gale::key::keyboard::up; break;
|
||||||
//case 83: // keypad
|
//case 83: // keypad
|
||||||
case VK_LEFT: keyInput = gale::key::keyboard_left; break;
|
case VK_LEFT: keyInput = gale::key::keyboard::left; break;
|
||||||
//case 85: // keypad
|
//case 85: // keypad
|
||||||
case VK_RIGHT: keyInput = gale::key::keyboard_right; break;
|
case VK_RIGHT: keyInput = gale::key::keyboard::right; break;
|
||||||
//case 88: // keypad
|
//case 88: // keypad
|
||||||
case VK_DOWN: keyInput = gale::key::keyboard_down; break;
|
case VK_DOWN: keyInput = gale::key::keyboard::down; break;
|
||||||
//case 81: // keypad
|
//case 81: // keypad
|
||||||
case VK_PRIOR: keyInput = gale::key::keyboard_pageUp; break;
|
case VK_PRIOR: keyInput = gale::key::keyboard::pageUp; break;
|
||||||
//case 89: // keypad
|
//case 89: // keypad
|
||||||
case VK_NEXT: keyInput = gale::key::keyboard_pageDown; break;
|
case VK_NEXT: keyInput = gale::key::keyboard::pageDown; break;
|
||||||
//case 79: // keypad
|
//case 79: // keypad
|
||||||
case VK_HOME: keyInput = gale::key::keyboard_start; break;
|
case VK_HOME: keyInput = gale::key::keyboard::start; break;
|
||||||
//case 87: // keypad
|
//case 87: // keypad
|
||||||
case VK_END: keyInput = gale::key::keyboard_end; break;
|
case VK_END: keyInput = gale::key::keyboard::end; break;
|
||||||
//case VK_: keyInput = gale::key::keyboardStopDefil; break;
|
//case VK_: keyInput = gale::key::keyboardStopDefil; break;
|
||||||
case VK_PAUSE: keyInput = gale::key::keyboard_wait; break;
|
case VK_PAUSE: keyInput = gale::key::keyboard::wait; break;
|
||||||
//case 90: // keypad
|
//case 90: // keypad
|
||||||
case VK_INSERT:
|
case VK_INSERT:
|
||||||
keyInput = gale::key::keyboard_insert;
|
keyInput = gale::key::keyboard::insert;
|
||||||
m_guiKeyBoardMode.setInsert(buttonIsDown);
|
m_guiKeyBoardMode.setInsert(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_F1: keyInput = gale::key::keyboard_f1; break;
|
case VK_F1: keyInput = gale::key::keyboard::f1; break;
|
||||||
case VK_F2: keyInput = gale::key::keyboard_f2; break;
|
case VK_F2: keyInput = gale::key::keyboard::f2; break;
|
||||||
case VK_F3: keyInput = gale::key::keyboard_f3; break;
|
case VK_F3: keyInput = gale::key::keyboard::f3; break;
|
||||||
case VK_F4: keyInput = gale::key::keyboard_f4; break;
|
case VK_F4: keyInput = gale::key::keyboard::f4; break;
|
||||||
case VK_F5: keyInput = gale::key::keyboard_f5; break;
|
case VK_F5: keyInput = gale::key::keyboard::f5; break;
|
||||||
case VK_F6: keyInput = gale::key::keyboard_f6; break;
|
case VK_F6: keyInput = gale::key::keyboard::f6; break;
|
||||||
case VK_F7: keyInput = gale::key::keyboard_f7; break;
|
case VK_F7: keyInput = gale::key::keyboard::f7; break;
|
||||||
case VK_F8: keyInput = gale::key::keyboard_f8; break;
|
case VK_F8: keyInput = gale::key::keyboard::f8; break;
|
||||||
case VK_F9: keyInput = gale::key::keyboard_f9; break;
|
case VK_F9: keyInput = gale::key::keyboard::f9; break;
|
||||||
case VK_F10: keyInput = gale::key::keyboard_f10; break;
|
case VK_F10: keyInput = gale::key::keyboard::f10; break;
|
||||||
case VK_F11: keyInput = gale::key::keyboard_f11; break;
|
case VK_F11: keyInput = gale::key::keyboard::f11; break;
|
||||||
case VK_F12:
|
case VK_F12:
|
||||||
case VK_F13:
|
case VK_F13:
|
||||||
case VK_F14:
|
case VK_F14:
|
||||||
@ -315,49 +315,49 @@ class WindowsContext : public gale::Context {
|
|||||||
case VK_F21:
|
case VK_F21:
|
||||||
case VK_F22:
|
case VK_F22:
|
||||||
case VK_F23:
|
case VK_F23:
|
||||||
case VK_F24: keyInput = gale::key::keyboard_f12; break;
|
case VK_F24: keyInput = gale::key::keyboard::f12; break;
|
||||||
case VK_CAPITAL:
|
case VK_CAPITAL:
|
||||||
keyInput = gale::key::keyboard_capLock;
|
keyInput = gale::key::keyboard::capLock;
|
||||||
m_guiKeyBoardMode.setCapsLock(buttonIsDown);
|
m_guiKeyBoardMode.setCapsLock(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_SHIFT:
|
case VK_SHIFT:
|
||||||
case VK_LSHIFT:
|
case VK_LSHIFT:
|
||||||
keyInput = gale::key::keyboard_shiftLeft;
|
keyInput = gale::key::keyboard::shiftLeft;
|
||||||
m_guiKeyBoardMode.setShift(buttonIsDown);
|
m_guiKeyBoardMode.setShift(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_RSHIFT:
|
case VK_RSHIFT:
|
||||||
keyInput = gale::key::keyboard_shiftRight;
|
keyInput = gale::key::keyboard::shiftRight;
|
||||||
m_guiKeyBoardMode.setShift(buttonIsDown);
|
m_guiKeyBoardMode.setShift(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_CONTROL:
|
case VK_CONTROL:
|
||||||
case VK_LCONTROL:
|
case VK_LCONTROL:
|
||||||
keyInput = gale::key::keyboard_ctrlLeft;
|
keyInput = gale::key::keyboard::ctrlLeft;
|
||||||
m_guiKeyBoardMode.setCtrl(buttonIsDown);
|
m_guiKeyBoardMode.setCtrl(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_RCONTROL:
|
case VK_RCONTROL:
|
||||||
keyInput = gale::key::keyboard_ctrlRight;
|
keyInput = gale::key::keyboard::ctrlRight;
|
||||||
m_guiKeyBoardMode.setCtrl(buttonIsDown);
|
m_guiKeyBoardMode.setCtrl(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_LWIN:
|
case VK_LWIN:
|
||||||
keyInput = gale::key::keyboard_metaLeft;
|
keyInput = gale::key::keyboard::metaLeft;
|
||||||
m_guiKeyBoardMode.setMeta(buttonIsDown);
|
m_guiKeyBoardMode.setMeta(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_RWIN:
|
case VK_RWIN:
|
||||||
keyInput = gale::key::keyboard_metaRight;
|
keyInput = gale::key::keyboard::metaRight;
|
||||||
m_guiKeyBoardMode.setMeta(buttonIsDown);
|
m_guiKeyBoardMode.setMeta(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_MENU:
|
case VK_MENU:
|
||||||
case VK_LMENU:
|
case VK_LMENU:
|
||||||
keyInput = gale::key::keyboard_alt;
|
keyInput = gale::key::keyboard::alt;
|
||||||
m_guiKeyBoardMode.setAlt(buttonIsDown);
|
m_guiKeyBoardMode.setAlt(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_RMENU:
|
case VK_RMENU:
|
||||||
keyInput = gale::key::keyboard_altGr;
|
keyInput = gale::key::keyboard::altGr;
|
||||||
m_guiKeyBoardMode.setAltGr(buttonIsDown);
|
m_guiKeyBoardMode.setAltGr(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
//case : keyInput = gale::key::keyboardContextMenu; break;
|
//case : keyInput = gale::key::keyboardContextMenu; break;
|
||||||
case VK_NUMLOCK:
|
case VK_NUMLOCK:
|
||||||
keyInput = gale::key::keyboard_numLock;
|
keyInput = gale::key::keyboard::numLock;
|
||||||
m_guiKeyBoardMode.setNumLock(buttonIsDown);
|
m_guiKeyBoardMode.setNumLock(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_BACK: // DEL
|
case VK_BACK: // DEL
|
||||||
@ -390,11 +390,11 @@ class WindowsContext : public gale::Context {
|
|||||||
//GALE_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
//GALE_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
keyInput,
|
keyInput,
|
||||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up));
|
(buttonIsDown==true?gale::key::status::down:gale::key::status_up));
|
||||||
} else {
|
} else {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
(buttonIsDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
false,
|
false,
|
||||||
tmpChar);
|
tmpChar);
|
||||||
}
|
}
|
||||||
@ -410,8 +410,8 @@ class WindowsContext : public gale::Context {
|
|||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
(buttonIsDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
mouseButtonId,
|
mouseButtonId,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
@ -423,8 +423,8 @@ class WindowsContext : public gale::Context {
|
|||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
(buttonIsDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
mouseButtonId,
|
mouseButtonId,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
@ -436,8 +436,8 @@ class WindowsContext : public gale::Context {
|
|||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
(buttonIsDown==true?gale::key::status::down:gale::key::status_up),
|
||||||
mouseButtonId,
|
mouseButtonId,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
@ -452,12 +452,12 @@ class WindowsContext : public gale::Context {
|
|||||||
}
|
}
|
||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_down,
|
gale::key::status::down,
|
||||||
mouseButtonId,
|
mouseButtonId,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_up,
|
gale::key::status::up,
|
||||||
mouseButtonId,
|
mouseButtonId,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
@ -469,16 +469,16 @@ class WindowsContext : public gale::Context {
|
|||||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
||||||
if (true == m_inputIsPressed[iii]) {
|
if (true == m_inputIsPressed[iii]) {
|
||||||
GALE_VERBOSE("Windows event: bt=" << iii << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
GALE_VERBOSE("Windows event: bt=" << iii << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
iii,
|
iii,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GALE_VERBOSE("Windows event: bt=" << 0 << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
GALE_VERBOSE("Windows event: bt=" << 0 << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
0,
|
0,
|
||||||
vec2(pos.x(),pos.y()));
|
vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -163,7 +163,7 @@ class X11Interface : public gale::Context {
|
|||||||
XAtomeTargetTarget(0),
|
XAtomeTargetTarget(0),
|
||||||
XAtomeGALE(0),
|
XAtomeGALE(0),
|
||||||
XAtomeDeleteWindows(0),
|
XAtomeDeleteWindows(0),
|
||||||
m_currentCursor(gale::context::cursor_arrow),
|
m_currentCursor(gale::context::cursor::arrow),
|
||||||
m_lastKeyPressed(0) {
|
m_lastKeyPressed(0) {
|
||||||
X11_INFO("X11:INIT");
|
X11_INFO("X11:INIT");
|
||||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||||
@ -265,7 +265,7 @@ class X11Interface : public gale::Context {
|
|||||||
(~0L), // length
|
(~0L), // length
|
||||||
False, // delete
|
False, // delete
|
||||||
AnyPropertyType, // reg_type
|
AnyPropertyType, // reg_type
|
||||||
&type,// *actual_type_return,
|
&type,// *actual_type::return,
|
||||||
&format,// *actual_format_return
|
&format,// *actual_format_return
|
||||||
&nitems,// *nitems_return
|
&nitems,// *nitems_return
|
||||||
&bytes, // *bytes_after_return
|
&bytes, // *bytes_after_return
|
||||||
@ -429,8 +429,8 @@ class X11Interface : public gale::Context {
|
|||||||
if (event.xbutton.button < MAX_MANAGE_INPUT) {
|
if (event.xbutton.button < MAX_MANAGE_INPUT) {
|
||||||
m_inputIsPressed[event.xbutton.button] = true;
|
m_inputIsPressed[event.xbutton.button] = true;
|
||||||
}
|
}
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_down,
|
gale::key::status::down,
|
||||||
event.xbutton.button,
|
event.xbutton.button,
|
||||||
vec2(event.xbutton.x, m_cursorEventY));
|
vec2(event.xbutton.x, m_cursorEventY));
|
||||||
break;
|
break;
|
||||||
@ -441,8 +441,8 @@ class X11Interface : public gale::Context {
|
|||||||
if (event.xbutton.button < MAX_MANAGE_INPUT) {
|
if (event.xbutton.button < MAX_MANAGE_INPUT) {
|
||||||
m_inputIsPressed[event.xbutton.button] = false;
|
m_inputIsPressed[event.xbutton.button] = false;
|
||||||
}
|
}
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_up,
|
gale::key::status::up,
|
||||||
event.xbutton.button,
|
event.xbutton.button,
|
||||||
vec2(event.xbutton.x, m_cursorEventY));
|
vec2(event.xbutton.x, m_cursorEventY));
|
||||||
break;
|
break;
|
||||||
@ -490,8 +490,8 @@ class X11Interface : public gale::Context {
|
|||||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
||||||
if (m_inputIsPressed[iii] == true) {
|
if (m_inputIsPressed[iii] == true) {
|
||||||
X11_DEBUG("X11 event: bt=" << iii << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
|
X11_DEBUG("X11 event: bt=" << iii << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
iii,
|
iii,
|
||||||
vec2(m_cursorEventX, m_cursorEventY));
|
vec2(m_cursorEventX, m_cursorEventY));
|
||||||
findOne = true;
|
findOne = true;
|
||||||
@ -499,8 +499,8 @@ class X11Interface : public gale::Context {
|
|||||||
}
|
}
|
||||||
if (findOne == false) {
|
if (findOne == false) {
|
||||||
X11_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
|
X11_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
|
||||||
OS_SetInput(gale::key::type_mouse,
|
OS_SetInput(gale::key::type::mouse,
|
||||||
gale::key::status_move,
|
gale::key::status::move,
|
||||||
0,
|
0,
|
||||||
vec2(m_cursorEventX, m_cursorEventY));
|
vec2(m_cursorEventX, m_cursorEventY));
|
||||||
}
|
}
|
||||||
@ -595,26 +595,26 @@ class X11Interface : public gale::Context {
|
|||||||
enum gale::key::keyboard keyInput;
|
enum gale::key::keyboard keyInput;
|
||||||
switch (event.xkey.keycode) {
|
switch (event.xkey.keycode) {
|
||||||
//case 80: // keypad
|
//case 80: // keypad
|
||||||
case 111: keyInput = gale::key::keyboard_up; break;
|
case 111: keyInput = gale::key::keyboard::up; break;
|
||||||
//case 83: // keypad
|
//case 83: // keypad
|
||||||
case 113: keyInput = gale::key::keyboard_left; break;
|
case 113: keyInput = gale::key::keyboard::left; break;
|
||||||
//case 85: // keypad
|
//case 85: // keypad
|
||||||
case 114: keyInput = gale::key::keyboard_right; break;
|
case 114: keyInput = gale::key::keyboard::right; break;
|
||||||
//case 88: // keypad
|
//case 88: // keypad
|
||||||
case 116: keyInput = gale::key::keyboard_down; break;
|
case 116: keyInput = gale::key::keyboard::down; break;
|
||||||
//case 81: // keypad
|
//case 81: // keypad
|
||||||
case 112: keyInput = gale::key::keyboard_pageUp; break;
|
case 112: keyInput = gale::key::keyboard::pageUp; break;
|
||||||
//case 89: // keypad
|
//case 89: // keypad
|
||||||
case 117: keyInput = gale::key::keyboard_pageDown; break;
|
case 117: keyInput = gale::key::keyboard::pageDown; break;
|
||||||
//case 79: // keypad
|
//case 79: // keypad
|
||||||
case 110: keyInput = gale::key::keyboard_start; break;
|
case 110: keyInput = gale::key::keyboard::start; break;
|
||||||
//case 87: // keypad
|
//case 87: // keypad
|
||||||
case 115: keyInput = gale::key::keyboard_end; break;
|
case 115: keyInput = gale::key::keyboard::end; break;
|
||||||
case 78: keyInput = gale::key::keyboard_stopDefil; break;
|
case 78: keyInput = gale::key::keyboard::stopDefil; break;
|
||||||
case 127: keyInput = gale::key::keyboard_wait; break;
|
case 127: keyInput = gale::key::keyboard::wait; break;
|
||||||
//case 90: // keypad
|
//case 90: // keypad
|
||||||
case 118:
|
case 118:
|
||||||
keyInput = gale::key::keyboard_insert;
|
keyInput = gale::key::keyboard::insert;
|
||||||
if(event.type == KeyRelease) {
|
if(event.type == KeyRelease) {
|
||||||
if (m_guiKeyBoardMode.getInsert() == true) {
|
if (m_guiKeyBoardMode.getInsert() == true) {
|
||||||
m_guiKeyBoardMode.setInsert(false);
|
m_guiKeyBoardMode.setInsert(false);
|
||||||
@ -624,54 +624,54 @@ class X11Interface : public gale::Context {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//case 84: keyInput = gale::key::keyboardCenter; break; // Keypad
|
//case 84: keyInput = gale::key::keyboardCenter; break; // Keypad
|
||||||
case 67: keyInput = gale::key::keyboard_f1; break;
|
case 67: keyInput = gale::key::keyboard::f1; break;
|
||||||
case 68: keyInput = gale::key::keyboard_f2; break;
|
case 68: keyInput = gale::key::keyboard::f2; break;
|
||||||
case 69: keyInput = gale::key::keyboard_f3; break;
|
case 69: keyInput = gale::key::keyboard::f3; break;
|
||||||
case 70: keyInput = gale::key::keyboard_f4; break;
|
case 70: keyInput = gale::key::keyboard::f4; break;
|
||||||
case 71: keyInput = gale::key::keyboard_f5; break;
|
case 71: keyInput = gale::key::keyboard::f5; break;
|
||||||
case 72: keyInput = gale::key::keyboard_f6; break;
|
case 72: keyInput = gale::key::keyboard::f6; break;
|
||||||
case 73: keyInput = gale::key::keyboard_f7; break;
|
case 73: keyInput = gale::key::keyboard::f7; break;
|
||||||
case 74: keyInput = gale::key::keyboard_f8; break;
|
case 74: keyInput = gale::key::keyboard::f8; break;
|
||||||
case 75: keyInput = gale::key::keyboard_f9; break;
|
case 75: keyInput = gale::key::keyboard::f9; break;
|
||||||
case 76: keyInput = gale::key::keyboard_f10; break;
|
case 76: keyInput = gale::key::keyboard::f10; break;
|
||||||
case 95: keyInput = gale::key::keyboard_f11; break;
|
case 95: keyInput = gale::key::keyboard::f11; break;
|
||||||
case 96: keyInput = gale::key::keyboard_f12; break;
|
case 96: keyInput = gale::key::keyboard::f12; break;
|
||||||
case 66: keyInput = gale::key::keyboard_capLock; m_guiKeyBoardMode.setCapsLock( (event.type == KeyPress) ? true : false); break;
|
case 66: keyInput = gale::key::keyboard::capLock; m_guiKeyBoardMode.setCapsLock( (event.type == KeyPress) ? true : false); break;
|
||||||
case 50: keyInput = gale::key::keyboard_shiftLeft; m_guiKeyBoardMode.setShift ( (event.type == KeyPress) ? true : false); break;
|
case 50: keyInput = gale::key::keyboard::shiftLeft; m_guiKeyBoardMode.setShift ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 62: keyInput = gale::key::keyboard_shiftRight; m_guiKeyBoardMode.setShift ( (event.type == KeyPress) ? true : false); break;
|
case 62: keyInput = gale::key::keyboard::shiftRight; m_guiKeyBoardMode.setShift ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 37: keyInput = gale::key::keyboard_ctrlLeft; m_guiKeyBoardMode.setCtrl ( (event.type == KeyPress) ? true : false); break;
|
case 37: keyInput = gale::key::keyboard::ctrlLeft; m_guiKeyBoardMode.setCtrl ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 105: keyInput = gale::key::keyboard_ctrlRight; m_guiKeyBoardMode.setCtrl ( (event.type == KeyPress) ? true : false); break;
|
case 105: keyInput = gale::key::keyboard::ctrlRight; m_guiKeyBoardMode.setCtrl ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 133: keyInput = gale::key::keyboard_metaLeft; m_guiKeyBoardMode.setMeta ( (event.type == KeyPress) ? true : false); break;
|
case 133: keyInput = gale::key::keyboard::metaLeft; m_guiKeyBoardMode.setMeta ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 134: keyInput = gale::key::keyboard_metaRight; m_guiKeyBoardMode.setMeta ( (event.type == KeyPress) ? true : false); break;
|
case 134: keyInput = gale::key::keyboard::metaRight; m_guiKeyBoardMode.setMeta ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 64: keyInput = gale::key::keyboard_alt; m_guiKeyBoardMode.setAlt ( (event.type == KeyPress) ? true : false); break;
|
case 64: keyInput = gale::key::keyboard::alt; m_guiKeyBoardMode.setAlt ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 108: keyInput = gale::key::keyboard_altGr; m_guiKeyBoardMode.setAltGr ( (event.type == KeyPress) ? true : false); break;
|
case 108: keyInput = gale::key::keyboard::altGr; m_guiKeyBoardMode.setAltGr ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 135: keyInput = gale::key::keyboard_contextMenu; break;
|
case 135: keyInput = gale::key::keyboard::contextMenu; break;
|
||||||
case 77: keyInput = gale::key::keyboard_numLock; m_guiKeyBoardMode.setNumLock ( (event.type == KeyPress) ? true : false); break;
|
case 77: keyInput = gale::key::keyboard::numLock; m_guiKeyBoardMode.setNumLock ( (event.type == KeyPress) ? true : false); break;
|
||||||
case 91: // Suppr on keypad
|
case 91: // Suppr on keypad
|
||||||
find = false;
|
find = false;
|
||||||
if(m_guiKeyBoardMode.getNumLock() == true){
|
if(m_guiKeyBoardMode.getNumLock() == true){
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type==KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
'.');
|
'.');
|
||||||
if (thisIsAReapeateKey == true) {
|
if (thisIsAReapeateKey == true) {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type!=KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
'.');
|
'.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type==KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
0x7F);
|
0x7F);
|
||||||
if (thisIsAReapeateKey == true) {
|
if (thisIsAReapeateKey == true) {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type!=KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
0x7F);
|
0x7F);
|
||||||
}
|
}
|
||||||
@ -680,14 +680,14 @@ class X11Interface : public gale::Context {
|
|||||||
case 23: // special case for TAB
|
case 23: // special case for TAB
|
||||||
find = false;
|
find = false;
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type==KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
0x09);
|
0x09);
|
||||||
if (thisIsAReapeateKey == true) {
|
if (thisIsAReapeateKey == true) {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type!=KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
0x09);
|
0x09);
|
||||||
}
|
}
|
||||||
@ -722,14 +722,14 @@ class X11Interface : public gale::Context {
|
|||||||
}
|
}
|
||||||
X11_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << m_lastKeyPressed);
|
X11_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << m_lastKeyPressed);
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type==KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
m_lastKeyPressed);
|
m_lastKeyPressed);
|
||||||
if (thisIsAReapeateKey == true) {
|
if (thisIsAReapeateKey == true) {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
gale::key::keyboard_char,
|
gale::key::keyboard::character,
|
||||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type!=KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey,
|
thisIsAReapeateKey,
|
||||||
m_lastKeyPressed);
|
m_lastKeyPressed);
|
||||||
}
|
}
|
||||||
@ -743,12 +743,12 @@ class X11Interface : public gale::Context {
|
|||||||
//GALE_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
//GALE_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
keyInput,
|
keyInput,
|
||||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type==KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey);
|
thisIsAReapeateKey);
|
||||||
if (thisIsAReapeateKey == true) {
|
if (thisIsAReapeateKey == true) {
|
||||||
OS_setKeyboard(m_guiKeyBoardMode,
|
OS_setKeyboard(m_guiKeyBoardMode,
|
||||||
keyInput,
|
keyInput,
|
||||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
(event.type!=KeyPress?gale::key::status::down:gale::key::status::up),
|
||||||
thisIsAReapeateKey);
|
thisIsAReapeateKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -824,7 +824,7 @@ class X11Interface : public gale::Context {
|
|||||||
m_currentCursor = _newCursor;
|
m_currentCursor = _newCursor;
|
||||||
Cursor myCursor = None;
|
Cursor myCursor = None;
|
||||||
switch (m_currentCursor) {
|
switch (m_currentCursor) {
|
||||||
case gale::context::cursor_none:
|
case gale::context::cursor::none:
|
||||||
{
|
{
|
||||||
Pixmap bitmapNoData;
|
Pixmap bitmapNoData;
|
||||||
XColor black;
|
XColor black;
|
||||||
@ -837,61 +837,61 @@ class X11Interface : public gale::Context {
|
|||||||
&black, &black, 0, 0);
|
&black, &black, 0, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_leftArrow:
|
case gale::context::cursor::leftArrow:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_top_left_arrow);
|
myCursor = XCreateFontCursor(m_display, XC_top_left_arrow);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_info:
|
case gale::context::cursor::info:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_hand1);
|
myCursor = XCreateFontCursor(m_display, XC_hand1);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_destroy:
|
case gale::context::cursor::destroy:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_pirate);
|
myCursor = XCreateFontCursor(m_display, XC_pirate);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_help:
|
case gale::context::cursor::help:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_question_arrow);
|
myCursor = XCreateFontCursor(m_display, XC_question_arrow);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_cycle:
|
case gale::context::cursor::cycle:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_exchange);
|
myCursor = XCreateFontCursor(m_display, XC_exchange);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_spray:
|
case gale::context::cursor::spray:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_spraycan);
|
myCursor = XCreateFontCursor(m_display, XC_spraycan);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_wait:
|
case gale::context::cursor::wait:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_watch);
|
myCursor = XCreateFontCursor(m_display, XC_watch);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_text:
|
case gale::context::cursor::text:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_xterm);
|
myCursor = XCreateFontCursor(m_display, XC_xterm);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_crossHair:
|
case gale::context::cursor::crossHair:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_crosshair);
|
myCursor = XCreateFontCursor(m_display, XC_crosshair);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_slideUpDown:
|
case gale::context::cursor::slideUpDown:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow);
|
myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_slideLeftRight:
|
case gale::context::cursor::slideLeftRight:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow);
|
myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_resizeUp:
|
case gale::context::cursor::resizeUp:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_top_side);
|
myCursor = XCreateFontCursor(m_display, XC_top_side);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_resizeDown:
|
case gale::context::cursor::resizeDown:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_bottom_side);
|
myCursor = XCreateFontCursor(m_display, XC_bottom_side);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_resizeLeft:
|
case gale::context::cursor::resizeLeft:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_left_side);
|
myCursor = XCreateFontCursor(m_display, XC_left_side);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_resizeRight:
|
case gale::context::cursor::resizeRight:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_right_side);
|
myCursor = XCreateFontCursor(m_display, XC_right_side);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_cornerTopLeft:
|
case gale::context::cursor::cornerTopLeft:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_top_left_corner);
|
myCursor = XCreateFontCursor(m_display, XC_top_left_corner);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_cornerTopRight:
|
case gale::context::cursor::cornerTopRight:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_top_right_corner);
|
myCursor = XCreateFontCursor(m_display, XC_top_right_corner);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_cornerButtomLeft:
|
case gale::context::cursor::cornerButtomLeft:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner);
|
myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner);
|
||||||
break;
|
break;
|
||||||
case gale::context::cursor_cornerButtomRight:
|
case gale::context::cursor::cornerButtomRight:
|
||||||
myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner);
|
myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
@ -974,7 +974,7 @@ class X11Interface : public gale::Context {
|
|||||||
// set the DPI for the current screen :
|
// set the DPI for the current screen :
|
||||||
gale::Dimension::setPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen),
|
gale::Dimension::setPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen),
|
||||||
(float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen)),
|
(float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen)),
|
||||||
gale::Dimension::Millimeter);
|
gale::distance::millimeter);
|
||||||
// get an appropriate visual
|
// get an appropriate visual
|
||||||
m_visual = glXChooseVisual(m_display, Xscreen, attrListDbl);
|
m_visual = glXChooseVisual(m_display, Xscreen, attrListDbl);
|
||||||
if (m_visual == nullptr) {
|
if (m_visual == nullptr) {
|
||||||
|
@ -35,9 +35,9 @@ static const char* clipboardDescriptionString[gale::context::clipBoard::clipboar
|
|||||||
"clipboardCount"
|
"clipboardCount"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::clipBoard::clipboardListe _obj) {
|
std::ostream& gale::operator <<(std::ostream& _os, enum gale::context::clipBoard::clipboardListe _obj) {
|
||||||
if (_obj >= 0 && _obj <gale::context::clipBoard::clipboardCount) {
|
if (_obj >= 0 && _obj <gale::context::clipBoard::clipboardCount) {
|
||||||
_os << clipboardDescriptionString[_obj];
|
_os << clipboardDescriptionString[int32_t(_obj)];
|
||||||
} else {
|
} else {
|
||||||
_os << "[ERROR]";
|
_os << "[ERROR]";
|
||||||
}
|
}
|
||||||
@ -46,14 +46,14 @@ std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::cli
|
|||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<enum gale::context::clipBoard::clipboardListe>(const enum gale::context::clipBoard::clipboardListe& _obj) {
|
template<> std::string to_string<enum gale::context::clipBoard::clipboardListe>(const enum gale::context::clipBoard::clipboardListe& _obj) {
|
||||||
return clipboardDescriptionString[_obj];
|
return clipboardDescriptionString[int32_t(_obj)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gale::context::clipBoard::init() {
|
void gale::context::clipBoard::init() {
|
||||||
GALE_INFO("Initialyse ClipBoards");
|
GALE_INFO("Initialyse ClipBoards");
|
||||||
for(int32_t i=0; i<gale::context::clipBoard::clipboardCount; i++) {
|
for(int32_t iii=0; iii<gale::context::clipBoard::clipboardCount; ++iii) {
|
||||||
myCopy[i].clear();
|
myCopy[iii].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,31 +7,31 @@
|
|||||||
#include <gale/context/cursor.h>
|
#include <gale/context/cursor.h>
|
||||||
|
|
||||||
static const char* cursorDescriptionString[] = {
|
static const char* cursorDescriptionString[] = {
|
||||||
"cursor_arrow",
|
"cursor::arrow",
|
||||||
"cursor_leftArrow",
|
"cursor::leftArrow",
|
||||||
"cursor_info",
|
"cursor::info",
|
||||||
"cursor_destroy",
|
"cursor::destroy",
|
||||||
"cursor_help",
|
"cursor::help",
|
||||||
"cursor_cycle",
|
"cursor::cycle",
|
||||||
"cursor_spray",
|
"cursor::spray",
|
||||||
"cursor_wait",
|
"cursor::wait",
|
||||||
"cursor_text",
|
"cursor::text",
|
||||||
"cursor_crossHair",
|
"cursor::crossHair",
|
||||||
"cursor_slideUpDown",
|
"cursor::slideUpDown",
|
||||||
"cursor_slideLeftRight",
|
"cursor::slideLeftRight",
|
||||||
"cursor_resizeUp",
|
"cursor::resizeUp",
|
||||||
"cursor_resizeDown",
|
"cursor::resizeDown",
|
||||||
"cursor_resizeLeft",
|
"cursor::resizeLeft",
|
||||||
"cursor_resizeRight",
|
"cursor::resizeRight",
|
||||||
"cursor_cornerTopLeft",
|
"cursor::cornerTopLeft",
|
||||||
"cursor_cornerTopRight",
|
"cursor::cornerTopRight",
|
||||||
"cursor_cornerButtomLeft",
|
"cursor::cornerButtomLeft",
|
||||||
"cursor_cornerButtomRight",
|
"cursor::cornerButtomRight",
|
||||||
"cursor_none"
|
"cursor::none"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::cursor _obj) {
|
std::ostream& gale::context::operator <<(std::ostream& _os, enum gale::context::cursor _obj) {
|
||||||
_os << cursorDescriptionString[_obj];
|
_os << cursorDescriptionString[int32_t(_obj)];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,33 +9,33 @@
|
|||||||
|
|
||||||
namespace gale {
|
namespace gale {
|
||||||
namespace context {
|
namespace context {
|
||||||
enum cursor {
|
enum class cursor {
|
||||||
cursor_arrow, // this is the normal arrow ...
|
arrow, // this is the normal arrow ...
|
||||||
cursor_leftArrow,
|
leftArrow,
|
||||||
cursor_info,
|
info,
|
||||||
cursor_destroy,
|
destroy,
|
||||||
cursor_help,
|
help,
|
||||||
cursor_cycle,
|
cycle,
|
||||||
cursor_spray,
|
spray,
|
||||||
cursor_wait,
|
wait,
|
||||||
cursor_text,
|
text,
|
||||||
cursor_crossHair,
|
crossHair,
|
||||||
cursor_slideUpDown, //!< change the position (slide) vertical
|
slideUpDown, //!< change the position (slide) vertical
|
||||||
cursor_slideLeftRight, //!< change the position (slide) horizontal
|
slideLeftRight, //!< change the position (slide) horizontal
|
||||||
cursor_resizeUp,
|
resizeUp,
|
||||||
cursor_resizeDown,
|
resizeDown,
|
||||||
cursor_resizeLeft,
|
resizeLeft,
|
||||||
cursor_resizeRight,
|
resizeRight,
|
||||||
cursor_cornerTopLeft,
|
cornerTopLeft,
|
||||||
cursor_cornerTopRight,
|
cornerTopRight,
|
||||||
cursor_cornerButtomLeft,
|
cornerButtomLeft,
|
||||||
cursor_cornerButtomRight,
|
cornerButtomRight,
|
||||||
cursor_none
|
none
|
||||||
};
|
};
|
||||||
};
|
/**
|
||||||
/**
|
* @brief Debug operator To display the curent element in a Human readable information
|
||||||
* @brief Debug operator To display the curent element in a Human readable information
|
*/
|
||||||
*/
|
std::ostream& operator <<(std::ostream& _os, enum gale::context::cursor _obj);
|
||||||
std::ostream& operator <<(std::ostream& _os, const enum gale::context::cursor _obj);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,31 +24,31 @@ gale::key::Special::Special() :
|
|||||||
}
|
}
|
||||||
void gale::key::Special::update(enum gale::key::keyboard _move, bool _isDown) {
|
void gale::key::Special::update(enum gale::key::keyboard _move, bool _isDown) {
|
||||||
switch (_move) {
|
switch (_move) {
|
||||||
case keyboard_insert:
|
case keyboard::insert:
|
||||||
setInsert(_isDown);
|
setInsert(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_capLock:
|
case keyboard::capLock:
|
||||||
setCapsLock(_isDown);
|
setCapsLock(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_shiftLeft:
|
case keyboard::shiftLeft:
|
||||||
case keyboard_shiftRight:
|
case keyboard::shiftRight:
|
||||||
setShift(_isDown);
|
setShift(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_ctrlLeft:
|
case keyboard::ctrlLeft:
|
||||||
case keyboard_ctrlRight:
|
case keyboard::ctrlRight:
|
||||||
setCtrl(_isDown);
|
setCtrl(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_metaLeft:
|
case keyboard::metaLeft:
|
||||||
case keyboard_metaRight:
|
case keyboard::metaRight:
|
||||||
setMeta(_isDown);
|
setMeta(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_alt:
|
case keyboard::alt:
|
||||||
setAlt(_isDown);
|
setAlt(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_altGr:
|
case keyboard::altGr:
|
||||||
setAltGr(_isDown);
|
setAltGr(_isDown);
|
||||||
break;
|
break;
|
||||||
case keyboard_numLock:
|
case keyboard::numLock:
|
||||||
setNumLock(_isDown);
|
setNumLock(_isDown);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -8,61 +8,61 @@
|
|||||||
#include <etk/stdTools.h>
|
#include <etk/stdTools.h>
|
||||||
|
|
||||||
static const char* keyboardDescriptionString[] = {
|
static const char* keyboardDescriptionString[] = {
|
||||||
"keyboard_unknow",
|
"keyboard::unknow",
|
||||||
"keyboard_char",
|
"keyboard::character",
|
||||||
"keyboard_left",
|
"keyboard::left",
|
||||||
"keyboard_right",
|
"keyboard::right",
|
||||||
"keyboard_up",
|
"keyboard::up",
|
||||||
"keyboard_down",
|
"keyboard::down",
|
||||||
"keyboard_pageUp",
|
"keyboard::pageUp",
|
||||||
"keyboard_pageDown",
|
"keyboard::pageDown",
|
||||||
"keyboard_start",
|
"keyboard::start",
|
||||||
"keyboard_end",
|
"keyboard::end",
|
||||||
"keyboard_print",
|
"keyboard::print",
|
||||||
"keyboard_stopDefil",
|
"keyboard::stopDefil",
|
||||||
"keyboard_wait",
|
"keyboard::wait",
|
||||||
"keyboard_insert",
|
"keyboard::insert",
|
||||||
"keyboard_f1",
|
"keyboard::f1",
|
||||||
"keyboard_f2",
|
"keyboard::f2",
|
||||||
"keyboard_f3",
|
"keyboard::f3",
|
||||||
"keyboard_f4",
|
"keyboard::f4",
|
||||||
"keyboard_f5",
|
"keyboard::f5",
|
||||||
"keyboard_f6",
|
"keyboard::f6",
|
||||||
"keyboard_f7",
|
"keyboard::f7",
|
||||||
"keyboard_f8",
|
"keyboard::f8",
|
||||||
"keyboard_f9",
|
"keyboard::f9",
|
||||||
"keyboard_f10",
|
"keyboard::f10",
|
||||||
"keyboard_f11",
|
"keyboard::f11",
|
||||||
"keyboard_f12",
|
"keyboard::f12",
|
||||||
"keyboard_capLock",
|
"keyboard::capLock",
|
||||||
"keyboard_shiftLeft",
|
"keyboard::shiftLeft",
|
||||||
"keyboard_shiftRight",
|
"keyboard::shiftRight",
|
||||||
"keyboard_ctrlLeft",
|
"keyboard::ctrlLeft",
|
||||||
"keyboard_ctrlRight",
|
"keyboard::ctrlRight",
|
||||||
"keyboard_metaLeft",
|
"keyboard::metaLeft",
|
||||||
"keyboard_metaRight",
|
"keyboard::metaRight",
|
||||||
"keyboard_alt",
|
"keyboard::alt",
|
||||||
"keyboard_altGr",
|
"keyboard::altGr",
|
||||||
"keyboard_contextMenu",
|
"keyboard::contextMenu",
|
||||||
"keyboard_numLock",
|
"keyboard::numLock",
|
||||||
// harware section:
|
// harware section:
|
||||||
"keyboard_volumeUp",
|
"keyboard::volumeUp",
|
||||||
"keyboard_volumeDown",
|
"keyboard::volumeDown",
|
||||||
"keyboard_menu",
|
"keyboard::menu",
|
||||||
"keyboard_camera",
|
"keyboard::camera",
|
||||||
"keyboard_home",
|
"keyboard::home",
|
||||||
"keyboard_power",
|
"keyboard::power",
|
||||||
"keyboard_back",
|
"keyboard::back",
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboard _obj) {
|
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboard _obj) {
|
||||||
_os << keyboardDescriptionString[_obj];
|
_os << keyboardDescriptionString[int32_t(_obj)];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<enum gale::key::keyboard>(const enum gale::key::keyboard& _obj) {
|
template<> std::string to_string<enum gale::key::keyboard>(const enum gale::key::keyboard& _obj) {
|
||||||
return keyboardDescriptionString[_obj];
|
return keyboardDescriptionString[int32_t(_obj)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,52 +13,52 @@ namespace gale {
|
|||||||
* @brief Keybord event or joystick event
|
* @brief Keybord event or joystick event
|
||||||
* @warning If you modify Id of these element check the java interface file of constant : GaleConstant.java
|
* @warning If you modify Id of these element check the java interface file of constant : GaleConstant.java
|
||||||
*/
|
*/
|
||||||
enum keyboard {
|
enum class keyboard {
|
||||||
keyboard_unknow = 0, //!< Unknown keyboard key
|
unknow = 0, //!< Unknown keyboard key
|
||||||
keyboard_char, //!< Char input is arrived ...
|
character, //!< Char input is arrived ...
|
||||||
keyboard_left, //!< Left key <--
|
left, //!< Left key <--
|
||||||
keyboard_right, //!< Right key -->
|
right, //!< Right key -->
|
||||||
keyboard_up, //!< Up key ^
|
up, //!< Up key ^
|
||||||
keyboard_down, //!< Down key \/
|
down, //!< Down key \/
|
||||||
keyboard_pageUp, //!< Page Up key
|
pageUp, //!< Page Up key
|
||||||
keyboard_pageDown, //!< page down key
|
pageDown, //!< page down key
|
||||||
keyboard_start, //!< Start key
|
start, //!< Start key
|
||||||
keyboard_end, //!< End key
|
end, //!< End key
|
||||||
keyboard_print, //!< print screen key.
|
print, //!< print screen key.
|
||||||
keyboard_stopDefil, //!< Stop display key.
|
stopDefil, //!< Stop display key.
|
||||||
keyboard_wait, //!< Wait key.
|
wait, //!< Wait key.
|
||||||
keyboard_insert, //!< insert key.
|
insert, //!< insert key.
|
||||||
keyboard_f1, //!< F1 key.
|
f1, //!< F1 key.
|
||||||
keyboard_f2, //!< F2 key.
|
f2, //!< F2 key.
|
||||||
keyboard_f3, //!< F3 key.
|
f3, //!< F3 key.
|
||||||
keyboard_f4, //!< F4 key.
|
f4, //!< F4 key.
|
||||||
keyboard_f5, //!< F5 key.
|
f5, //!< F5 key.
|
||||||
keyboard_f6, //!< F6 key.
|
f6, //!< F6 key.
|
||||||
keyboard_f7, //!< F7 key.
|
f7, //!< F7 key.
|
||||||
keyboard_f8, //!< F8 key.
|
f8, //!< F8 key.
|
||||||
keyboard_f9, //!< F9 key.
|
f9, //!< F9 key.
|
||||||
keyboard_f10, //!< F10 key.
|
f10, //!< F10 key.
|
||||||
keyboard_f11, //!< F11 key.
|
f11, //!< F11 key.
|
||||||
keyboard_f12, //!< F12 key.
|
f12, //!< F12 key.
|
||||||
keyboard_capLock, //!< Capital Letter Lock key.
|
capLock, //!< Capital Letter Lock key.
|
||||||
keyboard_shiftLeft, //!< Shift left key.
|
shiftLeft, //!< Shift left key.
|
||||||
keyboard_shiftRight, //!< Shift right key.
|
shiftRight, //!< Shift right key.
|
||||||
keyboard_ctrlLeft, //!< Control left key.
|
ctrlLeft, //!< Control left key.
|
||||||
keyboard_ctrlRight, //!< Control right key.
|
ctrlRight, //!< Control right key.
|
||||||
keyboard_metaLeft, //!< Meta left key (apple key or windows key).
|
metaLeft, //!< Meta left key (apple key or windows key).
|
||||||
keyboard_metaRight, //!< Meta right key (apple key or windows key).
|
metaRight, //!< Meta right key (apple key or windows key).
|
||||||
keyboard_alt, //!< Alt key.
|
alt, //!< Alt key.
|
||||||
keyboard_altGr, //!< Alt ground key.
|
altGr, //!< Alt ground key.
|
||||||
keyboard_contextMenu, //!< Contextual menu key.
|
contextMenu, //!< Contextual menu key.
|
||||||
keyboard_numLock, //!< Numerical Lock key
|
numLock, //!< Numerical Lock key
|
||||||
// harware section:
|
// harware section:
|
||||||
keyboard_volumeUp, //!< Hardware volume UP key
|
volumeUp, //!< Hardware volume UP key
|
||||||
keyboard_volumeDown, //!< Hardware volume DOWN key
|
volumeDown, //!< Hardware volume DOWN key
|
||||||
keyboard_menu, //!< Hardware Menu key
|
menu, //!< Hardware Menu key
|
||||||
keyboard_camera, //!< Hardware Camera key
|
camera, //!< Hardware Camera key
|
||||||
keyboard_home, //!< Hardware Home key
|
home, //!< Hardware Home key
|
||||||
keyboard_power, //!< Hardware Power key
|
power, //!< Hardware Power key
|
||||||
keyboard_back //!< Hardware Back key
|
back //!< Hardware Back key
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
|
@ -8,32 +8,32 @@
|
|||||||
#include <etk/stdTools.h>
|
#include <etk/stdTools.h>
|
||||||
|
|
||||||
static const char* statusDescriptionString[] = {
|
static const char* statusDescriptionString[] = {
|
||||||
"status_unknow",
|
"status::unknow",
|
||||||
"status_down",
|
"status::down",
|
||||||
"status_downRepeate",
|
"status::downRepeate",
|
||||||
"status_move",
|
"status::move",
|
||||||
"status_single",
|
"status::pressSingle",
|
||||||
"status_double",
|
"status::pressDouble",
|
||||||
"status_triple",
|
"status::pressTriple",
|
||||||
"status_quad",
|
"status::pressQuad",
|
||||||
"status_quinte",
|
"status::pressQuinte",
|
||||||
"status_up",
|
"status::up",
|
||||||
"status_upRepeate",
|
"status::upRepeate",
|
||||||
"status_upAfter",
|
"status::upAfter",
|
||||||
"status_enter",
|
"status::enter",
|
||||||
"status_leave",
|
"status::leave",
|
||||||
"status_abort",
|
"status::abort",
|
||||||
"status_transfert"
|
"status::transfert"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::status _obj) {
|
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::status _obj) {
|
||||||
_os << statusDescriptionString[_obj];
|
_os << statusDescriptionString[int32_t(_obj)];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<enum gale::key::status>(const enum gale::key::status& _obj) {
|
template<> std::string to_string<enum gale::key::status>(const enum gale::key::status& _obj) {
|
||||||
return statusDescriptionString[_obj];
|
return statusDescriptionString[int32_t(_obj)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,23 +12,23 @@ namespace gale {
|
|||||||
/**
|
/**
|
||||||
* @brief Keybord event or joyestick event
|
* @brief Keybord event or joyestick event
|
||||||
*/
|
*/
|
||||||
enum status {
|
enum class status {
|
||||||
status_unknow = 0,
|
unknow = 0,
|
||||||
status_down, // availlable on Keyboard too
|
down, // availlable on Keyboard too
|
||||||
status_downRepeate, // availlable on Keyboard too: the down event us in repeate cycle
|
downRepeate, // availlable on Keyboard too: the down event us in repeate cycle
|
||||||
status_move,
|
move,
|
||||||
status_single,
|
pressSingle,
|
||||||
status_double,
|
pressDouble,
|
||||||
status_triple,
|
pressTriple,
|
||||||
status_quad,
|
pressQuad,
|
||||||
status_quinte,
|
pressQuinte,
|
||||||
status_up, // availlable on Keyboard too
|
up, // availlable on Keyboard too
|
||||||
status_upRepeate, // availlable on Keyboard too: the up event us in repeate cycle
|
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...)
|
upAfter, // mouse input & finger input this appear after the single event (depending on some case...)
|
||||||
status_enter,
|
enter,
|
||||||
status_leave,
|
leave,
|
||||||
status_abort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
|
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)
|
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
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
|
@ -9,19 +9,19 @@
|
|||||||
|
|
||||||
|
|
||||||
static const char* typeDescriptionString[] = {
|
static const char* typeDescriptionString[] = {
|
||||||
"type_unknow",
|
"type::unknow",
|
||||||
"type_mouse",
|
"type::mouse",
|
||||||
"type_finger",
|
"type::finger",
|
||||||
"type_stylet"
|
"type::stylet"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::key::type _obj) {
|
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::type _obj) {
|
||||||
_os << typeDescriptionString[_obj];
|
_os << typeDescriptionString[int32_t(_obj)];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<enum gale::key::type>(const enum gale::key::type& _obj) {
|
template<> std::string to_string<enum gale::key::type>(const enum gale::key::type& _obj) {
|
||||||
return typeDescriptionString[_obj];
|
return typeDescriptionString[int32_t(_obj)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,16 @@ namespace gale {
|
|||||||
/**
|
/**
|
||||||
* @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different
|
* @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different
|
||||||
*/
|
*/
|
||||||
enum type {
|
enum class type {
|
||||||
type_unknow = 0, //!< Unknow input Type
|
unknow = 0, //!< Unknow input Type
|
||||||
type_mouse, //!< Mouse type
|
mouse, //!< Mouse type
|
||||||
type_finger, //!< Finger type
|
finger, //!< Finger type
|
||||||
type_stylet, //!< Stylet type
|
stylet, //!< Stylet type
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
|
*/
|
||||||
|
std::ostream& operator <<(std::ostream& _os, enum gale::key::type _obj);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
|
||||||
*/
|
|
||||||
std::ostream& operator <<(std::ostream& _os, const enum gale::key::type _obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
#include <gale/orientation.h>
|
#include <gale/orientation.h>
|
||||||
|
|
||||||
static const char* listValues[] = {
|
static const char* listValues[] = {
|
||||||
"orientation_screenAuto",
|
"orientation::screenAuto",
|
||||||
"orientation_screenLandscape",
|
"orientation::screenLandscape",
|
||||||
"orientation_screenPortrait"
|
"orientation::screenPortrait"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::orientation _obj) {
|
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::orientation _obj) {
|
||||||
_os << listValues[_obj];
|
_os << listValues[int32_t(_obj)];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace gale {
|
namespace gale {
|
||||||
enum orientation {
|
enum class orientation {
|
||||||
orientation_screenAuto = 0,
|
screenAuto = 0,
|
||||||
orientation_screenLandscape,
|
screenLandscape,
|
||||||
orientation_screenPortrait
|
screenPortrait
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream& _os, enum gale::orientation _obj);
|
std::ostream& operator <<(std::ostream& _os, enum gale::orientation _obj);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void gale::openGL::clear(uint32_t _flags) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, const enum openGL::flag& _obj) {
|
std::ostream& gale::openGL::operator <<(std::ostream& _os, enum gale::openGL::flag _obj) {
|
||||||
static std::vector<std::pair<enum openGL::flag, const char*>> list = {
|
static std::vector<std::pair<enum openGL::flag, const char*>> list = {
|
||||||
std::make_pair(openGL::flag_blend, "FLAG_BLEND"),
|
std::make_pair(openGL::flag_blend, "FLAG_BLEND"),
|
||||||
std::make_pair(openGL::flag_clipDistanceI, "FLAG_CLIP_DISTANCE_I"),
|
std::make_pair(openGL::flag_clipDistanceI, "FLAG_CLIP_DISTANCE_I"),
|
||||||
@ -336,16 +336,16 @@ std::ostream& gale::operator <<(std::ostream& _os, const enum openGL::flag& _obj
|
|||||||
|
|
||||||
std::vector<std::pair<enum gale::openGL::renderMode, std::string>>& getListRenderMode() {
|
std::vector<std::pair<enum gale::openGL::renderMode, std::string>>& getListRenderMode() {
|
||||||
static std::vector<std::pair<enum gale::openGL::renderMode, std::string>> list = {
|
static std::vector<std::pair<enum gale::openGL::renderMode, std::string>> list = {
|
||||||
std::make_pair(gale::openGL::render_point, "POINTS"),
|
std::make_pair(gale::openGL::renderMode::point, "POINTS"),
|
||||||
std::make_pair(gale::openGL::render_line, "LINES"),
|
std::make_pair(gale::openGL::renderMode::line, "LINES"),
|
||||||
std::make_pair(gale::openGL::render_lineStrip, "LINES_STRIP"),
|
std::make_pair(gale::openGL::renderMode::lineStrip, "LINES_STRIP"),
|
||||||
std::make_pair(gale::openGL::render_lineLoop, "LINE_LOOP"),
|
std::make_pair(gale::openGL::renderMode::lineLoop, "LINE_LOOP"),
|
||||||
std::make_pair(gale::openGL::render_triangle, "TRIANGLE"),
|
std::make_pair(gale::openGL::renderMode::triangle, "TRIANGLE"),
|
||||||
std::make_pair(gale::openGL::render_triangleStrip, "TRIANGLE_STRIP"),
|
std::make_pair(gale::openGL::renderMode::triangleStrip, "TRIANGLE_STRIP"),
|
||||||
std::make_pair(gale::openGL::render_triangleFan, "TRIANGLE_FAN"),
|
std::make_pair(gale::openGL::renderMode::triangleFan, "TRIANGLE_FAN"),
|
||||||
std::make_pair(gale::openGL::render_quad, "QUAD"),
|
std::make_pair(gale::openGL::renderMode::quad, "QUAD"),
|
||||||
std::make_pair(gale::openGL::render_quadStrip, "QUAD_STRIP"),
|
std::make_pair(gale::openGL::renderMode::quadStrip, "QUAD_STRIP"),
|
||||||
std::make_pair(gale::openGL::render_polygon, "POLYGON"),
|
std::make_pair(gale::openGL::renderMode::polygon, "POLYGON"),
|
||||||
};
|
};
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ namespace etk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GALE_WARNING("Can not parse : '" << _value << "' set Triangle default value");
|
GALE_WARNING("Can not parse : '" << _value << "' set Triangle default value");
|
||||||
_variableRet = gale::openGL::render_triangle;
|
_variableRet = gale::openGL::renderMode::triangle;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
template<> bool from_string<gale::openGL::renderMode>(gale::openGL::renderMode& _variableRet, const std::u32string& _value) {
|
template<> bool from_string<gale::openGL::renderMode>(gale::openGL::renderMode& _variableRet, const std::u32string& _value) {
|
||||||
@ -380,7 +380,7 @@ namespace etk {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& gale::operator <<(std::ostream& _os, const enum openGL::renderMode& _obj) {
|
std::ostream& gale::openGL::operator <<(std::ostream& _os, enum gale::openGL::renderMode _obj) {
|
||||||
_os << etk::to_string(_obj);
|
_os << etk::to_string(_obj);
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
@ -587,7 +587,7 @@ void gale::openGL::drawArrays(enum gale::openGL::renderMode _mode, int32_t _firs
|
|||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glDrawArrays(convertRenderMode[_mode], _first, _count);
|
glDrawArrays(convertRenderMode[uint32_t(_mode)], _first, _count);
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -601,7 +601,7 @@ void gale::openGL::drawElements(enum renderMode _mode, const std::vector<uint32_
|
|||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
//GALE_DEBUG("Request draw of " << indices.size() << "elements");
|
//GALE_DEBUG("Request draw of " << indices.size() << "elements");
|
||||||
glDrawElements(convertRenderMode[_mode], _indices.size(), GL_UNSIGNED_INT, &_indices[0]);
|
glDrawElements(convertRenderMode[uint32_t(_mode)], _indices.size(), GL_UNSIGNED_INT, &_indices[0]);
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -614,7 +614,7 @@ void gale::openGL::drawElements16(enum renderMode _mode, const std::vector<uint1
|
|||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glDrawElements(convertRenderMode[_mode], _indices.size(), GL_UNSIGNED_SHORT, &_indices[0]);
|
glDrawElements(convertRenderMode[uint32_t(_mode)], _indices.size(), GL_UNSIGNED_SHORT, &_indices[0]);
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -627,7 +627,7 @@ void gale::openGL::drawElements8(enum renderMode _mode, const std::vector<uint8_
|
|||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glDrawElements(convertRenderMode[_mode], _indices.size(), GL_UNSIGNED_BYTE, &_indices[0]);
|
glDrawElements(convertRenderMode[uint32_t(_mode)], _indices.size(), GL_UNSIGNED_BYTE, &_indices[0]);
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -744,7 +744,7 @@ bool gale::openGL::bufferData(size_t _size, const void* _data, enum gale::openGL
|
|||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glBufferData(GL_ARRAY_BUFFER, _size, _data, convertUsage[_usage]);
|
glBufferData(GL_ARRAY_BUFFER, _size, _data, convertUsage[uint32_t(_usage)]);
|
||||||
checkGlError("glBufferData", __LINE__);
|
checkGlError("glBufferData", __LINE__);
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
}
|
}
|
||||||
@ -774,7 +774,7 @@ static char l_bufferDisplayError[LOG_OGL_INTERNAL_BUFFER_LEN] = "";
|
|||||||
|
|
||||||
int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
||||||
GLuint shader = 0;
|
GLuint shader = 0;
|
||||||
if (_type == gale::openGL::shader::type_vertex) {
|
if (_type == gale::openGL::shader::type::vertex) {
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
@ -785,7 +785,7 @@ int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
|||||||
shader = count++;
|
shader = count++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (_type == gale::openGL::shader::type_fragment) {
|
} else if (_type == gale::openGL::shader::type::fragment) {
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
|
@ -151,17 +151,17 @@ namespace gale {
|
|||||||
flag_alphaTest = 1<<27, //!<
|
flag_alphaTest = 1<<27, //!<
|
||||||
flag_fog = 1<<28, //!<
|
flag_fog = 1<<28, //!<
|
||||||
};
|
};
|
||||||
enum renderMode {
|
enum class renderMode {
|
||||||
render_point,
|
point,
|
||||||
render_line,
|
line,
|
||||||
render_lineStrip, //!< Not supported in GALE (TODO : Later)
|
lineStrip, //!< Not supported in GALE (TODO : Later)
|
||||||
render_lineLoop,
|
lineLoop,
|
||||||
render_triangle,
|
triangle,
|
||||||
render_triangleStrip, //!< Not supported in GALE (TODO : Later)
|
triangleStrip, //!< Not supported in GALE (TODO : Later)
|
||||||
render_triangleFan, //!< Not supported in GALE (TODO : Later)
|
triangleFan, //!< Not supported in GALE (TODO : Later)
|
||||||
render_quad, //!< Not supported in OpenGL-ES2
|
quad, //!< Not supported in OpenGL-ES2
|
||||||
render_quadStrip, //!< Not supported in OpenGL-ES2
|
quadStrip, //!< Not supported in OpenGL-ES2
|
||||||
render_polygon //!< Not supported in OpenGL-ES2
|
polygon //!< Not supported in OpenGL-ES2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -207,18 +207,18 @@ namespace gale {
|
|||||||
bool genBuffers(std::vector<uint32_t>& _buffers);
|
bool genBuffers(std::vector<uint32_t>& _buffers);
|
||||||
bool deleteBuffers(std::vector<uint32_t>& _buffers);
|
bool deleteBuffers(std::vector<uint32_t>& _buffers);
|
||||||
bool bindBuffer(uint32_t _bufferId);
|
bool bindBuffer(uint32_t _bufferId);
|
||||||
enum usage {
|
enum class usage {
|
||||||
usage_streamDraw,
|
streamDraw,
|
||||||
usage_staticDraw,
|
staticDraw,
|
||||||
usage_dynamicDraw
|
dynamicDraw
|
||||||
};
|
};
|
||||||
bool bufferData(size_t _size, const void* _data, enum gale::openGL::usage _usage);
|
bool bufferData(size_t _size, const void* _data, enum gale::openGL::usage _usage);
|
||||||
bool unbindBuffer();
|
bool unbindBuffer();
|
||||||
/* Shader wrapping : */
|
/* Shader wrapping : */
|
||||||
namespace shader {
|
namespace shader {
|
||||||
enum type {
|
enum class type {
|
||||||
type_vertex,
|
vertex,
|
||||||
type_fragment
|
fragment
|
||||||
};
|
};
|
||||||
int64_t create(enum gale::openGL::shader::type _type);
|
int64_t create(enum gale::openGL::shader::type _type);
|
||||||
void remove(int64_t& _shader);
|
void remove(int64_t& _shader);
|
||||||
@ -232,8 +232,8 @@ namespace gale {
|
|||||||
int32_t getAttributeLocation(int64_t _prog, const std::string& _name);
|
int32_t getAttributeLocation(int64_t _prog, const std::string& _name);
|
||||||
int32_t getUniformLocation(int64_t _prog, const std::string& _name);
|
int32_t getUniformLocation(int64_t _prog, const std::string& _name);
|
||||||
};
|
};
|
||||||
};
|
std::ostream& operator <<(std::ostream& _os, enum openGL::flag _obj);
|
||||||
std::ostream& operator <<(std::ostream& _os, const enum openGL::flag& _obj);
|
std::ostream& operator <<(std::ostream& _os, enum openGL::renderMode _obj);
|
||||||
std::ostream& operator <<(std::ostream& _os, const enum openGL::renderMode& _obj);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,14 +254,14 @@ bool gale::resource::Program::updateContext() {
|
|||||||
// first attach vertex shader, and after fragment shader
|
// first attach vertex shader, and after fragment shader
|
||||||
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
|
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
|
||||||
if (nullptr != m_shaderList[iii]) {
|
if (nullptr != m_shaderList[iii]) {
|
||||||
if (m_shaderList[iii]->getShaderType() == gale::openGL::shader::type_vertex) {
|
if (m_shaderList[iii]->getShaderType() == gale::openGL::shader::type::vertex) {
|
||||||
gale::openGL::program::attach(m_program, m_shaderList[iii]->getGL_ID());
|
gale::openGL::program::attach(m_program, m_shaderList[iii]->getGL_ID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
|
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
|
||||||
if (nullptr != m_shaderList[iii]) {
|
if (nullptr != m_shaderList[iii]) {
|
||||||
if (m_shaderList[iii]->getShaderType() == gale::openGL::shader::type_fragment) {
|
if (m_shaderList[iii]->getShaderType() == gale::openGL::shader::type::fragment) {
|
||||||
gale::openGL::program::attach(m_program, m_shaderList[iii]->getGL_ID());
|
gale::openGL::program::attach(m_program, m_shaderList[iii]->getGL_ID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ gale::resource::Shader::Shader() :
|
|||||||
m_exist(false),
|
m_exist(false),
|
||||||
m_fileData(""),
|
m_fileData(""),
|
||||||
m_shader(-1),
|
m_shader(-1),
|
||||||
m_type(gale::openGL::shader::type_vertex) {
|
m_type(gale::openGL::shader::type::vertex) {
|
||||||
addResourceType("gale::Shader");
|
addResourceType("gale::Shader");
|
||||||
m_resourceLevel = 0;
|
m_resourceLevel = 0;
|
||||||
}
|
}
|
||||||
@ -29,9 +29,9 @@ void gale::resource::Shader::init(const std::string& _filename) {
|
|||||||
// load data from file "all the time ..."
|
// load data from file "all the time ..."
|
||||||
|
|
||||||
if (etk::end_with(m_name, ".frag") == true) {
|
if (etk::end_with(m_name, ".frag") == true) {
|
||||||
m_type = gale::openGL::shader::type_fragment;
|
m_type = gale::openGL::shader::type::fragment;
|
||||||
} else if (etk::end_with(m_name, ".vert") == true) {
|
} else if (etk::end_with(m_name, ".vert") == true) {
|
||||||
m_type = gale::openGL::shader::type_vertex;
|
m_type = gale::openGL::shader::type::vertex;
|
||||||
} else {
|
} else {
|
||||||
GALE_ERROR("File does not have extention \".vert\" for Vertex Shader or \".frag\" for Fragment Shader. but : \"" << m_name << "\"");
|
GALE_ERROR("File does not have extention \".vert\" for Vertex Shader or \".frag\" for Fragment Shader. but : \"" << m_name << "\"");
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ bool gale::resource::Shader::updateContext() {
|
|||||||
bool ret = gale::openGL::shader::compile(m_shader, m_fileData);
|
bool ret = gale::openGL::shader::compile(m_shader, m_fileData);
|
||||||
if (ret == false) {
|
if (ret == false) {
|
||||||
const char * tmpShaderType = "FRAGMENT SHADER";
|
const char * tmpShaderType = "FRAGMENT SHADER";
|
||||||
if (m_type == gale::openGL::shader::type_vertex){
|
if (m_type == gale::openGL::shader::type::vertex){
|
||||||
tmpShaderType = "VERTEX SHADER";
|
tmpShaderType = "VERTEX SHADER";
|
||||||
}
|
}
|
||||||
GALE_CRITICAL("Could not compile \"" << tmpShaderType << "\" name='" << m_name << "'");
|
GALE_CRITICAL("Could not compile \"" << tmpShaderType << "\" name='" << m_name << "'");
|
||||||
|
@ -41,8 +41,8 @@ gale::resource::Texture::Texture() :
|
|||||||
m_endPointSize(1,1),
|
m_endPointSize(1,1),
|
||||||
m_loaded(false),
|
m_loaded(false),
|
||||||
m_size(0,0),
|
m_size(0,0),
|
||||||
m_dataType(gale::resource::Texture::dataType_int16),
|
m_dataType(gale::resource::Texture::dataType::int16),
|
||||||
m_dataColorSpace(gale::resource::Texture::color_mono) {
|
m_dataColorSpace(gale::resource::Texture::color::mono) {
|
||||||
addResourceType("gale::compositing::Texture");
|
addResourceType("gale::compositing::Texture");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@ namespace gale {
|
|||||||
namespace resource {
|
namespace resource {
|
||||||
class Texture : public gale::Resource {
|
class Texture : public gale::Resource {
|
||||||
public:
|
public:
|
||||||
enum color {
|
enum class color {
|
||||||
color_mono = 0, //!< Monochrome color
|
mono = 0, //!< Monochrome color
|
||||||
color_rgb, //!< red/green/blue data
|
rgb, //!< red/green/blue data
|
||||||
color_rgba //!< red/green/blue/alpha data
|
rgba //!< red/green/blue/alpha data
|
||||||
};
|
};
|
||||||
enum dataType {
|
enum dataType {
|
||||||
dataType_int16 = 0, //!< Image data are stored on integer 16 bit for each element
|
int16 = 0, //!< Image data are stored on integer 16 bit for each element
|
||||||
dataType_float, //!< Image data are stored on flaoting point value on 32 bit for each element
|
float32, //!< Image data are stored on flaoting point value on 32 bit for each element
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
uint32_t m_texId; //!< openGl textureID.
|
uint32_t m_texId; //!< openGl textureID.
|
||||||
|
@ -51,7 +51,7 @@ bool gale::resource::VirtualBufferObject::updateContext() {
|
|||||||
// select the buffer to set data inside it ...
|
// select the buffer to set data inside it ...
|
||||||
if (m_buffer[iii].size()>0) {
|
if (m_buffer[iii].size()>0) {
|
||||||
gale::openGL::bindBuffer(m_vbo[iii]);
|
gale::openGL::bindBuffer(m_vbo[iii]);
|
||||||
gale::openGL::bufferData(sizeof(float)*m_buffer[iii].size(), &((m_buffer[iii])[0]), gale::openGL::usage_staticDraw);
|
gale::openGL::bufferData(sizeof(float)*m_buffer[iii].size(), &((m_buffer[iii])[0]), gale::openGL::usage::staticDraw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class MainApplication : public gale::Application {
|
|||||||
// color :
|
// color :
|
||||||
m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, color, 4*sizeof(float));
|
m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, color, 4*sizeof(float));
|
||||||
// Request the draw od the elements :
|
// Request the draw od the elements :
|
||||||
gale::openGL::drawArrays(gale::openGL::render_triangle, 0, 3 /*number of points*/);
|
gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, 3 /*number of points*/);
|
||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
// Restore context of matrix
|
// Restore context of matrix
|
||||||
gale::openGL::pop();
|
gale::openGL::pop();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user