Post by pinzgauer16 on Jul 17, 2014 0:45:21 GMT -8
hello, i have a problem with the GD.Tag. I tried to build the Game Simon from the gd2book_v0.pdf with C but if i touch the display the REG_TOUCH_TAG only returns 3 or 4 but anywhere on the screen and not on the 4 points from the game. So wich register must be set to get the 4 tags from the points and how can i found out, that my commands are working.
here's the CODE
void drawscreen(uint8_t pressed){
get_touch_input();
SSPwrite(RAM_DL + 4*0, CLEAR(1,1,1), FOUR_BYTE); //clear the screen
SSPwrite(RAM_DL + 4*1, CLEAR_TAG(0), FOUR_BYTE); //Clear the Tag
SSPwrite(RAM_DL + 4*2, POINT_SIZE(16*60), FOUR_BYTE); //Set size to value in () funktioniert
SSPwrite(RAM_DL + 4*3, BEGIN(POINTS), FOUR_BYTE); //Start the point draw funktioniert
SSPwrite(RAM_DL + 4*4, TAG(1), FOUR_BYTE); //Attach the tag value for the following graphics objects drawn on the screen
if (pressed == 1){
SSPwrite(RAM_DL + 4*5, COLOR_RGB(0x00,0x70,0x00) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*5, COLOR_RGB(0x33,0xFF,0x33) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*6, VERTEX2II((240-70),(136-70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*7, TAG(2), FOUR_BYTE);
if (pressed == 2){
SSPwrite(RAM_DL + 4*8, COLOR_RGB(0x70,0x00,0x00) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*8, COLOR_RGB(0xFF,0x33,0x33) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*9, VERTEX2II((240+70),(136-70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*10, TAG(3), FOUR_BYTE);
if (pressed == 3){
SSPwrite(RAM_DL + 4*11, COLOR_RGB(0x70,0x70,0x00) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*11, COLOR_RGB(0xFF,0xFF,0x33) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*12, VERTEX2II((240-70),(136+70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*13, TAG(4), FOUR_BYTE);
if (pressed == 4){
SSPwrite(RAM_DL + 4*14, COLOR_RGB(0x00,0x70,0x70) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*14, COLOR_RGB(0x33,0xFF,0xFF) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*15, VERTEX2II((240+70),(136+70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*16, TAG_MASK(0), FOUR_BYTE); //
SSPwrite(RAM_DL + 4*17, END, FOUR_BYTE); //End the point draw funktioniert
SSPwrite(RAM_DL + 4*18, DISPLAY, FOUR_BYTE); //End the display list (28 bytes used) funktioniert
SSPwrite(REG_DLSWAP, 0x00000001, FOUR_BYTE); //Make the display list active on the next frame funktioniert
}
here's the CODE
void drawscreen(uint8_t pressed){
get_touch_input();
SSPwrite(RAM_DL + 4*0, CLEAR(1,1,1), FOUR_BYTE); //clear the screen
SSPwrite(RAM_DL + 4*1, CLEAR_TAG(0), FOUR_BYTE); //Clear the Tag
SSPwrite(RAM_DL + 4*2, POINT_SIZE(16*60), FOUR_BYTE); //Set size to value in () funktioniert
SSPwrite(RAM_DL + 4*3, BEGIN(POINTS), FOUR_BYTE); //Start the point draw funktioniert
SSPwrite(RAM_DL + 4*4, TAG(1), FOUR_BYTE); //Attach the tag value for the following graphics objects drawn on the screen
if (pressed == 1){
SSPwrite(RAM_DL + 4*5, COLOR_RGB(0x00,0x70,0x00) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*5, COLOR_RGB(0x33,0xFF,0x33) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*6, VERTEX2II((240-70),(136-70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*7, TAG(2), FOUR_BYTE);
if (pressed == 2){
SSPwrite(RAM_DL + 4*8, COLOR_RGB(0x70,0x00,0x00) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*8, COLOR_RGB(0xFF,0x33,0x33) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*9, VERTEX2II((240+70),(136-70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*10, TAG(3), FOUR_BYTE);
if (pressed == 3){
SSPwrite(RAM_DL + 4*11, COLOR_RGB(0x70,0x70,0x00) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*11, COLOR_RGB(0xFF,0xFF,0x33) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*12, VERTEX2II((240-70),(136+70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*13, TAG(4), FOUR_BYTE);
if (pressed == 4){
SSPwrite(RAM_DL + 4*14, COLOR_RGB(0x00,0x70,0x70) , FOUR_BYTE);
}
else{
SSPwrite(RAM_DL + 4*14, COLOR_RGB(0x33,0xFF,0xFF) , FOUR_BYTE);
SSPwrite(RAM_DL + 4*15, VERTEX2II((240+70),(136+70),0,0), FOUR_BYTE);
}
SSPwrite(RAM_DL + 4*16, TAG_MASK(0), FOUR_BYTE); //
SSPwrite(RAM_DL + 4*17, END, FOUR_BYTE); //End the point draw funktioniert
SSPwrite(RAM_DL + 4*18, DISPLAY, FOUR_BYTE); //End the display list (28 bytes used) funktioniert
SSPwrite(REG_DLSWAP, 0x00000001, FOUR_BYTE); //Make the display list active on the next frame funktioniert
}