2021-11-03 20:11:31 +08:00
|
|
|
#include "Arm2D_Element.h"
|
2021-10-05 09:49:52 +08:00
|
|
|
#include "Arm2D_common.h"
|
2021-11-03 20:11:31 +08:00
|
|
|
void Arm2D_Element_update(PikaObj* self) {
|
2021-10-05 09:49:52 +08:00
|
|
|
/* need to be override */
|
2021-11-03 20:11:31 +08:00
|
|
|
args_setErrorCode(self, 1);
|
|
|
|
args_setSysOut(self, "[error]: update method not be overrided !");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Arm2D_Element_init(PikaObj* self) {
|
2021-11-04 23:50:03 +08:00
|
|
|
pika_arm2d_element_info_t elemInfo = {0};
|
|
|
|
elemInfo.alpha = 255;
|
|
|
|
elemInfo.x = 0;
|
|
|
|
elemInfo.y = 0;
|
|
|
|
args_setStruct(self, "elemInfo", &elemInfo, sizeof(pika_arm2d_element_info_t));
|
2021-10-05 09:49:52 +08:00
|
|
|
}
|
|
|
|
|
2021-11-03 20:11:31 +08:00
|
|
|
void Arm2D_Element_setAlpha(PikaObj* self, int alpha) {
|
2021-11-04 23:50:03 +08:00
|
|
|
pika_arm2d_element_info_t* elemInfo = args_getStruct(self, "elemInfo");
|
|
|
|
elemInfo->alpha_last = elemInfo->alpha;
|
|
|
|
|
|
|
|
elemInfo->alpha = alpha;
|
2021-10-05 09:49:52 +08:00
|
|
|
}
|
|
|
|
|
2021-11-03 20:11:31 +08:00
|
|
|
void Arm2D_Element_up(PikaObj* self, int y) {
|
2021-11-04 23:50:03 +08:00
|
|
|
pika_arm2d_element_info_t* elemInfo = args_getStruct(self, "elemInfo");
|
|
|
|
elemInfo->y_last = elemInfo->y;
|
|
|
|
|
|
|
|
elemInfo->y = elemInfo->y - y;
|
2021-10-05 09:49:52 +08:00
|
|
|
}
|
|
|
|
|
2021-11-03 20:11:31 +08:00
|
|
|
void Arm2D_Element_down(PikaObj* self, int y) {
|
2021-11-04 23:50:03 +08:00
|
|
|
pika_arm2d_element_info_t* elemInfo = args_getStruct(self, "elemInfo");
|
|
|
|
elemInfo->y_last = elemInfo->y;
|
|
|
|
|
|
|
|
elemInfo->y = elemInfo->y + y;
|
2021-10-05 09:49:52 +08:00
|
|
|
}
|
|
|
|
|
2021-11-03 20:11:31 +08:00
|
|
|
void Arm2D_Element_lift(PikaObj* self, int x) {
|
2021-11-04 23:50:03 +08:00
|
|
|
pika_arm2d_element_info_t* elemInfo = args_getStruct(self, "elemInfo");
|
|
|
|
elemInfo->x_last = elemInfo->x;
|
2021-10-05 09:49:52 +08:00
|
|
|
|
2021-11-04 23:50:03 +08:00
|
|
|
elemInfo->x = elemInfo->x - x;
|
2021-10-05 09:49:52 +08:00
|
|
|
}
|
|
|
|
|
2021-11-03 20:11:31 +08:00
|
|
|
void Arm2D_Element_right(PikaObj* self, int x) {
|
2021-11-04 23:50:03 +08:00
|
|
|
pika_arm2d_element_info_t* elemInfo = args_getStruct(self, "elemInfo");
|
|
|
|
elemInfo->x_last = elemInfo->x;
|
|
|
|
|
|
|
|
elemInfo->x = elemInfo->x + x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Arm2D_Element_move(PikaObj* self, int x, int y) {
|
|
|
|
pika_arm2d_element_info_t* elemInfo = args_getStruct(self, "elemInfo");
|
|
|
|
elemInfo->y_last = elemInfo->y;
|
|
|
|
elemInfo->x_last = elemInfo->x;
|
|
|
|
|
|
|
|
elemInfo->x = x;
|
|
|
|
elemInfo->y = y;
|
2021-10-05 09:49:52 +08:00
|
|
|
}
|