Rev 485 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 485 | Rev 495 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | 28 | ||
29 | 29 | ||
Line -... | Line 30... | ||
- | 30 | private String err=""; |
|
- | 31 | private DUBwise root; |
|
30 | private String err=""; |
32 | |
31 | private DUBwise root; |
33 | |
32 | 34 | ||
33 | private Image bg_img; |
35 | private Image bg_img; |
Line -... | Line 36... | ||
- | 36 | private Image bt_img; |
|
- | 37 | private Image lcd_img; |
|
- | 38 | private Image load_img; |
|
- | 39 | ||
- | 40 | ||
- | 41 | final static int SKINID_DARK= 0; |
|
34 | private Image bt_img; |
42 | final static int SKINID_LIGHT = 1; |
35 | private Image lcd_img; |
43 | |
Line 36... | Line 44... | ||
36 | private Image load_img; |
44 | byte act_skin=SKINID_DARK; |
37 | 45 | ||
Line 75... | Line 83... | ||
75 | public boolean fullscreen=false; |
83 | public boolean fullscreen=false; |
76 | public int act_motor=0; |
84 | public int act_motor=0; |
77 | public int act_motor_increase=0; |
85 | public int act_motor_increase=0; |
78 | public boolean motor_test_sel_all=false; |
86 | public boolean motor_test_sel_all=false; |
Line 79... | Line 87... | ||
79 | 87 | ||
80 | public String[] main_menu_items={"Telemetry","Raw Debug", "MK-KeyControl", "Motor Test" , "Flight Settings","(NA)Tool Settings","Proxy","Change Device" , "Quit " }; |
88 | public String[] main_menu_items={"Telemetry","Raw Debug", "MK-KeyControl", "Motor Test" , "Flight Settings","Change Skin","Proxy","Change Device" , "Quit " }; |
81 | public final static int MAINMENU_TELEMETRY =0; |
89 | public final static int MAINMENU_TELEMETRY =0; |
82 | public final static int MAINMENU_RAWDEBUG =1+MAINMENU_TELEMETRY; |
90 | public final static int MAINMENU_RAWDEBUG =1+MAINMENU_TELEMETRY; |
83 | public final static int MAINMENU_KEYCONTROL =1+MAINMENU_RAWDEBUG; |
91 | public final static int MAINMENU_KEYCONTROL =1+MAINMENU_RAWDEBUG; |
84 | public final static int MAINMENU_MOTORTEST =1+MAINMENU_KEYCONTROL; |
92 | public final static int MAINMENU_MOTORTEST =1+MAINMENU_KEYCONTROL; |
Line 144... | Line 152... | ||
144 | g.drawImage(lcd_img,(lcd_img.getWidth()/222)*pos-((pos<lcd_lines[i].length()?lcd_lines[i].charAt(pos):' ')-' ')*(lcd_img.getWidth()/222),y,g.TOP | g.LEFT); |
152 | g.drawImage(lcd_img,(lcd_img.getWidth()/222)*pos-((pos<lcd_lines[i].length()?lcd_lines[i].charAt(pos):' ')-' ')*(lcd_img.getWidth()/222),y,g.TOP | g.LEFT); |
Line 145... | Line 153... | ||
145 | 153 | ||
146 | } |
154 | } |
Line 147... | Line 155... | ||
147 | } |
155 | } |
148 | 156 | ||
149 | public MKMiniCanvas(DUBwise _root) |
- | |
150 | { |
- | |
151 | - | ||
152 | root=_root; |
- | |
153 | - | ||
154 | bt_scanner = new BTSearcher(); |
- | |
155 | params_editor = new MKParamsEditor(this); |
- | |
156 | mk = new MKCommunicator(); |
- | |
157 | mk_stat= new MKStatistics(mk); |
157 | public void load_images() |
158 | 158 | { |
|
159 | try |
159 | try |
- | 160 | { |
|
- | 161 | // load all needed images |
|
- | 162 | switch (act_skin) |
|
- | 163 | { |
|
- | 164 | case SKINID_DARK: |
|
- | 165 | lcd_img=Image.createImage("/lcd_green.png"); |
|
- | 166 | bg_img=Image.createImage("/starfield.jpg"); break; |
|
160 | { |
167 | |
- | 168 | case SKINID_LIGHT: |
|
- | 169 | lcd_img=Image.createImage("/lcd_blue.png"); |
|
- | 170 | bg_img=Image.createImage("/clouds.jpg"); |
|
- | 171 | break; |
|
- | 172 | } |
|
161 | // load all needed images |
173 | |
162 | lcd_img=Image.createImage("/lcd.png"); |
- | |
- | 174 | ||
163 | bt_img=Image.createImage("/bt.png"); |
175 | bt_img=Image.createImage("/bt.png"); |
164 | bg_img=Image.createImage("/starfield.jpg"); |
176 | |
165 | load_img=Image.createImage("/load.png"); |
177 | load_img=Image.createImage("/load.png"); |
166 | } |
178 | } |
167 | catch (Exception e) |
179 | catch (Exception e) |
Line 183... | Line 195... | ||
183 | nick_line_pos_data[c]=-1; |
195 | nick_line_pos_data[c]=-1; |
184 | roll_line_pos_data[c]=-1; |
196 | roll_line_pos_data[c]=-1; |
185 | accnick_line_pos_data[c]=-1; |
197 | accnick_line_pos_data[c]=-1; |
186 | accroll_line_pos_data[c]=-1; |
198 | accroll_line_pos_data[c]=-1; |
187 | } |
199 | } |
188 | 200 | ||
- | 201 | } |
|
- | 202 | ||
- | 203 | public MKMiniCanvas(DUBwise _root) |
|
- | 204 | { |
|
- | 205 | ||
- | 206 | root=_root; |
|
- | 207 | ||
- | 208 | bt_scanner = new BTSearcher(); |
|
- | 209 | params_editor = new MKParamsEditor(this); |
|
- | 210 | mk = new MKCommunicator(root); |
|
- | 211 | mk_stat= new MKStatistics(mk); |
|
- | 212 | ||
- | 213 | load_images(); |
|
- | 214 | ||
Line 189... | Line 215... | ||
189 | 215 | ||
190 | try |
216 | try |
191 | { |
217 | { |
Line 416... | Line 442... | ||
416 | 442 | ||
417 | if (bg_offset+bg_img.getWidth()<this.getWidth()) |
443 | if (bg_offset+bg_img.getWidth()<this.getWidth()) |
418 | g.drawImage(bg_img,bg_offset+bg_img.getWidth(),0, g.TOP | g.LEFT); |
444 | g.drawImage(bg_img,bg_offset+bg_img.getWidth(),0, g.TOP | g.LEFT); |
Line -... | Line 445... | ||
- | 445 | } |
|
- | 446 | ||
- | 447 | switch (act_skin) |
|
419 | } |
448 | { |
- | 449 | case SKINID_DARK: |
|
- | 450 | g.setColor(0x2dcf20); |
|
- | 451 | ||
- | 452 | break; |
|
420 | 453 | ||
- | 454 | case SKINID_LIGHT: |
|
- | 455 | g.setColor(0x000000); |
|
- | 456 | break; |
|
- | 457 | } |
|
- | 458 | ||
421 | g.setColor(0x000000); |
459 | |
422 | g.setColor(0x2dcf20); |
460 | |
423 | switch(state) |
461 | switch(state) |
Line 601... | Line 639... | ||
601 | 639 | ||
Line 602... | Line 640... | ||
602 | } |
640 | } |
603 | 641 | ||
- | 642 | public void draw_graph_part(Graphics g,int x,int y1,int y2) |
|
- | 643 | { |
|
604 | public void draw_graph_part(Graphics g,int x,int y1,int y2) |
644 | if ( this.getWidth()>200) |
605 | { |
645 | { |
606 | g.fillRect(x,line_middle_y-y1,2,2 ); |
646 | g.fillRect(x,line_middle_y-y1,1,1 ); |
- | 647 | if (y1>y2) |
|
- | 648 | g.fillRect(x,line_middle_y-y1,1,y1-y2); |
|
- | 649 | else |
|
- | 650 | g.fillRect(x,line_middle_y-y2,1,y2-y1); |
|
607 | if (y1>y2) |
651 | |
- | 652 | } |
|
- | 653 | else |
|
- | 654 | { |
|
- | 655 | g.fillRect(x,line_middle_y-y1,1,1 ); |
|
- | 656 | if (y1>y2) |
|
608 | g.fillRect(x,line_middle_y-y1,2,y1-y2); |
657 | g.fillRect(x,line_middle_y-y1,1,y1-y2); |
- | 658 | else |
|
- | 659 | g.fillRect(x,line_middle_y-y2,1,y2-y1); |
|
609 | else |
660 | } |
Line -... | Line 661... | ||
- | 661 | ||
610 | g.fillRect(x,line_middle_y-y2,2,y2-y1); |
662 | } |
Line 611... | Line 663... | ||
611 | } |
663 | |
Line 846... | Line 898... | ||
846 | break; |
898 | break; |
847 | case STATEID_MAINMENU: |
899 | case STATEID_MAINMENU: |
848 | if ( getGameAction (keyCode)==FIRE ) |
900 | if ( getGameAction (keyCode)==FIRE ) |
849 | switch(act_menu_select) |
901 | switch(act_menu_select) |
850 | { |
902 | { |
- | 903 | case MAINMENU_SETTINGS: |
|
- | 904 | act_skin++; |
|
- | 905 | act_skin=(byte)(act_skin%2); |
|
- | 906 | load_images(); |
|
- | 907 | break; |
|
- | 908 | ||
851 | case MAINMENU_KEYCONTROL: |
909 | case MAINMENU_KEYCONTROL: |
852 | chg_state(STATEID_KEYCONTROL); |
910 | chg_state(STATEID_KEYCONTROL); |
853 | break; |
911 | break; |
Line 854... | Line 912... | ||
854 | 912 | ||
Line 861... | Line 919... | ||
861 | break; |
919 | break; |
Line 862... | Line 920... | ||
862 | 920 | ||
863 | case MAINMENU_PARAMS : |
921 | case MAINMENU_PARAMS : |
864 | chg_state(STATEID_SELECT_PARAMSET); |
922 | chg_state(STATEID_SELECT_PARAMSET); |
865 | break; |
- | |
866 | case MAINMENU_SETTINGS: |
923 | break; |
Line 867... | Line 924... | ||
867 | break; |
924 | |
868 | 925 | ||
869 | case MAINMENU_PROXY: |
926 | case MAINMENU_PROXY: |