Lcd companion boards support (VKLCD50RTA & VKLCD70RT)
What is this ?
This is a demo program using Renesas RGA library & USB Camera to demonstrate VK-RZ/A1H's companion boards workability.
Supported companion Boards:
VKLCD50RTA
VKLCD70RT
How to Configure ?
You can choose which display is installed by altering the lcd_panel.h file
Leave the active one & comment out the others:
#define LCD_VDC5_CH0_PANEL LCD_CH0_PANEL_VKLCD50RTA //#define LCD_VDC5_CH0_PANEL LCD_CH0_PANEL_VKLCD70RT
You can alter the whole demo with your pictures if you like:
How to compile ?
- The Demo can be compiled in 3 modes:
- I. Execution from the internal 10-MB on-chip SRAM.
- II. Execution from the on-board serial FALSH in dual (32-MB) mode.
- After import in the online compiler just leave only the VKRZA1H_DOUBLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
- Drag & drop the result binary in MBED disk, (previously inited in double flash mode)
- III. Execution from the on-board serial FALSH in single (16-MB) mode.
- After import in the online compiler just leave only the VKRZA1H_SINGLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
- Drag & drop the result binary in MBED disk, (previously inited in single flash mode )
Quick presentation:
Other demos ?
More demos you can find on our FTP
RGA/rga_func.cpp@0:6435b67ad23c, 2017-02-16 (annotated)
- Committer:
- tvendov
- Date:
- Thu Feb 16 10:23:48 2017 +0000
- Revision:
- 0:6435b67ad23c
Initial lcd support (VKLCD50RTA & VKLCD70RT companion boards)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tvendov | 0:6435b67ad23c | 1 | /* |
tvendov | 0:6435b67ad23c | 2 | Permission is hereby granted, free of charge, to any person obtaining a copy |
tvendov | 0:6435b67ad23c | 3 | of this software and associated documentation files (the "Software"), to deal |
tvendov | 0:6435b67ad23c | 4 | in the Software without restriction, including without limitation the rights |
tvendov | 0:6435b67ad23c | 5 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
tvendov | 0:6435b67ad23c | 6 | copies of the Software, and to permit persons to whom the Software is |
tvendov | 0:6435b67ad23c | 7 | furnished to do so, subject to the following conditions: |
tvendov | 0:6435b67ad23c | 8 | |
tvendov | 0:6435b67ad23c | 9 | The above copyright notice and this permission notice shall be included in |
tvendov | 0:6435b67ad23c | 10 | all copies or substantial portions of the Software. |
tvendov | 0:6435b67ad23c | 11 | |
tvendov | 0:6435b67ad23c | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
tvendov | 0:6435b67ad23c | 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
tvendov | 0:6435b67ad23c | 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
tvendov | 0:6435b67ad23c | 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
tvendov | 0:6435b67ad23c | 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
tvendov | 0:6435b67ad23c | 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
tvendov | 0:6435b67ad23c | 18 | THE SOFTWARE. |
tvendov | 0:6435b67ad23c | 19 | */ |
tvendov | 0:6435b67ad23c | 20 | |
tvendov | 0:6435b67ad23c | 21 | #include "mbed.h" |
tvendov | 0:6435b67ad23c | 22 | #include "rga_func.h" |
tvendov | 0:6435b67ad23c | 23 | #include "Images/BinaryImage_RZ_A1H.h" |
tvendov | 0:6435b67ad23c | 24 | |
tvendov | 0:6435b67ad23c | 25 | #define ZOOM_SRC_CENTER_X (IMAGE_WIDTH_ZOOM_FUNC / 2) |
tvendov | 0:6435b67ad23c | 26 | #define ZOOM_SRC_CENTER_Y (IMAGE_HEIGHT_ZOOM_FUNC / 2) |
tvendov | 0:6435b67ad23c | 27 | |
tvendov | 0:6435b67ad23c | 28 | Canvas2D_ContextClass canvas2d; |
tvendov | 0:6435b67ad23c | 29 | |
tvendov | 0:6435b67ad23c | 30 | static animation_timing_function_t* accelerator; |
tvendov | 0:6435b67ad23c | 31 | |
tvendov | 0:6435b67ad23c | 32 | void Set_RGAObject(frame_buffer_t* frmbuf_info) { |
tvendov | 0:6435b67ad23c | 33 | errnum_t err; |
tvendov | 0:6435b67ad23c | 34 | Canvas2D_ContextConfigClass config; |
tvendov | 0:6435b67ad23c | 35 | |
tvendov | 0:6435b67ad23c | 36 | config.frame_buffer = frmbuf_info; |
tvendov | 0:6435b67ad23c | 37 | canvas2d = R_RGA_New_Canvas2D_ContextClass(config); |
tvendov | 0:6435b67ad23c | 38 | err = R_OSPL_GetErrNum(); |
tvendov | 0:6435b67ad23c | 39 | if (err != 0) { |
tvendov | 0:6435b67ad23c | 40 | printf("Line %d, error %d\n", __LINE__, err); |
tvendov | 0:6435b67ad23c | 41 | while (1); |
tvendov | 0:6435b67ad23c | 42 | } |
tvendov | 0:6435b67ad23c | 43 | } |
tvendov | 0:6435b67ad23c | 44 | |
tvendov | 0:6435b67ad23c | 45 | void RGA_Func_DrawFullScreen(frame_buffer_t* frmbuf_info, const graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 46 | |
tvendov | 0:6435b67ad23c | 47 | /* Draw a image */ |
tvendov | 0:6435b67ad23c | 48 | if(image) |
tvendov | 0:6435b67ad23c | 49 | canvas2d.drawImage(image, 0, 0); |
tvendov | 0:6435b67ad23c | 50 | else |
tvendov | 0:6435b67ad23c | 51 | { |
tvendov | 0:6435b67ad23c | 52 | /* Clear */ |
tvendov | 0:6435b67ad23c | 53 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 54 | //canvas2d.fillStyle = "#000000"; |
tvendov | 0:6435b67ad23c | 55 | //canvas2d.fillRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 56 | } |
tvendov | 0:6435b67ad23c | 57 | |
tvendov | 0:6435b67ad23c | 58 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 59 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 60 | } |
tvendov | 0:6435b67ad23c | 61 | |
tvendov | 0:6435b67ad23c | 62 | void RGA_Func_DrawPNG(frame_buffer_t* frmbuf_info, const graphics_image_t* png_img, int x, int y) { |
tvendov | 0:6435b67ad23c | 63 | /* Clear */ |
tvendov | 0:6435b67ad23c | 64 | //canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 65 | |
tvendov | 0:6435b67ad23c | 66 | /* Draw a image */ |
tvendov | 0:6435b67ad23c | 67 | if (frmbuf_info->pixel_format == PIXEL_FORMAT_RGB565) |
tvendov | 0:6435b67ad23c | 68 | canvas2d.drawImage(png_img, x, y); //png_ARGB4444 assumed |
tvendov | 0:6435b67ad23c | 69 | //else |
tvendov | 0:6435b67ad23c | 70 | // canvas2d.drawImage(png_img, x, y); |
tvendov | 0:6435b67ad23c | 71 | |
tvendov | 0:6435b67ad23c | 72 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 73 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 74 | } |
tvendov | 0:6435b67ad23c | 75 | |
tvendov | 0:6435b67ad23c | 76 | void RGA_Func_DrawCamScreen(uint8_t* cam_buffer) { |
tvendov | 0:6435b67ad23c | 77 | /* Clear */ |
tvendov | 0:6435b67ad23c | 78 | //if(cam_buffer) |
tvendov | 0:6435b67ad23c | 79 | //canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 80 | |
tvendov | 0:6435b67ad23c | 81 | /* Draw a image */ |
tvendov | 0:6435b67ad23c | 82 | if(cam_buffer) |
tvendov | 0:6435b67ad23c | 83 | canvas2d.drawImage((graphics_image_t*)cam_buffer, 0, 0); |
tvendov | 0:6435b67ad23c | 84 | |
tvendov | 0:6435b67ad23c | 85 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 86 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 87 | } |
tvendov | 0:6435b67ad23c | 88 | |
tvendov | 0:6435b67ad23c | 89 | #if (LCD_VDC5_CH0_PANEL == LCD_CH0_PANEL_VKLCD70RT) |
tvendov | 0:6435b67ad23c | 90 | |
tvendov | 0:6435b67ad23c | 91 | void RGA_Func_DrawRectangle(frame_buffer_t* frmbuf_info, draw_rectangle_pos_t * pos, int pos_num) { |
tvendov | 0:6435b67ad23c | 92 | int cnt; |
tvendov | 0:6435b67ad23c | 93 | |
tvendov | 0:6435b67ad23c | 94 | /* Clear */ |
tvendov | 0:6435b67ad23c | 95 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 96 | |
tvendov | 0:6435b67ad23c | 97 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 98 | canvas2d.drawImage(decs_swipe_jpg_File, 294, 530); |
tvendov | 0:6435b67ad23c | 99 | |
tvendov | 0:6435b67ad23c | 100 | /* Draw rectangle */ |
tvendov | 0:6435b67ad23c | 101 | for (cnt = 0; cnt < pos_num; cnt++) { |
tvendov | 0:6435b67ad23c | 102 | canvas2d.fillStyle = pos->style; |
tvendov | 0:6435b67ad23c | 103 | canvas2d.fillRect(pos->x, pos->y, pos->w, pos->h); |
tvendov | 0:6435b67ad23c | 104 | pos++; |
tvendov | 0:6435b67ad23c | 105 | } |
tvendov | 0:6435b67ad23c | 106 | |
tvendov | 0:6435b67ad23c | 107 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 108 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 109 | |
tvendov | 0:6435b67ad23c | 110 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 111 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 112 | } |
tvendov | 0:6435b67ad23c | 113 | |
tvendov | 0:6435b67ad23c | 114 | void RGA_Func_DrawImage(frame_buffer_t* frmbuf_info, int x, int y) { |
tvendov | 0:6435b67ad23c | 115 | int draw_pos_x = x - (CRYSTAL_DIAMETER / 2); |
tvendov | 0:6435b67ad23c | 116 | int draw_pos_y = y - (CRYSTAL_DIAMETER / 2); |
tvendov | 0:6435b67ad23c | 117 | |
tvendov | 0:6435b67ad23c | 118 | /* Clear */ |
tvendov | 0:6435b67ad23c | 119 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 120 | |
tvendov | 0:6435b67ad23c | 121 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 122 | canvas2d.drawImage(decs_board_jpg_File, 170, 55); |
tvendov | 0:6435b67ad23c | 123 | canvas2d.drawImage(decs_swipe_jpg_File, 294, 530); |
tvendov | 0:6435b67ad23c | 124 | |
tvendov | 0:6435b67ad23c | 125 | /* Draw the first image */ |
tvendov | 0:6435b67ad23c | 126 | canvas2d.drawImage(Board_jpg_File, 106, 140); |
tvendov | 0:6435b67ad23c | 127 | |
tvendov | 0:6435b67ad23c | 128 | /* Draw the second image */ |
tvendov | 0:6435b67ad23c | 129 | if ((frmbuf_info->pixel_format == PIXEL_FORMAT_ARGB8888) || (frmbuf_info->pixel_format == PIXEL_FORMAT_XRGB8888)) { |
tvendov | 0:6435b67ad23c | 130 | canvas2d.drawImage(Crystal_png_ARGB8888, draw_pos_x, draw_pos_y); |
tvendov | 0:6435b67ad23c | 131 | } else if (frmbuf_info->pixel_format != PIXEL_FORMAT_YUV422) { |
tvendov | 0:6435b67ad23c | 132 | canvas2d.drawImage(Crystal_png_ARGB4444, draw_pos_x, draw_pos_y); |
tvendov | 0:6435b67ad23c | 133 | } else { |
tvendov | 0:6435b67ad23c | 134 | canvas2d.drawImage(Crystal_png_File, draw_pos_x, draw_pos_y); |
tvendov | 0:6435b67ad23c | 135 | } |
tvendov | 0:6435b67ad23c | 136 | |
tvendov | 0:6435b67ad23c | 137 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 138 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 139 | |
tvendov | 0:6435b67ad23c | 140 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 141 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 142 | } |
tvendov | 0:6435b67ad23c | 143 | |
tvendov | 0:6435b67ad23c | 144 | void RGA_Func_Dissolve(frame_buffer_t* frmbuf_info, float32_t global_alpha, interact_t mode) { |
tvendov | 0:6435b67ad23c | 145 | /* Dissolve = Fade Out + Fade In */ |
tvendov | 0:6435b67ad23c | 146 | /* Clear */ |
tvendov | 0:6435b67ad23c | 147 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 148 | |
tvendov | 0:6435b67ad23c | 149 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 150 | canvas2d.drawImage(decs_board_jpg_File, 170, 55); |
tvendov | 0:6435b67ad23c | 151 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 152 | { |
tvendov | 0:6435b67ad23c | 153 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 154 | canvas2d.drawImage(decs_wait_jpg_File, 405, 530); |
tvendov | 0:6435b67ad23c | 155 | } |
tvendov | 0:6435b67ad23c | 156 | else |
tvendov | 0:6435b67ad23c | 157 | { |
tvendov | 0:6435b67ad23c | 158 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 159 | canvas2d.drawImage(decs_swipe_side_jpg_File, 180, 530); |
tvendov | 0:6435b67ad23c | 160 | } |
tvendov | 0:6435b67ad23c | 161 | |
tvendov | 0:6435b67ad23c | 162 | /* fade Out */ |
tvendov | 0:6435b67ad23c | 163 | canvas2d.globalAlpha = 1.0f - global_alpha; |
tvendov | 0:6435b67ad23c | 164 | canvas2d.drawImage(Board_jpg_File, 106, 140); |
tvendov | 0:6435b67ad23c | 165 | |
tvendov | 0:6435b67ad23c | 166 | /* fade In */ |
tvendov | 0:6435b67ad23c | 167 | canvas2d.globalAlpha = global_alpha; |
tvendov | 0:6435b67ad23c | 168 | canvas2d.fillStyle = "#FFFFFF"; |
tvendov | 0:6435b67ad23c | 169 | canvas2d.fillRect(106, 140, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 170 | |
tvendov | 0:6435b67ad23c | 171 | canvas2d.globalAlpha = 1.0f; |
tvendov | 0:6435b67ad23c | 172 | |
tvendov | 0:6435b67ad23c | 173 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 174 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 175 | |
tvendov | 0:6435b67ad23c | 176 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 177 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 178 | |
tvendov | 0:6435b67ad23c | 179 | } |
tvendov | 0:6435b67ad23c | 180 | |
tvendov | 0:6435b67ad23c | 181 | void RGA_Func_Diss(frame_buffer_t* frmbuf_info, float32_t global_alpha, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 182 | /* Dissolve = Fade Out + Fade In */ |
tvendov | 0:6435b67ad23c | 183 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 184 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 185 | |
tvendov | 0:6435b67ad23c | 186 | if(!crsr) |
tvendov | 0:6435b67ad23c | 187 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 188 | { |
tvendov | 0:6435b67ad23c | 189 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 190 | crsr = 2; |
tvendov | 0:6435b67ad23c | 191 | } |
tvendov | 0:6435b67ad23c | 192 | |
tvendov | 0:6435b67ad23c | 193 | if(crsr) |
tvendov | 0:6435b67ad23c | 194 | { |
tvendov | 0:6435b67ad23c | 195 | canvas2d.clearRect(0, 530, frmbuf_info->width, 44); |
tvendov | 0:6435b67ad23c | 196 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 197 | { |
tvendov | 0:6435b67ad23c | 198 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 199 | canvas2d.drawImage(decs_wait_jpg_File, 405, 530); |
tvendov | 0:6435b67ad23c | 200 | } |
tvendov | 0:6435b67ad23c | 201 | else |
tvendov | 0:6435b67ad23c | 202 | { |
tvendov | 0:6435b67ad23c | 203 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 204 | canvas2d.drawImage(decs_swipe_side_jpg_File, 180, 530); |
tvendov | 0:6435b67ad23c | 205 | } |
tvendov | 0:6435b67ad23c | 206 | |
tvendov | 0:6435b67ad23c | 207 | crsr--; |
tvendov | 0:6435b67ad23c | 208 | } |
tvendov | 0:6435b67ad23c | 209 | |
tvendov | 0:6435b67ad23c | 210 | /* fade Out */ |
tvendov | 0:6435b67ad23c | 211 | canvas2d.globalAlpha = 1.0f - global_alpha; |
tvendov | 0:6435b67ad23c | 212 | canvas2d.drawImage(image, 106, 140); |
tvendov | 0:6435b67ad23c | 213 | |
tvendov | 0:6435b67ad23c | 214 | /* fade In */ |
tvendov | 0:6435b67ad23c | 215 | canvas2d.globalAlpha = global_alpha; |
tvendov | 0:6435b67ad23c | 216 | canvas2d.fillStyle = "#FFFFFF"; |
tvendov | 0:6435b67ad23c | 217 | canvas2d.fillRect(106, 140, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 218 | |
tvendov | 0:6435b67ad23c | 219 | canvas2d.globalAlpha = 1.0f; |
tvendov | 0:6435b67ad23c | 220 | |
tvendov | 0:6435b67ad23c | 221 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 222 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 223 | } |
tvendov | 0:6435b67ad23c | 224 | |
tvendov | 0:6435b67ad23c | 225 | void RGA_Func_Scroll(frame_buffer_t* frmbuf_info, int src_width_pos, interact_t mode) { |
tvendov | 0:6435b67ad23c | 226 | /* Clear */ |
tvendov | 0:6435b67ad23c | 227 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 228 | |
tvendov | 0:6435b67ad23c | 229 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 230 | canvas2d.drawImage(decs_board_jpg_File, 170, 55); |
tvendov | 0:6435b67ad23c | 231 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 232 | { |
tvendov | 0:6435b67ad23c | 233 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 234 | canvas2d.drawImage(decs_wait_jpg_File, 405, 530); |
tvendov | 0:6435b67ad23c | 235 | } |
tvendov | 0:6435b67ad23c | 236 | else |
tvendov | 0:6435b67ad23c | 237 | { |
tvendov | 0:6435b67ad23c | 238 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 239 | canvas2d.drawImage(decs_swipe_side_jpg_File, 180, 530); |
tvendov | 0:6435b67ad23c | 240 | } |
tvendov | 0:6435b67ad23c | 241 | |
tvendov | 0:6435b67ad23c | 242 | /* Scroll from left to right */ |
tvendov | 0:6435b67ad23c | 243 | canvas2d.drawImage(Board_wide_jpg_File, |
tvendov | 0:6435b67ad23c | 244 | /* src */ src_width_pos, 0, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 245 | /* dst */ 106, 140, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 246 | |
tvendov | 0:6435b67ad23c | 247 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 248 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 249 | |
tvendov | 0:6435b67ad23c | 250 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 251 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 252 | } |
tvendov | 0:6435b67ad23c | 253 | |
tvendov | 0:6435b67ad23c | 254 | void RGA_Func_Scr(frame_buffer_t* frmbuf_info, int src_width_pos, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 255 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 256 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 257 | |
tvendov | 0:6435b67ad23c | 258 | if(!crsr) |
tvendov | 0:6435b67ad23c | 259 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 260 | { |
tvendov | 0:6435b67ad23c | 261 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 262 | crsr = 2; |
tvendov | 0:6435b67ad23c | 263 | } |
tvendov | 0:6435b67ad23c | 264 | |
tvendov | 0:6435b67ad23c | 265 | if(crsr) |
tvendov | 0:6435b67ad23c | 266 | { |
tvendov | 0:6435b67ad23c | 267 | canvas2d.clearRect(0, 530, frmbuf_info->width, 44); |
tvendov | 0:6435b67ad23c | 268 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 269 | { |
tvendov | 0:6435b67ad23c | 270 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 271 | canvas2d.drawImage(decs_wait_jpg_File, 405, 530); |
tvendov | 0:6435b67ad23c | 272 | } |
tvendov | 0:6435b67ad23c | 273 | else |
tvendov | 0:6435b67ad23c | 274 | { |
tvendov | 0:6435b67ad23c | 275 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 276 | canvas2d.drawImage(decs_swipe_side_jpg_File, 180, 530); |
tvendov | 0:6435b67ad23c | 277 | } |
tvendov | 0:6435b67ad23c | 278 | crsr--; |
tvendov | 0:6435b67ad23c | 279 | } |
tvendov | 0:6435b67ad23c | 280 | |
tvendov | 0:6435b67ad23c | 281 | /* Scroll from left to right */ |
tvendov | 0:6435b67ad23c | 282 | canvas2d.drawImage(image, |
tvendov | 0:6435b67ad23c | 283 | /* src */ src_width_pos, 0, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 284 | /* dst */ 106, 140, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 285 | |
tvendov | 0:6435b67ad23c | 286 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 287 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 288 | } |
tvendov | 0:6435b67ad23c | 289 | |
tvendov | 0:6435b67ad23c | 290 | void RGA_Func_Zoom(frame_buffer_t* frmbuf_info, int src_height_pos, interact_t mode) { |
tvendov | 0:6435b67ad23c | 291 | /* Clear */ |
tvendov | 0:6435b67ad23c | 292 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 293 | |
tvendov | 0:6435b67ad23c | 294 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 295 | canvas2d.drawImage(decs_board_jpg_File, 170, 55); |
tvendov | 0:6435b67ad23c | 296 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 297 | { |
tvendov | 0:6435b67ad23c | 298 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 299 | canvas2d.drawImage(decs_wait_jpg_File, 405, 530); |
tvendov | 0:6435b67ad23c | 300 | } |
tvendov | 0:6435b67ad23c | 301 | else |
tvendov | 0:6435b67ad23c | 302 | { |
tvendov | 0:6435b67ad23c | 303 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 304 | canvas2d.drawImage(decs_swipe_side_jpg_File, 180, 530); |
tvendov | 0:6435b67ad23c | 305 | } |
tvendov | 0:6435b67ad23c | 306 | |
tvendov | 0:6435b67ad23c | 307 | /* Zoom out */ |
tvendov | 0:6435b67ad23c | 308 | canvas2d.drawImage(Board_jpg_File, |
tvendov | 0:6435b67ad23c | 309 | /* src X */ ZOOM_SRC_CENTER_X - (src_height_pos * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT), |
tvendov | 0:6435b67ad23c | 310 | /* src Y */ ZOOM_SRC_CENTER_Y - src_height_pos, |
tvendov | 0:6435b67ad23c | 311 | /* src W */ src_height_pos * 2 * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 312 | /* src H */ src_height_pos * 2, |
tvendov | 0:6435b67ad23c | 313 | /* dst */ 106, 140, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 314 | |
tvendov | 0:6435b67ad23c | 315 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 316 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 317 | |
tvendov | 0:6435b67ad23c | 318 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 319 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 320 | } |
tvendov | 0:6435b67ad23c | 321 | |
tvendov | 0:6435b67ad23c | 322 | |
tvendov | 0:6435b67ad23c | 323 | void RGA_Func_Zo(frame_buffer_t* frmbuf_info, int src_height_pos, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 324 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 325 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 326 | |
tvendov | 0:6435b67ad23c | 327 | if(!crsr) |
tvendov | 0:6435b67ad23c | 328 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 329 | { |
tvendov | 0:6435b67ad23c | 330 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 331 | crsr = 2; |
tvendov | 0:6435b67ad23c | 332 | } |
tvendov | 0:6435b67ad23c | 333 | |
tvendov | 0:6435b67ad23c | 334 | if(crsr) |
tvendov | 0:6435b67ad23c | 335 | { |
tvendov | 0:6435b67ad23c | 336 | canvas2d.clearRect(0, 530, frmbuf_info->width, 44); |
tvendov | 0:6435b67ad23c | 337 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 338 | { |
tvendov | 0:6435b67ad23c | 339 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 340 | canvas2d.drawImage(decs_wait_jpg_File, 405, 530); |
tvendov | 0:6435b67ad23c | 341 | } |
tvendov | 0:6435b67ad23c | 342 | else |
tvendov | 0:6435b67ad23c | 343 | { |
tvendov | 0:6435b67ad23c | 344 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 345 | canvas2d.drawImage(decs_swipe_side_jpg_File, 180, 530); |
tvendov | 0:6435b67ad23c | 346 | } |
tvendov | 0:6435b67ad23c | 347 | crsr--; |
tvendov | 0:6435b67ad23c | 348 | } |
tvendov | 0:6435b67ad23c | 349 | |
tvendov | 0:6435b67ad23c | 350 | /* Zoom out */ |
tvendov | 0:6435b67ad23c | 351 | canvas2d.drawImage(image, |
tvendov | 0:6435b67ad23c | 352 | /* src X */ ZOOM_SRC_CENTER_X - (src_height_pos * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT), |
tvendov | 0:6435b67ad23c | 353 | /* src Y */ ZOOM_SRC_CENTER_Y - src_height_pos, |
tvendov | 0:6435b67ad23c | 354 | /* src W */ src_height_pos * 2 * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 355 | /* src H */ src_height_pos * 2, |
tvendov | 0:6435b67ad23c | 356 | /* dst */ 106, 140, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 357 | |
tvendov | 0:6435b67ad23c | 358 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 359 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 360 | } |
tvendov | 0:6435b67ad23c | 361 | |
tvendov | 0:6435b67ad23c | 362 | void RGA_Func_Rotation(frame_buffer_t* frmbuf_info, graphics_matrix_float_t image_angle, interact_t mode) { |
tvendov | 0:6435b67ad23c | 363 | /* Rotate the image to the right */ |
tvendov | 0:6435b67ad23c | 364 | /* Clear */ |
tvendov | 0:6435b67ad23c | 365 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 366 | |
tvendov | 0:6435b67ad23c | 367 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 368 | canvas2d.drawImage(decs_board_jpg_File, 650, 143); |
tvendov | 0:6435b67ad23c | 369 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 370 | { |
tvendov | 0:6435b67ad23c | 371 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 372 | canvas2d.drawImage(decs_wait_jpg_File, 704, 530); |
tvendov | 0:6435b67ad23c | 373 | } |
tvendov | 0:6435b67ad23c | 374 | else |
tvendov | 0:6435b67ad23c | 375 | { |
tvendov | 0:6435b67ad23c | 376 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 377 | canvas2d.drawImage(decs_swipe_side_jpg_File, 0, 0, 238, 42, 704, 397, 238, 42); |
tvendov | 0:6435b67ad23c | 378 | canvas2d.drawImage(decs_swipe_side_jpg_File, 241, 0, 198, 42, 714, 463, 198, 42); |
tvendov | 0:6435b67ad23c | 379 | canvas2d.drawImage(decs_swipe_side_jpg_File, 439, 0, 234, 42, 693, 530, 234, 42); |
tvendov | 0:6435b67ad23c | 380 | } |
tvendov | 0:6435b67ad23c | 381 | |
tvendov | 0:6435b67ad23c | 382 | /* Move to drawing position */ |
tvendov | 0:6435b67ad23c | 383 | canvas2d.translate((100 + (IMG_DRAW_WIDTH / 2)), (140 + (IMG_DRAW_HEIGHT / 2))); |
tvendov | 0:6435b67ad23c | 384 | |
tvendov | 0:6435b67ad23c | 385 | /* Rotate */ |
tvendov | 0:6435b67ad23c | 386 | canvas2d.rotate(image_angle * (3.14159 / 180)); |
tvendov | 0:6435b67ad23c | 387 | |
tvendov | 0:6435b67ad23c | 388 | /* Move to center to rotate */ |
tvendov | 0:6435b67ad23c | 389 | canvas2d.translate((-IMG_DRAW_WIDTH / 2), (-IMG_DRAW_HEIGHT / 2)); |
tvendov | 0:6435b67ad23c | 390 | canvas2d.drawImage(Board_jpg_File, 0, 0); |
tvendov | 0:6435b67ad23c | 391 | canvas2d.setTransform(1, 0, 0, 1, 0, 0); |
tvendov | 0:6435b67ad23c | 392 | |
tvendov | 0:6435b67ad23c | 393 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 394 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 395 | |
tvendov | 0:6435b67ad23c | 396 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 397 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 398 | } |
tvendov | 0:6435b67ad23c | 399 | |
tvendov | 0:6435b67ad23c | 400 | void RGA_Func_Rotor(frame_buffer_t* frmbuf_info, graphics_matrix_float_t image_angle, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 401 | /* Rotate the image to the right */ |
tvendov | 0:6435b67ad23c | 402 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 403 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 404 | |
tvendov | 0:6435b67ad23c | 405 | if(!crsr) |
tvendov | 0:6435b67ad23c | 406 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 407 | { |
tvendov | 0:6435b67ad23c | 408 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 409 | crsr = 2; |
tvendov | 0:6435b67ad23c | 410 | } |
tvendov | 0:6435b67ad23c | 411 | |
tvendov | 0:6435b67ad23c | 412 | if(crsr) |
tvendov | 0:6435b67ad23c | 413 | { |
tvendov | 0:6435b67ad23c | 414 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 415 | { |
tvendov | 0:6435b67ad23c | 416 | canvas2d.drawImage(ManualBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 417 | canvas2d.clearRect(704, 397, 341, 198); |
tvendov | 0:6435b67ad23c | 418 | canvas2d.drawImage(decs_wait_jpg_File, 704, 530); |
tvendov | 0:6435b67ad23c | 419 | } |
tvendov | 0:6435b67ad23c | 420 | else |
tvendov | 0:6435b67ad23c | 421 | { |
tvendov | 0:6435b67ad23c | 422 | canvas2d.drawImage(AutoBtn_jpg_File, 848, 230); |
tvendov | 0:6435b67ad23c | 423 | canvas2d.drawImage(decs_swipe_side_jpg_File, 0, 0, 238, 42, 704, 397, 238, 42); |
tvendov | 0:6435b67ad23c | 424 | canvas2d.drawImage(decs_swipe_side_jpg_File, 241, 0, 198, 42, 714, 463, 198, 42); |
tvendov | 0:6435b67ad23c | 425 | canvas2d.drawImage(decs_swipe_side_jpg_File, 439, 0, 234, 42, 693, 530, 234, 42); |
tvendov | 0:6435b67ad23c | 426 | } |
tvendov | 0:6435b67ad23c | 427 | crsr--; |
tvendov | 0:6435b67ad23c | 428 | } |
tvendov | 0:6435b67ad23c | 429 | |
tvendov | 0:6435b67ad23c | 430 | /* Clear [6ms] */ |
tvendov | 0:6435b67ad23c | 431 | canvas2d.clearRect(0, 0, 90+(IMG_DRAW_WIDTH / 2)+(frmbuf_info->height / 2), frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 432 | |
tvendov | 0:6435b67ad23c | 433 | /* Move to drawing position [1ms]*/ |
tvendov | 0:6435b67ad23c | 434 | canvas2d.translate((100 + (IMG_DRAW_WIDTH / 2)), (140 + (IMG_DRAW_HEIGHT / 2))); |
tvendov | 0:6435b67ad23c | 435 | |
tvendov | 0:6435b67ad23c | 436 | /* Rotate [2ms]*/ |
tvendov | 0:6435b67ad23c | 437 | canvas2d.rotate(image_angle * (3.14159 / 180)); |
tvendov | 0:6435b67ad23c | 438 | |
tvendov | 0:6435b67ad23c | 439 | /* Move to center to rotate [0,5 + 120 + 1ms]*/ |
tvendov | 0:6435b67ad23c | 440 | canvas2d.translate((-IMG_DRAW_WIDTH / 2), (-IMG_DRAW_HEIGHT / 2)); |
tvendov | 0:6435b67ad23c | 441 | canvas2d.drawImage(image, 0, 0); |
tvendov | 0:6435b67ad23c | 442 | canvas2d.setTransform(1, 0, 0, 1, 0, 0); |
tvendov | 0:6435b67ad23c | 443 | |
tvendov | 0:6435b67ad23c | 444 | /* Complete drawing [4ms]*/ |
tvendov | 0:6435b67ad23c | 445 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 446 | } |
tvendov | 0:6435b67ad23c | 447 | |
tvendov | 0:6435b67ad23c | 448 | void RGA_Func_Accelerate(frame_buffer_t* frmbuf_info, int animation_timing, float32_t relative_pos) { |
tvendov | 0:6435b67ad23c | 449 | /* Do accelerated motion from right to left */ |
tvendov | 0:6435b67ad23c | 450 | int position; |
tvendov | 0:6435b67ad23c | 451 | |
tvendov | 0:6435b67ad23c | 452 | /* Clear */ |
tvendov | 0:6435b67ad23c | 453 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 454 | |
tvendov | 0:6435b67ad23c | 455 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 456 | canvas2d.drawImage(decs_board_jpg_File, 170, 55); |
tvendov | 0:6435b67ad23c | 457 | |
tvendov | 0:6435b67ad23c | 458 | if (relative_pos == 0.0f) { |
tvendov | 0:6435b67ad23c | 459 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 460 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 461 | R_Get_AnimationTimingFunction("ease", &accelerator); |
tvendov | 0:6435b67ad23c | 462 | break; |
tvendov | 0:6435b67ad23c | 463 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 464 | R_Get_AnimationTimingFunction("linear", &accelerator); |
tvendov | 0:6435b67ad23c | 465 | break; |
tvendov | 0:6435b67ad23c | 466 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 467 | R_Get_AnimationTimingFunction("ease-in", &accelerator); |
tvendov | 0:6435b67ad23c | 468 | break; |
tvendov | 0:6435b67ad23c | 469 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 470 | R_Get_AnimationTimingFunction("ease-out", &accelerator); |
tvendov | 0:6435b67ad23c | 471 | break; |
tvendov | 0:6435b67ad23c | 472 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 473 | default: |
tvendov | 0:6435b67ad23c | 474 | R_Get_AnimationTimingFunction("ease-in-out", &accelerator); |
tvendov | 0:6435b67ad23c | 475 | break; |
tvendov | 0:6435b67ad23c | 476 | } |
tvendov | 0:6435b67ad23c | 477 | } |
tvendov | 0:6435b67ad23c | 478 | |
tvendov | 0:6435b67ad23c | 479 | /* Draw rectangle */ |
tvendov | 0:6435b67ad23c | 480 | canvas2d.fillStyle = "#0000FF"; /* blue */ |
tvendov | 0:6435b67ad23c | 481 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 482 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 483 | canvas2d.fillRect(21, 562, 173, 13); |
tvendov | 0:6435b67ad23c | 484 | break; |
tvendov | 0:6435b67ad23c | 485 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 486 | canvas2d.fillRect(220, 562, 173, 13); |
tvendov | 0:6435b67ad23c | 487 | break; |
tvendov | 0:6435b67ad23c | 488 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 489 | canvas2d.fillRect(422, 562, 173, 13); |
tvendov | 0:6435b67ad23c | 490 | break; |
tvendov | 0:6435b67ad23c | 491 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 492 | canvas2d.fillRect(623, 562, 173, 13); |
tvendov | 0:6435b67ad23c | 493 | break; |
tvendov | 0:6435b67ad23c | 494 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 495 | default: |
tvendov | 0:6435b67ad23c | 496 | canvas2d.fillRect(823, 562, 173, 13); |
tvendov | 0:6435b67ad23c | 497 | break; |
tvendov | 0:6435b67ad23c | 498 | } |
tvendov | 0:6435b67ad23c | 499 | |
tvendov | 0:6435b67ad23c | 500 | /* Draw button */ |
tvendov | 0:6435b67ad23c | 501 | canvas2d.drawImage(animetion_timing_jpg_File, 0, 496); |
tvendov | 0:6435b67ad23c | 502 | |
tvendov | 0:6435b67ad23c | 503 | position = R_ANIMATION_TIMING_FUNCTION_GetValue(accelerator, relative_pos, 505.0f, 6.0f); |
tvendov | 0:6435b67ad23c | 504 | canvas2d.drawImage(Board_jpg_File, position, 140); |
tvendov | 0:6435b67ad23c | 505 | |
tvendov | 0:6435b67ad23c | 506 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 507 | canvas2d.drawImage(RetBtn_jpg_File, 792, 6); |
tvendov | 0:6435b67ad23c | 508 | |
tvendov | 0:6435b67ad23c | 509 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 510 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 511 | } |
tvendov | 0:6435b67ad23c | 512 | |
tvendov | 0:6435b67ad23c | 513 | void RGA_Func_Axel(frame_buffer_t* frmbuf_info, int animation_timing, float32_t relative_pos, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 514 | /* Do accelerated motion from right to left */ |
tvendov | 0:6435b67ad23c | 515 | static int prv_timing = animation_timing; |
tvendov | 0:6435b67ad23c | 516 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 517 | int position; |
tvendov | 0:6435b67ad23c | 518 | |
tvendov | 0:6435b67ad23c | 519 | /* Clear */ |
tvendov | 0:6435b67ad23c | 520 | canvas2d.clearRect(0, 140, frmbuf_info->width, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 521 | |
tvendov | 0:6435b67ad23c | 522 | if (relative_pos == 0.0f) { |
tvendov | 0:6435b67ad23c | 523 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 524 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 525 | R_Get_AnimationTimingFunction("ease", &accelerator); |
tvendov | 0:6435b67ad23c | 526 | break; |
tvendov | 0:6435b67ad23c | 527 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 528 | R_Get_AnimationTimingFunction("linear", &accelerator); |
tvendov | 0:6435b67ad23c | 529 | break; |
tvendov | 0:6435b67ad23c | 530 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 531 | R_Get_AnimationTimingFunction("ease-in", &accelerator); |
tvendov | 0:6435b67ad23c | 532 | break; |
tvendov | 0:6435b67ad23c | 533 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 534 | R_Get_AnimationTimingFunction("ease-out", &accelerator); |
tvendov | 0:6435b67ad23c | 535 | break; |
tvendov | 0:6435b67ad23c | 536 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 537 | default: |
tvendov | 0:6435b67ad23c | 538 | R_Get_AnimationTimingFunction("ease-in-out", &accelerator); |
tvendov | 0:6435b67ad23c | 539 | break; |
tvendov | 0:6435b67ad23c | 540 | } |
tvendov | 0:6435b67ad23c | 541 | if(prv_timing != animation_timing) |
tvendov | 0:6435b67ad23c | 542 | { |
tvendov | 0:6435b67ad23c | 543 | prv_timing = animation_timing; |
tvendov | 0:6435b67ad23c | 544 | crsr = 2; |
tvendov | 0:6435b67ad23c | 545 | } |
tvendov | 0:6435b67ad23c | 546 | } |
tvendov | 0:6435b67ad23c | 547 | |
tvendov | 0:6435b67ad23c | 548 | /* Draw rectangle */ |
tvendov | 0:6435b67ad23c | 549 | canvas2d.fillStyle = "#0000FF"; /* blue */ |
tvendov | 0:6435b67ad23c | 550 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 551 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 552 | if(crsr) |
tvendov | 0:6435b67ad23c | 553 | { |
tvendov | 0:6435b67ad23c | 554 | canvas2d.clearRect(0, 563, frmbuf_info->width, 13); |
tvendov | 0:6435b67ad23c | 555 | canvas2d.fillRect(21, 563, 173, 13); |
tvendov | 0:6435b67ad23c | 556 | } |
tvendov | 0:6435b67ad23c | 557 | break; |
tvendov | 0:6435b67ad23c | 558 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 559 | if(crsr) |
tvendov | 0:6435b67ad23c | 560 | { |
tvendov | 0:6435b67ad23c | 561 | canvas2d.clearRect(0, 563, frmbuf_info->width, 13); |
tvendov | 0:6435b67ad23c | 562 | canvas2d.fillRect(220, 563, 173, 13); |
tvendov | 0:6435b67ad23c | 563 | } |
tvendov | 0:6435b67ad23c | 564 | break; |
tvendov | 0:6435b67ad23c | 565 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 566 | if(crsr) |
tvendov | 0:6435b67ad23c | 567 | { |
tvendov | 0:6435b67ad23c | 568 | canvas2d.clearRect(0, 563, frmbuf_info->width, 13); |
tvendov | 0:6435b67ad23c | 569 | canvas2d.fillRect(422, 563, 173, 13); |
tvendov | 0:6435b67ad23c | 570 | } |
tvendov | 0:6435b67ad23c | 571 | break; |
tvendov | 0:6435b67ad23c | 572 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 573 | if(crsr) |
tvendov | 0:6435b67ad23c | 574 | { |
tvendov | 0:6435b67ad23c | 575 | canvas2d.clearRect(0, 563, frmbuf_info->width, 13); |
tvendov | 0:6435b67ad23c | 576 | canvas2d.fillRect(623, 563, 173, 13); |
tvendov | 0:6435b67ad23c | 577 | } |
tvendov | 0:6435b67ad23c | 578 | break; |
tvendov | 0:6435b67ad23c | 579 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 580 | default: |
tvendov | 0:6435b67ad23c | 581 | if(crsr) |
tvendov | 0:6435b67ad23c | 582 | { |
tvendov | 0:6435b67ad23c | 583 | canvas2d.clearRect(0, 563, frmbuf_info->width, 13); |
tvendov | 0:6435b67ad23c | 584 | canvas2d.fillRect(823, 563, 173, 13); |
tvendov | 0:6435b67ad23c | 585 | } |
tvendov | 0:6435b67ad23c | 586 | break; |
tvendov | 0:6435b67ad23c | 587 | } |
tvendov | 0:6435b67ad23c | 588 | |
tvendov | 0:6435b67ad23c | 589 | /* Draw button */ |
tvendov | 0:6435b67ad23c | 590 | if(crsr) |
tvendov | 0:6435b67ad23c | 591 | { |
tvendov | 0:6435b67ad23c | 592 | canvas2d.drawImage(animetion_timing_jpg_File, 0, 496); |
tvendov | 0:6435b67ad23c | 593 | crsr--; |
tvendov | 0:6435b67ad23c | 594 | } |
tvendov | 0:6435b67ad23c | 595 | |
tvendov | 0:6435b67ad23c | 596 | position = R_ANIMATION_TIMING_FUNCTION_GetValue(accelerator, relative_pos, 505.0f, 6.0f); |
tvendov | 0:6435b67ad23c | 597 | canvas2d.drawImage(image, position, 140); |
tvendov | 0:6435b67ad23c | 598 | |
tvendov | 0:6435b67ad23c | 599 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 600 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 601 | } |
tvendov | 0:6435b67ad23c | 602 | |
tvendov | 0:6435b67ad23c | 603 | bool RGA_Func_CheckPorts(frame_buffer_t* frmbuf_info, bool rca_pluged, bool usb_pluged) { |
tvendov | 0:6435b67ad23c | 604 | static bool rca_visible = false; |
tvendov | 0:6435b67ad23c | 605 | static bool usb_visible = false; |
tvendov | 0:6435b67ad23c | 606 | bool rca_changed = false; |
tvendov | 0:6435b67ad23c | 607 | bool usb_changed = false; |
tvendov | 0:6435b67ad23c | 608 | |
tvendov | 0:6435b67ad23c | 609 | /* Detect Change in ports status */ |
tvendov | 0:6435b67ad23c | 610 | if(rca_pluged ^ rca_visible) |
tvendov | 0:6435b67ad23c | 611 | { |
tvendov | 0:6435b67ad23c | 612 | rca_visible = rca_pluged; |
tvendov | 0:6435b67ad23c | 613 | rca_changed = true; |
tvendov | 0:6435b67ad23c | 614 | } |
tvendov | 0:6435b67ad23c | 615 | |
tvendov | 0:6435b67ad23c | 616 | if(usb_pluged ^ usb_visible) |
tvendov | 0:6435b67ad23c | 617 | { |
tvendov | 0:6435b67ad23c | 618 | usb_visible = usb_pluged; |
tvendov | 0:6435b67ad23c | 619 | usb_changed = true; |
tvendov | 0:6435b67ad23c | 620 | } |
tvendov | 0:6435b67ad23c | 621 | |
tvendov | 0:6435b67ad23c | 622 | if(rca_changed | usb_changed) |
tvendov | 0:6435b67ad23c | 623 | { |
tvendov | 0:6435b67ad23c | 624 | frmbuf_info->draw_buffer_index = (frmbuf_info->draw_buffer_index)? 0 : 1; |
tvendov | 0:6435b67ad23c | 625 | |
tvendov | 0:6435b67ad23c | 626 | /* Draw a image Clear */ |
tvendov | 0:6435b67ad23c | 627 | canvas2d.drawImage(TopScrn_jpg_File, 0, 0); |
tvendov | 0:6435b67ad23c | 628 | |
tvendov | 0:6435b67ad23c | 629 | if(rca_visible) |
tvendov | 0:6435b67ad23c | 630 | canvas2d.drawImage(RCA_jpg_File, (frmbuf_info->width/2)-160, 50); |
tvendov | 0:6435b67ad23c | 631 | |
tvendov | 0:6435b67ad23c | 632 | if(usb_visible) |
tvendov | 0:6435b67ad23c | 633 | canvas2d.drawImage(Usb_jpg_File, frmbuf_info->width-100, (frmbuf_info->height/2)-73); |
tvendov | 0:6435b67ad23c | 634 | |
tvendov | 0:6435b67ad23c | 635 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 636 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 637 | } |
tvendov | 0:6435b67ad23c | 638 | |
tvendov | 0:6435b67ad23c | 639 | return (rca_changed | usb_changed); |
tvendov | 0:6435b67ad23c | 640 | } |
tvendov | 0:6435b67ad23c | 641 | #else |
tvendov | 0:6435b67ad23c | 642 | |
tvendov | 0:6435b67ad23c | 643 | void RGA_Func_DrawRectangle(frame_buffer_t* frmbuf_info, draw_rectangle_pos_t * pos, int pos_num) { |
tvendov | 0:6435b67ad23c | 644 | int cnt; |
tvendov | 0:6435b67ad23c | 645 | |
tvendov | 0:6435b67ad23c | 646 | /* Clear */ |
tvendov | 0:6435b67ad23c | 647 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 648 | |
tvendov | 0:6435b67ad23c | 649 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 650 | canvas2d.drawImage(decs_swipe_jpg_File, 138, 240); |
tvendov | 0:6435b67ad23c | 651 | |
tvendov | 0:6435b67ad23c | 652 | /* Draw rectangle */ |
tvendov | 0:6435b67ad23c | 653 | for (cnt = 0; cnt < pos_num; cnt++) { |
tvendov | 0:6435b67ad23c | 654 | canvas2d.fillStyle = pos->style; |
tvendov | 0:6435b67ad23c | 655 | canvas2d.fillRect(pos->x, pos->y, pos->w, pos->h); |
tvendov | 0:6435b67ad23c | 656 | pos++; |
tvendov | 0:6435b67ad23c | 657 | } |
tvendov | 0:6435b67ad23c | 658 | |
tvendov | 0:6435b67ad23c | 659 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 660 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 661 | |
tvendov | 0:6435b67ad23c | 662 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 663 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 664 | } |
tvendov | 0:6435b67ad23c | 665 | |
tvendov | 0:6435b67ad23c | 666 | void RGA_Func_DrawImage(frame_buffer_t* frmbuf_info, int x, int y) { |
tvendov | 0:6435b67ad23c | 667 | int draw_pos_x = x - (CRYSTAL_DIAMETER / 2); |
tvendov | 0:6435b67ad23c | 668 | int draw_pos_y = y - (CRYSTAL_DIAMETER / 2); |
tvendov | 0:6435b67ad23c | 669 | |
tvendov | 0:6435b67ad23c | 670 | /* Clear */ |
tvendov | 0:6435b67ad23c | 671 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 672 | |
tvendov | 0:6435b67ad23c | 673 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 674 | canvas2d.drawImage(decs_board_jpg_File, 80, 25); |
tvendov | 0:6435b67ad23c | 675 | canvas2d.drawImage(decs_swipe_jpg_File, 138, 240); |
tvendov | 0:6435b67ad23c | 676 | |
tvendov | 0:6435b67ad23c | 677 | /* Draw the first image */ |
tvendov | 0:6435b67ad23c | 678 | canvas2d.drawImage(Board_jpg_File, 50, 65); |
tvendov | 0:6435b67ad23c | 679 | |
tvendov | 0:6435b67ad23c | 680 | /* Draw the second image */ |
tvendov | 0:6435b67ad23c | 681 | if ((frmbuf_info->pixel_format == PIXEL_FORMAT_ARGB8888) || (frmbuf_info->pixel_format == PIXEL_FORMAT_XRGB8888)) { |
tvendov | 0:6435b67ad23c | 682 | canvas2d.drawImage(Crystal_png_ARGB8888, draw_pos_x, draw_pos_y); |
tvendov | 0:6435b67ad23c | 683 | } else if (frmbuf_info->pixel_format != PIXEL_FORMAT_YUV422) { |
tvendov | 0:6435b67ad23c | 684 | canvas2d.drawImage(Crystal_png_ARGB4444, draw_pos_x, draw_pos_y); |
tvendov | 0:6435b67ad23c | 685 | } else { |
tvendov | 0:6435b67ad23c | 686 | canvas2d.drawImage(Crystal_png_File, draw_pos_x, draw_pos_y); |
tvendov | 0:6435b67ad23c | 687 | } |
tvendov | 0:6435b67ad23c | 688 | |
tvendov | 0:6435b67ad23c | 689 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 690 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 691 | |
tvendov | 0:6435b67ad23c | 692 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 693 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 694 | } |
tvendov | 0:6435b67ad23c | 695 | |
tvendov | 0:6435b67ad23c | 696 | void RGA_Func_Dissolve(frame_buffer_t* frmbuf_info, float32_t global_alpha, interact_t mode) { |
tvendov | 0:6435b67ad23c | 697 | /* Dissolve = Fade Out + Fade In */ |
tvendov | 0:6435b67ad23c | 698 | /* Clear */ |
tvendov | 0:6435b67ad23c | 699 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 700 | |
tvendov | 0:6435b67ad23c | 701 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 702 | canvas2d.drawImage(decs_board_jpg_File, 80, 25); |
tvendov | 0:6435b67ad23c | 703 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 704 | { |
tvendov | 0:6435b67ad23c | 705 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 706 | canvas2d.drawImage(decs_wait_jpg_File, 190, 240); |
tvendov | 0:6435b67ad23c | 707 | } |
tvendov | 0:6435b67ad23c | 708 | else |
tvendov | 0:6435b67ad23c | 709 | { |
tvendov | 0:6435b67ad23c | 710 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 711 | canvas2d.drawImage(decs_swipe_side_jpg_File, 84, 240); |
tvendov | 0:6435b67ad23c | 712 | } |
tvendov | 0:6435b67ad23c | 713 | |
tvendov | 0:6435b67ad23c | 714 | /* fade Out */ |
tvendov | 0:6435b67ad23c | 715 | canvas2d.globalAlpha = 1.0f - global_alpha; |
tvendov | 0:6435b67ad23c | 716 | canvas2d.drawImage(Board_jpg_File, 50, 65); |
tvendov | 0:6435b67ad23c | 717 | |
tvendov | 0:6435b67ad23c | 718 | /* fade In */ |
tvendov | 0:6435b67ad23c | 719 | canvas2d.globalAlpha = global_alpha; |
tvendov | 0:6435b67ad23c | 720 | canvas2d.fillStyle = "#FFFFFF"; |
tvendov | 0:6435b67ad23c | 721 | canvas2d.fillRect(50, 65, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 722 | |
tvendov | 0:6435b67ad23c | 723 | canvas2d.globalAlpha = 1.0f; |
tvendov | 0:6435b67ad23c | 724 | |
tvendov | 0:6435b67ad23c | 725 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 726 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 727 | |
tvendov | 0:6435b67ad23c | 728 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 729 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 730 | } |
tvendov | 0:6435b67ad23c | 731 | |
tvendov | 0:6435b67ad23c | 732 | void RGA_Func_Diss(frame_buffer_t* frmbuf_info, float32_t global_alpha, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 733 | /* Dissolve = Fade Out + Fade In */ |
tvendov | 0:6435b67ad23c | 734 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 735 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 736 | |
tvendov | 0:6435b67ad23c | 737 | if(!crsr) |
tvendov | 0:6435b67ad23c | 738 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 739 | { |
tvendov | 0:6435b67ad23c | 740 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 741 | crsr = 2; |
tvendov | 0:6435b67ad23c | 742 | } |
tvendov | 0:6435b67ad23c | 743 | |
tvendov | 0:6435b67ad23c | 744 | if(crsr) |
tvendov | 0:6435b67ad23c | 745 | { |
tvendov | 0:6435b67ad23c | 746 | canvas2d.clearRect(0, 240, frmbuf_info->width, 20); |
tvendov | 0:6435b67ad23c | 747 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 748 | { |
tvendov | 0:6435b67ad23c | 749 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 750 | canvas2d.drawImage(decs_wait_jpg_File, 190, 240); |
tvendov | 0:6435b67ad23c | 751 | } |
tvendov | 0:6435b67ad23c | 752 | else |
tvendov | 0:6435b67ad23c | 753 | { |
tvendov | 0:6435b67ad23c | 754 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 755 | canvas2d.drawImage(decs_swipe_side_jpg_File, 84, 240); |
tvendov | 0:6435b67ad23c | 756 | } |
tvendov | 0:6435b67ad23c | 757 | |
tvendov | 0:6435b67ad23c | 758 | crsr--; |
tvendov | 0:6435b67ad23c | 759 | } |
tvendov | 0:6435b67ad23c | 760 | |
tvendov | 0:6435b67ad23c | 761 | /* fade Out */ |
tvendov | 0:6435b67ad23c | 762 | canvas2d.globalAlpha = 1.0f - global_alpha; |
tvendov | 0:6435b67ad23c | 763 | canvas2d.drawImage(image, 50, 65); |
tvendov | 0:6435b67ad23c | 764 | |
tvendov | 0:6435b67ad23c | 765 | /* fade In */ |
tvendov | 0:6435b67ad23c | 766 | canvas2d.globalAlpha = global_alpha; |
tvendov | 0:6435b67ad23c | 767 | canvas2d.fillStyle = "#FFFFFF"; |
tvendov | 0:6435b67ad23c | 768 | canvas2d.fillRect(50, 65, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 769 | |
tvendov | 0:6435b67ad23c | 770 | canvas2d.globalAlpha = 1.0f; |
tvendov | 0:6435b67ad23c | 771 | |
tvendov | 0:6435b67ad23c | 772 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 773 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 774 | } |
tvendov | 0:6435b67ad23c | 775 | |
tvendov | 0:6435b67ad23c | 776 | void RGA_Func_Scroll(frame_buffer_t* frmbuf_info, int src_width_pos, interact_t mode) { |
tvendov | 0:6435b67ad23c | 777 | /* Clear */ |
tvendov | 0:6435b67ad23c | 778 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 779 | |
tvendov | 0:6435b67ad23c | 780 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 781 | canvas2d.drawImage(decs_board_jpg_File, 80, 25); |
tvendov | 0:6435b67ad23c | 782 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 783 | { |
tvendov | 0:6435b67ad23c | 784 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 785 | canvas2d.drawImage(decs_wait_jpg_File, 190, 240); |
tvendov | 0:6435b67ad23c | 786 | } |
tvendov | 0:6435b67ad23c | 787 | else |
tvendov | 0:6435b67ad23c | 788 | { |
tvendov | 0:6435b67ad23c | 789 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 790 | canvas2d.drawImage(decs_swipe_side_jpg_File, 84, 240); |
tvendov | 0:6435b67ad23c | 791 | } |
tvendov | 0:6435b67ad23c | 792 | |
tvendov | 0:6435b67ad23c | 793 | /* Scroll from left to right */ |
tvendov | 0:6435b67ad23c | 794 | canvas2d.drawImage(Board_wide_jpg_File, |
tvendov | 0:6435b67ad23c | 795 | /* src */ src_width_pos, 0, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 796 | /* dst */ 50, 65, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 797 | |
tvendov | 0:6435b67ad23c | 798 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 799 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 800 | |
tvendov | 0:6435b67ad23c | 801 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 802 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 803 | } |
tvendov | 0:6435b67ad23c | 804 | |
tvendov | 0:6435b67ad23c | 805 | void RGA_Func_Scr(frame_buffer_t* frmbuf_info, int src_width_pos, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 806 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 807 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 808 | |
tvendov | 0:6435b67ad23c | 809 | if(!crsr) |
tvendov | 0:6435b67ad23c | 810 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 811 | { |
tvendov | 0:6435b67ad23c | 812 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 813 | crsr = 2; |
tvendov | 0:6435b67ad23c | 814 | } |
tvendov | 0:6435b67ad23c | 815 | |
tvendov | 0:6435b67ad23c | 816 | if(crsr) |
tvendov | 0:6435b67ad23c | 817 | { |
tvendov | 0:6435b67ad23c | 818 | canvas2d.clearRect(0, 240, frmbuf_info->width, 20); |
tvendov | 0:6435b67ad23c | 819 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 820 | { |
tvendov | 0:6435b67ad23c | 821 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 822 | canvas2d.drawImage(decs_wait_jpg_File, 190, 240); |
tvendov | 0:6435b67ad23c | 823 | } |
tvendov | 0:6435b67ad23c | 824 | else |
tvendov | 0:6435b67ad23c | 825 | { |
tvendov | 0:6435b67ad23c | 826 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 827 | canvas2d.drawImage(decs_swipe_side_jpg_File, 84, 240); |
tvendov | 0:6435b67ad23c | 828 | } |
tvendov | 0:6435b67ad23c | 829 | crsr--; |
tvendov | 0:6435b67ad23c | 830 | } |
tvendov | 0:6435b67ad23c | 831 | |
tvendov | 0:6435b67ad23c | 832 | /* Scroll from left to right */ |
tvendov | 0:6435b67ad23c | 833 | canvas2d.drawImage(image, |
tvendov | 0:6435b67ad23c | 834 | /* src */ src_width_pos, 0, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 835 | /* dst */ 50, 65, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 836 | |
tvendov | 0:6435b67ad23c | 837 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 838 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 839 | } |
tvendov | 0:6435b67ad23c | 840 | |
tvendov | 0:6435b67ad23c | 841 | void RGA_Func_Zoom(frame_buffer_t* frmbuf_info, int src_height_pos, interact_t mode) { |
tvendov | 0:6435b67ad23c | 842 | /* Clear */ |
tvendov | 0:6435b67ad23c | 843 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 844 | |
tvendov | 0:6435b67ad23c | 845 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 846 | canvas2d.drawImage(decs_board_jpg_File, 80, 25); |
tvendov | 0:6435b67ad23c | 847 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 848 | { |
tvendov | 0:6435b67ad23c | 849 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 850 | canvas2d.drawImage(decs_wait_jpg_File, 190, 240); |
tvendov | 0:6435b67ad23c | 851 | } |
tvendov | 0:6435b67ad23c | 852 | else |
tvendov | 0:6435b67ad23c | 853 | { |
tvendov | 0:6435b67ad23c | 854 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 855 | canvas2d.drawImage(decs_swipe_side_jpg_File, 84, 240); |
tvendov | 0:6435b67ad23c | 856 | } |
tvendov | 0:6435b67ad23c | 857 | |
tvendov | 0:6435b67ad23c | 858 | /* Zoom out */ |
tvendov | 0:6435b67ad23c | 859 | canvas2d.drawImage(Board_jpg_File, |
tvendov | 0:6435b67ad23c | 860 | /* src X */ ZOOM_SRC_CENTER_X - (src_height_pos * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT), |
tvendov | 0:6435b67ad23c | 861 | /* src Y */ ZOOM_SRC_CENTER_Y - src_height_pos, |
tvendov | 0:6435b67ad23c | 862 | /* src W */ src_height_pos * 2 * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 863 | /* src H */ src_height_pos * 2, |
tvendov | 0:6435b67ad23c | 864 | /* dst */ 50, 65, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 865 | |
tvendov | 0:6435b67ad23c | 866 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 867 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 868 | |
tvendov | 0:6435b67ad23c | 869 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 870 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 871 | } |
tvendov | 0:6435b67ad23c | 872 | |
tvendov | 0:6435b67ad23c | 873 | void RGA_Func_Zo(frame_buffer_t* frmbuf_info, int src_height_pos, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 874 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 875 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 876 | |
tvendov | 0:6435b67ad23c | 877 | if(!crsr) |
tvendov | 0:6435b67ad23c | 878 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 879 | { |
tvendov | 0:6435b67ad23c | 880 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 881 | crsr = 2; |
tvendov | 0:6435b67ad23c | 882 | } |
tvendov | 0:6435b67ad23c | 883 | |
tvendov | 0:6435b67ad23c | 884 | if(crsr) |
tvendov | 0:6435b67ad23c | 885 | { |
tvendov | 0:6435b67ad23c | 886 | canvas2d.clearRect(0, 240, frmbuf_info->width, 20); |
tvendov | 0:6435b67ad23c | 887 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 888 | { |
tvendov | 0:6435b67ad23c | 889 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 890 | canvas2d.drawImage(decs_wait_jpg_File, 190, 240); |
tvendov | 0:6435b67ad23c | 891 | } |
tvendov | 0:6435b67ad23c | 892 | else |
tvendov | 0:6435b67ad23c | 893 | { |
tvendov | 0:6435b67ad23c | 894 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 895 | canvas2d.drawImage(decs_swipe_side_jpg_File, 84, 240); |
tvendov | 0:6435b67ad23c | 896 | } |
tvendov | 0:6435b67ad23c | 897 | crsr--; |
tvendov | 0:6435b67ad23c | 898 | } |
tvendov | 0:6435b67ad23c | 899 | |
tvendov | 0:6435b67ad23c | 900 | /* Zoom out */ |
tvendov | 0:6435b67ad23c | 901 | canvas2d.drawImage(image, |
tvendov | 0:6435b67ad23c | 902 | /* src X */ ZOOM_SRC_CENTER_X - (src_height_pos * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT), |
tvendov | 0:6435b67ad23c | 903 | /* src Y */ ZOOM_SRC_CENTER_Y - src_height_pos, |
tvendov | 0:6435b67ad23c | 904 | /* src W */ src_height_pos * 2 * IMG_DRAW_WIDTH / IMG_DRAW_HEIGHT, |
tvendov | 0:6435b67ad23c | 905 | /* src H */ src_height_pos * 2, |
tvendov | 0:6435b67ad23c | 906 | /* dst */ 50, 65, IMG_DRAW_WIDTH, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 907 | |
tvendov | 0:6435b67ad23c | 908 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 909 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 910 | } |
tvendov | 0:6435b67ad23c | 911 | |
tvendov | 0:6435b67ad23c | 912 | void RGA_Func_Rotation(frame_buffer_t* frmbuf_info, graphics_matrix_float_t image_angle, interact_t mode) { |
tvendov | 0:6435b67ad23c | 913 | /* Rotate the image to the right */ |
tvendov | 0:6435b67ad23c | 914 | /* Clear */ |
tvendov | 0:6435b67ad23c | 915 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 916 | |
tvendov | 0:6435b67ad23c | 917 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 918 | canvas2d.drawImage(decs_board_jpg_File, 305, 65); |
tvendov | 0:6435b67ad23c | 919 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 920 | { |
tvendov | 0:6435b67ad23c | 921 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 922 | canvas2d.drawImage(decs_wait_jpg_File, 330, 240); |
tvendov | 0:6435b67ad23c | 923 | } |
tvendov | 0:6435b67ad23c | 924 | else |
tvendov | 0:6435b67ad23c | 925 | { |
tvendov | 0:6435b67ad23c | 926 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 927 | canvas2d.drawImage(decs_swipe_side_jpg_File, 0, 0, 112, 19, 330, 180, 112, 19); |
tvendov | 0:6435b67ad23c | 928 | canvas2d.drawImage(decs_swipe_side_jpg_File, 113, 0, 93, 19, 335, 210, 93, 19); |
tvendov | 0:6435b67ad23c | 929 | canvas2d.drawImage(decs_swipe_side_jpg_File, 206, 0, 110, 19, 325, 240, 110, 19); |
tvendov | 0:6435b67ad23c | 930 | } |
tvendov | 0:6435b67ad23c | 931 | |
tvendov | 0:6435b67ad23c | 932 | /* Move to drawing position */ |
tvendov | 0:6435b67ad23c | 933 | canvas2d.translate((50 + (IMG_DRAW_WIDTH / 2)), (65 + (IMG_DRAW_HEIGHT / 2))); |
tvendov | 0:6435b67ad23c | 934 | |
tvendov | 0:6435b67ad23c | 935 | /* Rotate */ |
tvendov | 0:6435b67ad23c | 936 | canvas2d.rotate(image_angle * (3.14159 / 180)); |
tvendov | 0:6435b67ad23c | 937 | |
tvendov | 0:6435b67ad23c | 938 | /* Move to center to rotate */ |
tvendov | 0:6435b67ad23c | 939 | canvas2d.translate((-IMG_DRAW_WIDTH / 2), (-IMG_DRAW_HEIGHT / 2)); |
tvendov | 0:6435b67ad23c | 940 | canvas2d.drawImage(Board_jpg_File, 0, 0); |
tvendov | 0:6435b67ad23c | 941 | canvas2d.setTransform(1, 0, 0, 1, 0, 0); |
tvendov | 0:6435b67ad23c | 942 | |
tvendov | 0:6435b67ad23c | 943 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 944 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 945 | |
tvendov | 0:6435b67ad23c | 946 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 947 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 948 | } |
tvendov | 0:6435b67ad23c | 949 | |
tvendov | 0:6435b67ad23c | 950 | void RGA_Func_Rotor(frame_buffer_t* frmbuf_info, graphics_matrix_float_t image_angle, interact_t mode, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 951 | /* Rotate the image to the right */ |
tvendov | 0:6435b67ad23c | 952 | static int prv_mode = mode; |
tvendov | 0:6435b67ad23c | 953 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 954 | |
tvendov | 0:6435b67ad23c | 955 | if(!crsr) |
tvendov | 0:6435b67ad23c | 956 | if(prv_mode != mode) |
tvendov | 0:6435b67ad23c | 957 | { |
tvendov | 0:6435b67ad23c | 958 | prv_mode = mode; |
tvendov | 0:6435b67ad23c | 959 | crsr = 2; |
tvendov | 0:6435b67ad23c | 960 | } |
tvendov | 0:6435b67ad23c | 961 | |
tvendov | 0:6435b67ad23c | 962 | if(crsr) |
tvendov | 0:6435b67ad23c | 963 | { |
tvendov | 0:6435b67ad23c | 964 | //canvas2d.clearRect(0, 240, frmbuf_info->width, 20); |
tvendov | 0:6435b67ad23c | 965 | if(mode == AUTO_INTERACT) |
tvendov | 0:6435b67ad23c | 966 | { |
tvendov | 0:6435b67ad23c | 967 | canvas2d.drawImage(ManualBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 968 | canvas2d.clearRect(330, 180, 160, 90); |
tvendov | 0:6435b67ad23c | 969 | canvas2d.drawImage(decs_wait_jpg_File, 330, 240); |
tvendov | 0:6435b67ad23c | 970 | } |
tvendov | 0:6435b67ad23c | 971 | else |
tvendov | 0:6435b67ad23c | 972 | { |
tvendov | 0:6435b67ad23c | 973 | canvas2d.drawImage(AutoBtn_jpg_File, 398, 104); |
tvendov | 0:6435b67ad23c | 974 | canvas2d.drawImage(decs_swipe_side_jpg_File, 0, 0, 112, 19, 330, 180, 112, 19); |
tvendov | 0:6435b67ad23c | 975 | canvas2d.drawImage(decs_swipe_side_jpg_File, 113, 0, 93, 19, 335, 210, 93, 19); |
tvendov | 0:6435b67ad23c | 976 | canvas2d.drawImage(decs_swipe_side_jpg_File, 206, 0, 110, 19, 325, 240, 110, 19); |
tvendov | 0:6435b67ad23c | 977 | } |
tvendov | 0:6435b67ad23c | 978 | crsr--; |
tvendov | 0:6435b67ad23c | 979 | } |
tvendov | 0:6435b67ad23c | 980 | |
tvendov | 0:6435b67ad23c | 981 | /* Clear [6ms] */ |
tvendov | 0:6435b67ad23c | 982 | canvas2d.clearRect(0, 0, 50+(IMG_DRAW_WIDTH / 2)+(frmbuf_info->height / 2), frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 983 | |
tvendov | 0:6435b67ad23c | 984 | /* Move to drawing position [1ms]*/ |
tvendov | 0:6435b67ad23c | 985 | canvas2d.translate((50 + (IMG_DRAW_WIDTH / 2)), (65 + (IMG_DRAW_HEIGHT / 2))); |
tvendov | 0:6435b67ad23c | 986 | |
tvendov | 0:6435b67ad23c | 987 | /* Rotate [2ms]*/ |
tvendov | 0:6435b67ad23c | 988 | canvas2d.rotate(image_angle * (3.14159 / 180)); |
tvendov | 0:6435b67ad23c | 989 | |
tvendov | 0:6435b67ad23c | 990 | /* Move to center to rotate [0,5 + 120 + 1ms]*/ |
tvendov | 0:6435b67ad23c | 991 | canvas2d.translate((-IMG_DRAW_WIDTH / 2), (-IMG_DRAW_HEIGHT / 2)); |
tvendov | 0:6435b67ad23c | 992 | canvas2d.drawImage(image, 0, 0); |
tvendov | 0:6435b67ad23c | 993 | canvas2d.setTransform(1, 0, 0, 1, 0, 0); |
tvendov | 0:6435b67ad23c | 994 | |
tvendov | 0:6435b67ad23c | 995 | /* Complete drawing [4ms]*/ |
tvendov | 0:6435b67ad23c | 996 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 997 | } |
tvendov | 0:6435b67ad23c | 998 | |
tvendov | 0:6435b67ad23c | 999 | void RGA_Func_Accelerate(frame_buffer_t* frmbuf_info, int animation_timing, float32_t relative_pos) { |
tvendov | 0:6435b67ad23c | 1000 | /* Do accelerated motion from right to left */ |
tvendov | 0:6435b67ad23c | 1001 | int position; |
tvendov | 0:6435b67ad23c | 1002 | |
tvendov | 0:6435b67ad23c | 1003 | /* Clear */ |
tvendov | 0:6435b67ad23c | 1004 | canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); |
tvendov | 0:6435b67ad23c | 1005 | |
tvendov | 0:6435b67ad23c | 1006 | /* Draw description */ |
tvendov | 0:6435b67ad23c | 1007 | canvas2d.drawImage(decs_board_jpg_File, 80, 25); |
tvendov | 0:6435b67ad23c | 1008 | |
tvendov | 0:6435b67ad23c | 1009 | if (relative_pos == 0.0f) { |
tvendov | 0:6435b67ad23c | 1010 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 1011 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 1012 | R_Get_AnimationTimingFunction("ease", &accelerator); |
tvendov | 0:6435b67ad23c | 1013 | break; |
tvendov | 0:6435b67ad23c | 1014 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 1015 | R_Get_AnimationTimingFunction("linear", &accelerator); |
tvendov | 0:6435b67ad23c | 1016 | break; |
tvendov | 0:6435b67ad23c | 1017 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 1018 | R_Get_AnimationTimingFunction("ease-in", &accelerator); |
tvendov | 0:6435b67ad23c | 1019 | break; |
tvendov | 0:6435b67ad23c | 1020 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 1021 | R_Get_AnimationTimingFunction("ease-out", &accelerator); |
tvendov | 0:6435b67ad23c | 1022 | break; |
tvendov | 0:6435b67ad23c | 1023 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 1024 | default: |
tvendov | 0:6435b67ad23c | 1025 | R_Get_AnimationTimingFunction("ease-in-out", &accelerator); |
tvendov | 0:6435b67ad23c | 1026 | break; |
tvendov | 0:6435b67ad23c | 1027 | } |
tvendov | 0:6435b67ad23c | 1028 | } |
tvendov | 0:6435b67ad23c | 1029 | |
tvendov | 0:6435b67ad23c | 1030 | /* Draw rectangle */ |
tvendov | 0:6435b67ad23c | 1031 | canvas2d.fillStyle = "#0000FF"; /* blue */ |
tvendov | 0:6435b67ad23c | 1032 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 1033 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 1034 | canvas2d.fillRect(10, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1035 | break; |
tvendov | 0:6435b67ad23c | 1036 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 1037 | canvas2d.fillRect(103, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1038 | break; |
tvendov | 0:6435b67ad23c | 1039 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 1040 | canvas2d.fillRect(198, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1041 | break; |
tvendov | 0:6435b67ad23c | 1042 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 1043 | canvas2d.fillRect(292, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1044 | break; |
tvendov | 0:6435b67ad23c | 1045 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 1046 | default: |
tvendov | 0:6435b67ad23c | 1047 | canvas2d.fillRect(386, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1048 | break; |
tvendov | 0:6435b67ad23c | 1049 | } |
tvendov | 0:6435b67ad23c | 1050 | |
tvendov | 0:6435b67ad23c | 1051 | /* Draw button */ |
tvendov | 0:6435b67ad23c | 1052 | canvas2d.drawImage(animetion_timing_jpg_File, 0, 225); |
tvendov | 0:6435b67ad23c | 1053 | |
tvendov | 0:6435b67ad23c | 1054 | position = R_ANIMATION_TIMING_FUNCTION_GetValue(accelerator, relative_pos, 240.0f, 6.0f); |
tvendov | 0:6435b67ad23c | 1055 | canvas2d.drawImage(Board_jpg_File, position, 65); |
tvendov | 0:6435b67ad23c | 1056 | |
tvendov | 0:6435b67ad23c | 1057 | /* Draw return button */ |
tvendov | 0:6435b67ad23c | 1058 | canvas2d.drawImage(RetBtn_jpg_File, 368, 6); |
tvendov | 0:6435b67ad23c | 1059 | |
tvendov | 0:6435b67ad23c | 1060 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 1061 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 1062 | } |
tvendov | 0:6435b67ad23c | 1063 | |
tvendov | 0:6435b67ad23c | 1064 | void RGA_Func_Axel(frame_buffer_t* frmbuf_info, int animation_timing, float32_t relative_pos, graphics_image_t* image) { |
tvendov | 0:6435b67ad23c | 1065 | /* Do accelerated motion from right to left */ |
tvendov | 0:6435b67ad23c | 1066 | static int prv_timing = animation_timing; |
tvendov | 0:6435b67ad23c | 1067 | static int crsr = 0; |
tvendov | 0:6435b67ad23c | 1068 | int position; |
tvendov | 0:6435b67ad23c | 1069 | |
tvendov | 0:6435b67ad23c | 1070 | /* Clear */ |
tvendov | 0:6435b67ad23c | 1071 | canvas2d.clearRect(0, 65, frmbuf_info->width, IMG_DRAW_HEIGHT); |
tvendov | 0:6435b67ad23c | 1072 | |
tvendov | 0:6435b67ad23c | 1073 | if (relative_pos == 0.0f) { |
tvendov | 0:6435b67ad23c | 1074 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 1075 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 1076 | R_Get_AnimationTimingFunction("ease", &accelerator); |
tvendov | 0:6435b67ad23c | 1077 | break; |
tvendov | 0:6435b67ad23c | 1078 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 1079 | R_Get_AnimationTimingFunction("linear", &accelerator); |
tvendov | 0:6435b67ad23c | 1080 | break; |
tvendov | 0:6435b67ad23c | 1081 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 1082 | R_Get_AnimationTimingFunction("ease-in", &accelerator); |
tvendov | 0:6435b67ad23c | 1083 | break; |
tvendov | 0:6435b67ad23c | 1084 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 1085 | R_Get_AnimationTimingFunction("ease-out", &accelerator); |
tvendov | 0:6435b67ad23c | 1086 | break; |
tvendov | 0:6435b67ad23c | 1087 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 1088 | default: |
tvendov | 0:6435b67ad23c | 1089 | R_Get_AnimationTimingFunction("ease-in-out", &accelerator); |
tvendov | 0:6435b67ad23c | 1090 | break; |
tvendov | 0:6435b67ad23c | 1091 | } |
tvendov | 0:6435b67ad23c | 1092 | if(prv_timing != animation_timing) |
tvendov | 0:6435b67ad23c | 1093 | { |
tvendov | 0:6435b67ad23c | 1094 | prv_timing = animation_timing; |
tvendov | 0:6435b67ad23c | 1095 | crsr = 2; |
tvendov | 0:6435b67ad23c | 1096 | } |
tvendov | 0:6435b67ad23c | 1097 | } |
tvendov | 0:6435b67ad23c | 1098 | |
tvendov | 0:6435b67ad23c | 1099 | /* Draw rectangle */ |
tvendov | 0:6435b67ad23c | 1100 | canvas2d.fillStyle = "#0000FF"; /* blue */ |
tvendov | 0:6435b67ad23c | 1101 | switch (animation_timing) { |
tvendov | 0:6435b67ad23c | 1102 | case ANIMATION_TIMING_EASE: |
tvendov | 0:6435b67ad23c | 1103 | if(crsr) |
tvendov | 0:6435b67ad23c | 1104 | { |
tvendov | 0:6435b67ad23c | 1105 | canvas2d.clearRect(0, 255, frmbuf_info->width, 6); |
tvendov | 0:6435b67ad23c | 1106 | canvas2d.fillRect(10, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1107 | } |
tvendov | 0:6435b67ad23c | 1108 | break; |
tvendov | 0:6435b67ad23c | 1109 | case ANIMATION_TIMING_LINEAR: |
tvendov | 0:6435b67ad23c | 1110 | if(crsr) |
tvendov | 0:6435b67ad23c | 1111 | { |
tvendov | 0:6435b67ad23c | 1112 | canvas2d.clearRect(0, 255, frmbuf_info->width, 6); |
tvendov | 0:6435b67ad23c | 1113 | canvas2d.fillRect(103, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1114 | } |
tvendov | 0:6435b67ad23c | 1115 | break; |
tvendov | 0:6435b67ad23c | 1116 | case ANIMATION_TIMING_EASE_IN: |
tvendov | 0:6435b67ad23c | 1117 | if(crsr) |
tvendov | 0:6435b67ad23c | 1118 | { |
tvendov | 0:6435b67ad23c | 1119 | canvas2d.clearRect(0, 255, frmbuf_info->width, 6); |
tvendov | 0:6435b67ad23c | 1120 | canvas2d.fillRect(198, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1121 | } |
tvendov | 0:6435b67ad23c | 1122 | break; |
tvendov | 0:6435b67ad23c | 1123 | case ANIMATION_TIMING_EASE_OUT: |
tvendov | 0:6435b67ad23c | 1124 | if(crsr) |
tvendov | 0:6435b67ad23c | 1125 | { |
tvendov | 0:6435b67ad23c | 1126 | canvas2d.clearRect(0, 255, frmbuf_info->width, 6); |
tvendov | 0:6435b67ad23c | 1127 | canvas2d.fillRect(292, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1128 | } |
tvendov | 0:6435b67ad23c | 1129 | break; |
tvendov | 0:6435b67ad23c | 1130 | case ANIMATION_TIMING_EASE_IN_OUT: |
tvendov | 0:6435b67ad23c | 1131 | default: |
tvendov | 0:6435b67ad23c | 1132 | if(crsr) |
tvendov | 0:6435b67ad23c | 1133 | { |
tvendov | 0:6435b67ad23c | 1134 | canvas2d.clearRect(0, 255, frmbuf_info->width, 6); |
tvendov | 0:6435b67ad23c | 1135 | canvas2d.fillRect(386, 255, 81, 6); |
tvendov | 0:6435b67ad23c | 1136 | } |
tvendov | 0:6435b67ad23c | 1137 | break; |
tvendov | 0:6435b67ad23c | 1138 | } |
tvendov | 0:6435b67ad23c | 1139 | |
tvendov | 0:6435b67ad23c | 1140 | /* Draw button */ |
tvendov | 0:6435b67ad23c | 1141 | if(crsr) |
tvendov | 0:6435b67ad23c | 1142 | { |
tvendov | 0:6435b67ad23c | 1143 | canvas2d.drawImage(animetion_timing_jpg_File, 0, 225); |
tvendov | 0:6435b67ad23c | 1144 | crsr--; |
tvendov | 0:6435b67ad23c | 1145 | } |
tvendov | 0:6435b67ad23c | 1146 | |
tvendov | 0:6435b67ad23c | 1147 | position = R_ANIMATION_TIMING_FUNCTION_GetValue(accelerator, relative_pos, 240.0f, 6.0f); |
tvendov | 0:6435b67ad23c | 1148 | canvas2d.drawImage(image, position, 65); |
tvendov | 0:6435b67ad23c | 1149 | |
tvendov | 0:6435b67ad23c | 1150 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 1151 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 1152 | } |
tvendov | 0:6435b67ad23c | 1153 | |
tvendov | 0:6435b67ad23c | 1154 | bool RGA_Func_CheckPorts(frame_buffer_t* frmbuf_info, bool rca_pluged, bool usb_pluged) { |
tvendov | 0:6435b67ad23c | 1155 | static bool rca_visible = false; |
tvendov | 0:6435b67ad23c | 1156 | static bool usb_visible = false; |
tvendov | 0:6435b67ad23c | 1157 | bool rca_changed = false; |
tvendov | 0:6435b67ad23c | 1158 | bool usb_changed = false; |
tvendov | 0:6435b67ad23c | 1159 | |
tvendov | 0:6435b67ad23c | 1160 | /* Detect Change in ports status */ |
tvendov | 0:6435b67ad23c | 1161 | if(rca_pluged ^ rca_visible) |
tvendov | 0:6435b67ad23c | 1162 | { |
tvendov | 0:6435b67ad23c | 1163 | rca_visible = rca_pluged; |
tvendov | 0:6435b67ad23c | 1164 | rca_changed = true; |
tvendov | 0:6435b67ad23c | 1165 | } |
tvendov | 0:6435b67ad23c | 1166 | |
tvendov | 0:6435b67ad23c | 1167 | if(usb_pluged ^ usb_visible) |
tvendov | 0:6435b67ad23c | 1168 | { |
tvendov | 0:6435b67ad23c | 1169 | usb_visible = usb_pluged; |
tvendov | 0:6435b67ad23c | 1170 | usb_changed = true; |
tvendov | 0:6435b67ad23c | 1171 | } |
tvendov | 0:6435b67ad23c | 1172 | |
tvendov | 0:6435b67ad23c | 1173 | if(rca_changed | usb_changed) |
tvendov | 0:6435b67ad23c | 1174 | { |
tvendov | 0:6435b67ad23c | 1175 | frmbuf_info->draw_buffer_index = (frmbuf_info->draw_buffer_index)? 0 : 1; |
tvendov | 0:6435b67ad23c | 1176 | |
tvendov | 0:6435b67ad23c | 1177 | /* Draw a image Clear */ |
tvendov | 0:6435b67ad23c | 1178 | canvas2d.drawImage(TopScrn_jpg_File, 0, 0); |
tvendov | 0:6435b67ad23c | 1179 | |
tvendov | 0:6435b67ad23c | 1180 | if(rca_visible) |
tvendov | 0:6435b67ad23c | 1181 | canvas2d.drawImage(RCA_jpg_File, (frmbuf_info->width/2)-80, 22); |
tvendov | 0:6435b67ad23c | 1182 | |
tvendov | 0:6435b67ad23c | 1183 | if(usb_visible) |
tvendov | 0:6435b67ad23c | 1184 | canvas2d.drawImage(Usb_jpg_File, frmbuf_info->width-50, (frmbuf_info->height/2)-36); |
tvendov | 0:6435b67ad23c | 1185 | |
tvendov | 0:6435b67ad23c | 1186 | /* Complete drawing */ |
tvendov | 0:6435b67ad23c | 1187 | R_GRAPHICS_Finish(canvas2d.c_LanguageContext); |
tvendov | 0:6435b67ad23c | 1188 | } |
tvendov | 0:6435b67ad23c | 1189 | |
tvendov | 0:6435b67ad23c | 1190 | return (rca_changed | usb_changed); |
tvendov | 0:6435b67ad23c | 1191 | } |
tvendov | 0:6435b67ad23c | 1192 | #endif |
tvendov | 0:6435b67ad23c | 1193 |