New functions:
Added the following functions:
New functions:
Bugfix:
Sound related functions moved to a new 'JPSound' pack with tons of new features :)
You can now set default values to a new table instance:
Optimized for ShiVa 1.9.2 New function:
New functions:
Bugfix on hud.getSpinnerRotation, last rotation was 360 instead of 0.
New functions:
Parameters changed for function: hud.sizeComponentToFitText ( hComponent )
New functions:
Fixed a bug with the pack constants, that sometimes became nil in ShiVa Editor only. Fixed a bug with lists and hud_setComponentText.
Input related funtions splitted to create JPInput.
New functions:
New functions:
New constants:
JPExtendedAPI.kLoadSuccess
JPExtendedAPI.kLoadErrorLocalStorageNotFound
JPExtendedAPI.kLoadErrorCurrentUserEnvironmentDoesNotExist
JPExtendedAPI.kLoadErrorCurrentUserEnvironmentCorrupted
JPExtendedAPI.kLoadErrorUnknown
JPExtendedAPI.kSaveSuccess
JPExtendedAPI.kSaveErrorNoLocalStorageDevice
JPExtendedAPI.kSaveErrorNoLocalStorageWriteAccess
JPExtendedAPI.kSaveErrorNoLocalStorageSpaceAndCanOpenStorageManager
JPExtendedAPI.kSaveErrorNoLocalStorageSpaceAndCannotOpenStorageManager
JPExtendedAPI.kSaveErrorLocalStorageDeviceChanged
JPExtendedAPI.kSaveErrorLocalStorageDeviceRemoved
JPExtendedAPI.kSaveErrorUnknown
The xml.getElementFirstChildWithNameAndAttributes, xml.getElementFirstChildWithNameAndAttributesAndAttribute and xml.getElementFirstChildWithNameAndAttributesAndAttributeAndAttribute have been merged into a single function: hChild = xml.getElementFirstChildWithNameAndAttributes ( hXMLElement, sOptElementName, sOptAttributeName0, sOptAttributeValue0, sOptAttributeName1, sOptAttributeValue1, sOptAttributeName2, sOptAttributeValue2 )
The xml.getElementNextSiblingWithNameAndAttributes, xml.getElementNextSiblingWithNameAndAttributesAndAttribute and xml.getElementNextSiblingWithNameAndAttributesAndAttributeAndAttribute have been merged into a single function: hChild = xml.getElementNextSiblingWithNameAndAttributes ( hXMLElement, sOptElementName, sOptAttributeName0, sOptAttributeValue0, sOptAttributeName1, sOptAttributeValue1, sOptAttributeName2, sOptAttributeValue2 )
New function to get the indexes and the count of children of an xml element with a specific name and with specific attributes: nCount, tIndexes = xml.getElementChildCountWithNameAndAttributes ( hXMLElement, sOptElementName, sOptAttributeName0, sOptAttributeValue0, sOptAttributeName1, sOptAttributeValue1, sOptAttributeName2, sOptAttributeValue2 )
New functions: bFound = system.findFilesMatching ( tResult, sDirectory, sMatching ) --Work as the default system.findFiles, but allows to match a specific pattern. bFound = system.findDirectoriesMatching ( tResult, sDirectory, sMatching ) --Work as the default system.findDirectories, but allows to match a specific pattern.
Removed the following functions:
Added the following function for joypad sensors access:
Added the following functions for events management:
JPExtendedAPI.setCustomEventManagementEnabled ( bEnabled )
application.cancelEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.cancelObjectEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.cancelUserEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.pauseEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.pauseObjectEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.pauseUserEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.resumeEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.resumeObjectEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
application.resumeUserEvents ( sAIModelPatternToMatch, sHandlerPatternToMatch )
object.cancelEvents ( hObject, sAIModelPatternToMatch, sHandlerPatternToMatch )
object.pauseEvents ( hObject, sAIModelPatternToMatch, sHandlerPatternToMatch )
object.resumeEvents ( hObject, sAIModelPatternToMatch, sHandlerPatternToMatch )
user.cancelEvents ( hUser, sAIModelPatternToMatch, sHandlerPatternToMatch )
user.pauseEvents ( hUser, sAIModelPatternToMatch, sHandlerPatternToMatch )
user.resumeEvents ( hUser, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.cancelEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.cancelObjectEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.cancelUserEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.pauseEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.pauseObjectEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.pauseUserEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.resumeEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.resumeObjectEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
scene.resumeUserEvents ( hScene, sAIModelPatternToMatch, sHandlerPatternToMatch )
--JPExtendedAPI JPExtendedAPI.activate ( sUserToken, sActivationKey ) --NEW API FUNCTIONS: Note that you can use these function using both api.function ( ) or JPExtendedAPI.api_function ( ). Only the second case will have code completion. --animation animation.setCurrentAnimation ( hObject, nBlendLayer, sAnimation ) --application application.closeCurrentUserScene ( ) bOK, kLoadDetails = application.loadCurrentUserEnvironmentCompliant ( sName ) JPExtendedAPI.kLoadSuccess JPExtendedAPI.kLoadErrorLocalStorageNotFound JPExtendedAPI.kLoadErrorCurrentUserEnvironmentDoesNotExist JPExtendedAPI.kLoadErrorCurrentUserEnvironmentCorrupted JPExtendedAPI.kLoadErrorUnknown bOK, kSaveDetails = application.saveCurrentUserEnvironmentCompliant ( bOverride ) JPExtendedAPI.kSaveSuccess JPExtendedAPI.kSaveErrorNoLocalStorageDevice JPExtendedAPI.kSaveErrorNoLocalStorageWriteAccess JPExtendedAPI.kSaveErrorNoLocalStorageSpaceAndCanOpenStorageManager JPExtendedAPI.kSaveErrorNoLocalStorageSpaceAndCannotOpenStorageManager JPExtendedAPI.kSaveErrorLocalStorageDeviceChanged JPExtendedAPI.kSaveErrorLocalStorageDeviceRemoved JPExtendedAPI.kSaveErrorUnknown application.setMinFrameRate ( nFrameRate ) application.setMaxFrameRate ( nFrameRate ) --hashtable hashtable.push ( htHashtable, sKey, vValue ) metatable = hashtable.toMetatable ( htHashtable ) htHashtable = hashtable.fromMetatable ( metatable ) sString = hashtable.queryString ( htParams ) --hud hud.setButtonText ( hComponent, vText ) hud.setCheckText ( hComponent, vText ) hud.setEditText ( hComponent, vText ) hud.setLabelText ( hComponent, vText ) hud.setListItemTextAt ( hComponent, vText, nItem, nColumn ) hud.setComponentText ( hComponent, vText, nOptListItem, nOptListColumn ) hud.setComponentTextWithVariableTextHeight ( hComponent, vText, nNormalTextHeight, nMinTextHeight ) bYes = hud.getComponentIntersectsComponent ( hComponent0, hComponent1, bOptPermissive ) nMaxLineCount = hud.getComponentMaxVisibleLineCount ( hComponent ) nTextHeight = hud.getComponentTextHeightToMatchLineCount ( hComponent, nLineCount ) nRatio = hud.getComponentRatio ( hComponent ) nSizeX, nSizeY = hud.getComponentSizeInvariant ( hComponent ) nSizeX, nSizeY = hud.getComponentSizeVariant ( hComponent ) hUser = hud.getComponentUser ( hComponent ) nRayPntX, nRayPntY, nRayPntZ, nRayDirX, nRayDirY, nRayDirZ = hud.getCursorRay ( hUser ) nRayPntX, nRayPntY, nRayPntZ, nRayDirX, nRayDirY, nRayDirZ = hud.getPointRay ( x, y ) nAngle = hud.getSpinnerRotation ( nRotationBySecond, nAngleCount ) bYes = hud.isComponentAtPoint ( hComponent, x, y ) bYes = hud.isComponentUnderCursor ( hComponent ) bYes = hud.isEqualTo ( hComponent, hOtherComponent ) hud.postCallAction ( hUser, nDelay, sAction, vParam0, vParam1, vParam2, vParam3 ) hud.setComponentBackgroundImageMiddleUVOffset ( hComponent, nUVX, nUVY ) hud.setComponentBackgroundImageContainerSpaceUVOffset ( hComponent, nOffsetU, nOffsetV ) hud.setComponentBackgroundImageContainerSpaceUVScale ( hComponent, nScaleU, nScaleV ) hud.setComponentBackgroundImageScreenSpaceUVOffset ( hComponent, nOffsetU, nOffsetV ) hud.setComponentBackgroundImageScreenSpaceUVScale ( hComponent, nScaleU, nScaleV ) hud.setComponentOrigin ( hComponent, kOrigin, bKeepScreenSpacePosition ) hud.setComponentPosition ( hComponent, nOptX, nOptY ) hud.setComponentStrechableBackground ( hComponent, sTexture, nStrechUVX, nStrechUVY, nStrechCoefSizeX, nStrechCoefSizeY, nOptSpriteUVX, nOptSpriteUVY, nOptSpriteUVSX, nOptSpriteUVSY ) hud.setContainerRotation ( hComponent, nRotation ) hud.sizeComponentToFitText ( hComponent ) x, y = hud.transformPointFromInput ( x, y ) hud.translate ( hComponent, nTx, nTy ) --hud (screen space related functions) x, y = hud.getComponentScreenSpaceBottomCenter ( hComponent ) x, y = hud.getComponentScreenSpaceLeftCenter ( hComponent ) x, y = hud.getComponentScreenSpaceRightCenter ( hComponent ) x, y = hud.getComponentScreenSpaceTopCenter ( hComponent ) nSizeX, nSizeY = hud.getComponentScreenSpaceSize ( hComponent ) hud.setComponentScreenSpaceBottomLeftCorner ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceBottomRightCorner ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceCenter ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceTopLeftCorner ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceTopRightCorner ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceBottomCenter ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceLeftCenter ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceRightCenter ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceTopCenter ( hComponent, nPositionX, nPositionY ) hud.setComponentScreenSpaceSize ( hComponent, nSizeX, nSizeY ) --input nRayPntX, nRayPntY, nRayPntZ, nRayDirX, nRayDirY, nRayDirZ = input.getCursorRay ( hUser ) nRayPntX, nRayPntY, nRayPntZ, nRayDirX, nRayDirY, nRayDirZ = input.getPointRay ( x, y ) x, y = input.transformPointFromHud ( x, y ) --math nMin = math.min ( nValue0, nValue1, nValue2, ... ) nMax = math.max ( nValue0, nValue1, nValue2, ... ) nResult = math.sum ( nValue0, nValue1, ... ) --object object.destroy ( hObject ) sTag = object.getTag ( hObject ) bYes, nAngle = object.isLookingAtPoint ( hObject, nPointX, nPointY, nPointZ, kSpace, nMaxAllowedAngle ) object.lookAtObject ( hObject, hOtherObject, nOptFactor, nOptOffsetY ) object.setRotation ( hObject, nOptRX, nOptRY, nOptRZ, kSpace ) object.setTag ( hObject, sTag ) object.setTranslation ( hObject, nOptTX, nOptTY, nOptTZ, kSpace ) --scene scene.close ( hScene ) sCollisionType, vHitObject, nHitDist, nHitID, x, y, z, i, j, k = scene.getFirstHit ( hScene, nRayPosX, nRayPosY, nRayPosZ, nRayDirX, nRayDirY, nRayDirZ, nRayLength ) --string sFolder, sFile, sExtension, sParameters = string.explodePath ( sPath ) sChar = string.getAt ( sString, nIndex ) sChar = string.getFirst ( sString ) sChar = string.getLast ( sString ) sSubString = string.getSubStringWithDelimiter ( sString, sDelimiter, nPosition ) sString = string.setByte ( sString, nIndex, nByte ) --system bFound = system.findFilesMatching ( tResult, sDirectory, sMatching ) bFound = system.findDirectoriesMatching ( tResult, sDirectory, sMatching ) nHours, nMinutes, nSeconds = system.getClock ( ) nHoursAngle, nMinutesAngle, nSecondsAngle = system.getClockAngles ( nOptHours, nOptMinutes, nOptSeconds ) sUnixTimestamp = system.getUnixTimestampStringForDate ( nYear, nOptMonth, nOptDay, nOptHours, nOptMinutes, nOptSeconds ) bYes = system.isYearBissextile ( nYear ) --table bFound, tIndexes = table.find ( tTable, vValue ) nIndex = table.findFirst ( tTable, vValue, nOptStartIndex ) sRes = table.implode ( tStringsToImplode, sDelimiter ) table.insert ( tTable, vValue ) tTable = table.newInstance ( v0, v1, v2, ... ) table.pushAt ( tTable, nIndex, vValue ) table.sort ( tTable, bOptSortStringNumbersLikeNumbers ) --user nRatio = user.getViewportRatio ( hUser ) --xml nCount, tIndexes = xml.getElementChildCountWithNameAndAttributes ( hXMLElement, sOptElementName, sOptAttributeName0, sOptAttributeValue0, sOptAttributeName1, sOptAttributeValue1, sOptAttributeName2, sOptAttributeValue2 ) hChild = xml.getElementFirstChildWithNameAndAttributes ( hXMLElement, sOptElementName, sOptAttributeName0, sOptAttributeValue0, sOptAttributeName1, sOptAttributeValue1, sOptAttributeName2, sOptAttributeValue2 ) hChild = xml.getElementNextSiblingWithNameAndAttributes ( hXMLElement, sOptElementName, sOptAttributeName0, sOptAttributeValue0, sOptAttributeName1, sOptAttributeValue1, sOptAttributeName2, sOptAttributeValue2 )
JPExtendedAPI is a very nice pack. Its particularity is that it does not create a new API, but it improves the existing ones by adding new functions very useful when creating your game.
A good example is the ability to know at any time if a key is pressed or not. This feature seems elementary, but is not present in the API offered by ShiVa, and therefore it was necessary to track by yourself the events for each of the keys you were interested in and store its state using a boolean variable, which is very boring... Now, thanks to JPExtendedAPI you have the input.isKeyboardKeyDown ( kKeyCode ) function that can be called from anywhere in the code, without having to manage the keyboard events by yourself.
Below some features offered by JPExtendedAPI:
hashtable.push ( htHashtable, sKey, vValue ) hud.setContainerRotation ( hComponent, nRotation ) hud.sizeComponentToFitText ( hComponent ) sRes = table.implode ( tStringsToImplode, sDelimiter ) table.sort ( tTable, bOptSortStringNumbersLikeNumbers )
These functions represent a small part of what JPExtendedAPI offers, to know all of them, go to API page by following the link below.