Skip to content
Snippets Groups Projects
Commit b8e63f4b authored by fortissBot's avatar fortissBot
Browse files

implement read and _is_noval functions for buttons, button value 2 is now...

implement read and _is_noval functions for buttons, button value 2 is now interpreted as NoVal in AF3, reset button values after reading for each clock
refs 7795
parent 45814a6c
No related branches found
No related tags found
No related merge requests found
......@@ -68,9 +68,23 @@ GEN_TYPE_boolean gp_terminated = false;
void gp_init() {
// important, since all btns are accessing the same method
if(gp_initialized) return;
// Initialize Joystick Inputs to 0
ie.btns.js1_ud = 0;
ie.btns.js2_lr = 0;
ie.btns.js2_ud = 0;
// Initialize Button inputs to NoVal
ie.btns.bt_tri = 2;
ie.btns.bt_cir = 2;
ie.btns.bt_x = 2;
ie.btns.bt_sqr = 2;
ie.btns.bt_l1 = 2;
ie.btns.bt_l2 = 2;
ie.btns.bt_r1 = 2;
ie.btns.bt_r2 = 2;
gp_initialized = true;
// TODO initialize...
}
void gp_term() {
......@@ -81,37 +95,110 @@ void gp_term() {
gp_is_running = false;
}
// readers
// readers: Return button values (1 is true, 0 is false, 2 is NoVal)
// important: Reset button values to NoVal after reading
GEN_TYPE_boolean gp_btn1_read() {
return ie.btns.bt_tri;
if (ie.btns.bt_tri == 1)
{
ie.btns.bt_tri = 2;
return 1;
}
else
{
ie.btns.bt_tri = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btn2_read() {
return ie.btns.bt_cir;
if (ie.btns.bt_cir == 1)
{
ie.btns.bt_cir = 2;
return 1;
}
else
{
ie.btns.bt_cir = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btn3_read() {
return ie.btns.bt_x;
if (ie.btns.bt_x == 1)
{
ie.btns.bt_x = 2;
return 1;
}
else
{
ie.btns.bt_x = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btn4_read() {
return ie.btns.bt_sqr;
if (ie.btns.bt_sqr == 1)
{
ie.btns.bt_sqr = 2;
return 1;
}
else
{
ie.btns.bt_sqr = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btnL1_read() {
return ie.btns.bt_l1;
if (ie.btns.bt_l1 == 1)
{
ie.btns.bt_l1 = 2;
return 1;
}
else
{
ie.btns.bt_l1 = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btnL2_read() {
return ie.btns.bt_l2;
if (ie.btns.bt_l2 == 1)
{
ie.btns.bt_l2 = 2;
return 1;
}
else
{
ie.btns.bt_l2 = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btnR1_read() {
return ie.btns.bt_r1;
if (ie.btns.bt_r1 == 1)
{
ie.btns.bt_r1 = 2;
return 1;
}
else
{
ie.btns.bt_r1 = 2;
return 0;
}
}
GEN_TYPE_boolean gp_btnR2_read() {
return ie.btns.bt_r2;
if (ie.btns.bt_r2 == 1)
{
ie.btns.bt_r2 = 2;
return 1;
}
else
{
ie.btns.bt_r2 = 2;
return 0;
}
}
GEN_TYPE_double gp_btnLX_read() {
......@@ -132,35 +219,43 @@ GEN_TYPE_double gp_btnRY_read() {
// noval
GEN_TYPE_boolean gp_btn1_is_noval() {
return false;
if (ie.btns.bt_tri == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btn2_is_noval() {
return false;
if (ie.btns.bt_cir == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btn3_is_noval() {
return false;
if (ie.btns.bt_x == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btn4_is_noval() {
return false;
if (ie.btns.bt_sqr == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btnL1_is_noval() {
return false;
if (ie.btns.bt_l1 == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btnL2_is_noval() {
return false;
if (ie.btns.bt_l2 == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btnR1_is_noval() {
return false;
if (ie.btns.bt_r1 == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btnR2_is_noval() {
return false;
if (ie.btns.bt_r2 == 2) return 1;
return 0;
}
GEN_TYPE_boolean gp_btnLX_is_noval() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment