imagelib

Changeset 3

Files
  • 2 edited
tube42's avatar
Timestamp:
11/20/11 22:27:09 (6 months ago)
Message:

added initial touch support in the demo :(





Legend:
Unmodified
Added
Removed
  • bin/imagelib_demo.jad

    r2 r3  
    1 1MIDlet-1: imagelib_demo, imagelib_demo.png, tube42.imagelib_demo.Main 
    2  MIDlet-Jar-Size: 180666 
     2 MIDlet-Jar-Size: 184892 
    3 3MIDlet-Jar-URL: imagelib_demo.jar 
    4 4MIDlet-Name: image_lib_demo 
  • src/tube42/imagelib_demo/ImageCanvas.java

    r2 r3  
    82 82        handle_key(k, false, false);       
    83 83    } 
    84                 
     84      
    85 85    // --------------------------------------- 
     86    // touch input 
     87 
     88    public void pointerDragged(int x, int y) 
     89    { 
     90        handle_touch(x, y, true, true); 
     91    } 
    86 92     
     93    public void pointerPressed(int x, int y) 
     94    { 
     95        handle_touch(x, y, true, true); 
     96    } 
    87 97     
     98    public void pointerReleased(int x, int y) 
     99    { 
     100        handle_touch(x, y, false, false); 
     101    } 
     102     
     103    // --------------------------------------- 
     104    private void advance() 
     105    { 
     106        curr ++; 
     107        if(curr >= scenes.length) { 
     108            curr = 0; 
     109            parent.notifyDestroyed();         
     110        } 
     111         
     112        if(curr > 0) 
     113            scenes[curr-1].setFocus(false); 
     114        if(curr < scenes.length) 
     115            scenes[curr].setFocus(true); 
     116         
     117        repaint();         
     118    } 
     119     
     120    private void handle_touch(int x, int y, boolean down, boolean draged) 
     121    { 
     122        if(!down) advance(); 
     123    } 
    88 124    private void handle_key(int key, boolean down, boolean repeated) 
    89 125    { 
     
    91 127         
    92 128        if(!down && gkey == FIRE) { 
    93              curr ++; 
    94              if(curr >= scenes.length) { 
    95                  curr = 0; 
    96                  parent.notifyDestroyed();         
    97              } 
    98               
    99              if(curr > 0) 
    100                  scenes[curr-1].setFocus(false); 
    101              if(curr < scenes.length) 
    102                  scenes[curr].setFocus(true); 
    103                   
    104              repaint(); 
     129             advance(); 
    105 130        } else if( scenes[curr].handle_key(key, gkey, down, repeated)) { 
    106 131            repaint();     
Note: See TracChangeset for help on using the changeset viewer.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2011 All rights reserved