JPPicker

JPPicker

Optimized list or picker items management
Version : 3.0
Price : $50
State : Out

Changelog

v3.0

  • Now compatible with ShiVa 2.0.
  • Plugin API compiled for Mac and Linux in addition to Windows : it will provide API completion in the Script module in ShiVa Editor for each of these operating systems.
  • Now uses a user token instead of an email to activate

v2.2

  • Increased precision when the picker movement stops.
  • New function: bYes = JPPicker.isActive ( sID )
  • The scrolling behaviour is now smoother when the user releases his finger from the screen.

v2.1

  • Optimized for ShiVa 1.9.2

v2.0

  • JPPicker can now scroll several pickers at once.
  • Optimizations
  • Improvements on scrolling.
  • Fixed an issue with JPPicker.removePicker ( sID )
  • Fixes on JPPicker.scrollToIndex ( sID, nIndex, bInstant )
  • New functions: nPosition = JPPicker.getPickerPosition ( sID ) nMinPosition, nMaxPosition = JPPicker.getPickerPositionRange ( sID ) nSpeed = JPPicker.getPickerScrollingSpeed ( sID ) JPPicker.setBounceStrengthCoef ( nCoef ) JPPicker.setDampingStrengthCoef ( nCoef ) JPPicker.setPickerScrollingSpeed ( sID, nSpeed ) tItemsToUpdate, tItemsToDisable, tItemsToEnable = JPPicker.helpMeUpdateMyItems ( sID, nItemsBySide ) nItemIndex, nExactItem = JPPicker.getPickerCenterItem ( sID ) JPPicker.setPickerOffset ( sID, nOffsetItemCount )

v1.3

  • Internal modifications to prevent eventual conflicts between packs.

v1.2

  • Fixed a random issue blocking the activation of the pack

v1.1

  • Error messages now are easier to understand.

API

--JPPicker API JPPicker.activate ( sUserToken, sActivationKey ) sID = JPPicker.addPicker ( hObjectDelegate, nItemCount, nOptStartIndex, bOptScrollOnX, bOptMustStopOnItems ) JPPicker.forceUpdate ( sID ) nItemIndex, nExactItem = JPPicker.getPickerCenterItem ( sID ) nPosition = JPPicker.getPickerPosition ( sID ) nMinPosition, nMaxPosition = JPPicker.getPickerPositionRange ( sID ) nSpeed = JPPicker.getPickerScrollingSpeed ( sID ) tItemsToUpdate, tItemsToDisable, tItemsToEnable = JPPicker.helpMeUpdateMyItems ( sID, nItemsBySide ) bYes = JPPicker.isActive ( sID ) JPPicker.mouseDown ( sID, nPointX, nPointY ) JPPicker.removePicker ( sID ) JPPicker.scrollToIndex ( sID, nItemIndex, bOptInstant ) JPPicker.setActive ( sID, bActive ) JPPicker.setBounceStrengthCoef ( nCoef ) JPPicker.setDampingStrengthCoef ( nCoef ) JPPicker.setMouseCoef ( sID, nCoef ) JPPicker.setPickerOffset ( sID, nOffsetItemCount ) JPPicker.setPickerScrollingSpeed ( sID, nSpeed ) --User notification events: "onPickerScrollingToItem" ( sID, nItemIndex ) "onPickerPositionDidChange" ( sID, nCurrentPosition, nCurrentItemIndex ) "onPickerCenterItemDidChange" ( sID, nItemIndex, bPickerScrollingToAnItemIndex )

Description

A picker is a list of items which can be scrolled and where the item at the middle is the selected one. JPPicker will do all the hard stuff of computing the picker position and will give you the state of the list and the middle item in real time. Then you are free to use the values provided by JPPicker on any kind of elements, for instance HUD components or scene objects.

The JPPicker animation is very pleasant and smooth, there is a bonce effect when the list is out of the start or end position. It is possible to enable an option to make the picker to always end its scrolling on an exact item position.

Its usage is very easy, just tell JPPicker the number of items in the list and you are almost done:

function MyAIModel.onInit ( ) local hObjectDelegate = nil local nItemCount = 20 JPPicker.addPicker ( hObjectDelegate, nItemCount ) end function MyAIModel.onPickerPositionDidChange ( sID, nPosition, nItemIndex ) this.updateItemsPosition ( nPosition ) end function MyAIModel.onPickerCenterItemDidChange ( sID, nIndex, bListCurrentlyScrollingToItem ) this.setSelectedItem ( nIndex ) end

The result is very impressive. Take a look at the JPPicker example in the demo, at the race selection screen.

JPPicker also provides a wonderful function, named JPPicker.helpMeUpdateMyItems, to help you manage your picker in order to have a huge number of items without any performance issues. I have created a tutorial on that subject you should read if you want to learn more about the impact of your Scripting Strategies on your Game Performance.