Commits

blipi committed 42ac97a

v0.5.1
Added DEL button
Modifyed click speed
Added images, and PSD as well.

Comments (0)

Files changed (7)

Added
New image
Added
New image
Added
New image
Added
New image
Binary file added.
 		this->space = this->png_loader_f(path, this->texture_pointer);		
 		this->texture_pointer = this->space->texture_pointer;
 
+		sprintf(path, "%s/DEL.PNG", usrdir);
+		this->del = this->png_loader_f(path, this->texture_pointer);
+		this->del->width = 35.3333 + 35.3333/2;
+		this->del->height = 41.2444;		
+		this->texture_pointer = this->del->texture_pointer;
+
 		osk_loaded = 1;
 	}
 }
 		
 		sprintf(path, "%s/BTN.PNG", usrdir);
 		this->btn = (*this->png_loader)(path);
-		this->btn->width = 35.3333;
-		this->btn->height = 41.2444;
 
 		sprintf(path, "%s/SPACE.PNG", usrdir);
 		this->space = (*this->png_loader)(path);
+		
+		sprintf(path, "%s/DEL.PNG", usrdir);
+		this->del = (*this->png_loader)(path);
+		this->del->width = 35.3333 + 35.3333/2;
+		this->del->height = 41.2444;
 
 		osk_loaded = 1;
 	}
 
 	y = y0 = y0 + h + 10;
 
-	for(int i = 0; i < 4; i++){
+	for(int i = 0; i < 5; i++){
 		for(int n = 0; n < 10; n++){
 
-			this->btn->x = x;
-			this->btn->y = y;
+			if( i < 4){
+				this->btn->x = x;
+				this->btn->y = y;
 
-			if(this->png_displayer != NULL)
-				(*this->png_displayer)(this->btn);
-			else
-				this->png_displayer_f(this->btn);
+				if(this->png_displayer != NULL)
+					(*this->png_displayer)(this->btn);
+				else
+					this->png_displayer_f(this->btn);
 
-			if(this->sel_num == n && this->sel_row == i)
-				this->DrawBorders2D(0xFFFFFFFF, x, y, w-1, h, 3);
+				if(this->sel_num == n && this->sel_row == i)
+					this->DrawBorders2D(0xFFFFFFFF, x, y, w-1, h, 3);
 
-			if(this->font_slot >= 0)
-				DrawFormatString(x + w/2 - 18/2 + 3, y + h/2 - 20/2 - 5, "%c", key_array[this->mode][i][n]);
+				if(this->font_slot >= 0)
+					DrawFormatString(x + w/2 - 18/2 + 3, y + h/2 - 20/2 - 5, "%c", key_array[this->mode][i][n]);
 			
-			x += w + 5;
+				x += w + 5;
+
+				if(i == 0 && n == 9){
+					this->del->x = x + 5;
+					this->del->y = y;
+
+					if(this->png_displayer != NULL)
+						(*this->png_displayer)(this->del);
+					else
+						this->png_displayer_f(this->del);
+
+					if(this->sel_num == 10 && this->sel_row == 0)
+						this->DrawBorders2D(0xFFFFFFFF, x+5, y, this->del->width-1, this->del->height, 3);
+				}
+			}else{
+				//SPECIAL KEYS
+
+			}
 		}
 
 		x = x0 = x0 + w/2;
 					if(elapsed >= rblock.delay){
 						plusn = 1;
 						rblock.uval = cur_time;
-						rblock.delay = 300;
+						rblock.delay = 200;
 					}
 				}
 			}else
 					if(elapsed >= lblock.delay){
 						plusn = -1;
 						lblock.uval = cur_time;
-						lblock.delay = 300;
+						lblock.delay = 200;
 					}
 				}
 			}else
 					if(elapsed >= ublock.delay){
 						plusr = -1;
 						ublock.uval = cur_time;
-						ublock.delay = 300;
+						ublock.delay = 200;
 					}
 				}
 			}else
 					if(elapsed >= dblock.delay){
 						plusr = 1;
 						dblock.uval = cur_time;
-						dblock.delay = 300;
+						dblock.delay = 200;
 					}
 				}
 			}else
 						char buf[5];
 						sprintf(buf, "%c", key_array[this->mode][this->sel_row][this->sel_num]);
 						strcat(this->buffer, buf);
+					}else{
+						//Special cases
+						if(this->sel_row == 0 && this->sel_num == 10) //DEL
+							this->buffer[strlen(this->buffer)-1] = '\0';
+						
 					}
 
 					xblock.blocked = 1;
 							char buf[5];
 							sprintf(buf, "%c", key_array[this->mode][this->sel_row][this->sel_num]);
 							strcat(this->buffer, buf);
+						}else{
+							//Special cases
+							if(this->sel_row == 0 && this->sel_num == 10) //DEL
+								this->buffer[strlen(this->buffer)-1] = '\0';
+						
 						}
 
 						xblock.uval = cur_time;
-						xblock.delay = 300;
+						xblock.delay = 200;
 					}
 				}
 			}else
 			if(paddata.BTN_START){
 				this->status = OSK_RETURN;
 				//Callback
-			}
-
-			if(plusn != 0){
-				this->sel_num += plusn;
-
-				if(this->sel_num < 0)
-					this->sel_num = 9;
-				else if(this->sel_num >= 10)
-					this->sel_num = 0;
-			}
+			}	
 			
 			if(plusr != 0){
 				this->sel_row += plusr;
 					this->sel_row = 0;
 			}
 
+			if(plusn != 0){
+				this->sel_num += plusn;
+
+				if(this->sel_num < 0)
+					this->sel_num = 9;
+				else{
+					u8 max_num = ((this->sel_row==0)?11:10);
+
+					if(this->sel_num >= max_num)
+						this->sel_num = 0;
+				}
+			}
+
 			break; //Solo queremos el PAD 0
 		}		
 	}
 	osk_point pos;
 
 	_png_loader *btn;
+	_png_loader *del;
 	_png_loader *space;
 
 	u8 mode;