Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Low level spinner for games (test and input needed).

Low level spinner for games (test and input needed).

Quickly share your Android Code Snippets here...

Low level spinner for games (test and input needed).

Postby Jompe71 » Sun Jan 11, 2009 2:54 pm

Just in progress of making my new game and wanted to have a low level spinner (drop down in my own words) implementation.
I hacked one up quickly but need help in testing it. Please if you also need such an implementation try it out in your own app and give feedback on potential improvements. Some basic methods are missing such as removing, sorting items etc but the main part is there.

Note that the purpose of it is for games and it shall not have every feature a high level spinner has, just the basics to be used for ex. settings, in game options etc.

Usage:
in View onCreate() (note Image passed has internally hardcoded size set to 16x16px.)
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.        
  2.  
  3. lldd = new LowLevelDropDown( 20, 20, 150, 18, <Your_16x16_Bitmap> );
  4.  
  5. lldd.addItem( "Jompe71" );
  6.  
  7. lldd.addItem( "LowLevel" );
  8.  
  9. lldd.addItem( "DropDown" );
  10.  
  11. lldd.addItem( "Can be used" );
  12.  
  13. lldd.addItem( "In games !" );
  14.  
  15. lldd.addItem( "Please feel" );
  16.  
  17. lldd.addItem( "Free to try" );
  18.  
  19. lldd.addItem( "It out..." );
  20.  
  21.  
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


More View code
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.    
  2.  
  3.     @Override
  4.  
  5.     public boolean onTouchEvent( MotionEvent event ) {    
  6.  
  7.         lldd.update( ( int )event.getX(), ( int )event.getY(), event.getAction() );
  8.  
  9.         return true;
  10.  
  11.     }
  12.  
  13.  
  14.  
  15.     @Override
  16.  
  17.     public boolean onKeyUp( int code, KeyEvent event ) {
  18.  
  19.         switch( code ) {
  20.  
  21.             case KeyEvent.KEYCODE_DPAD_DOWN:
  22.  
  23.                 lldd.scrollDown();
  24.  
  25.                 return true;
  26.  
  27.  
  28.  
  29.             case KeyEvent.KEYCODE_DPAD_UP:
  30.  
  31.                 lldd.scrollUp();
  32.  
  33.                 return true;
  34.  
  35.         }
  36.  
  37.         return false;
  38.  
  39.     }
  40.  
  41.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


And in whatever method you chose to render:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. lldd.render( canvas );
  3.  
  4.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


Any input highly appreciated !
Attachments
LowLevelDropDown.java
(9.78 KiB) Downloaded 164 times
There is no school like old school gaming.
Jompe71
Experienced Developer
Experienced Developer
 
Posts: 69
Joined: Sat Oct 25, 2008 2:21 pm
Location: Stockholm Sweden

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 2 guests