Type Function Return value DisplayObject Revision Release 2024.3703 Keywords steam, steamworks, newImageRect See also steamworks.getAchievementImageInfo() steamworks.getUserImageInfo() steamworks.newTexture() steamworks.*
Displays a Steam image by its unique imageHandle property that was retrieved by the steamworks.getAchievementImageInfo() or steamworks.getUserImageInfo() functions.
This function works like the Corona display.newImageRect() function where you can specify the width and height at which the Steam image will be scaled relative to the content width and height defined in config.lua
.
This function will return nil
in the following cases:
false
, indicating that the application is not currently connected to the Steam client.steamworks.newImageRect( [parent,] imageHandle, width, height )
GroupObject. An optional display group in which to insert the image.
Number. Unique identifier of the Steam image to load and display. This identifier is provided by an ImageInfo object’s imageHandle property.
Number. The content width at which to scale the Steam image.
Number. The content height at which to scale the Steam image.
local steamworks = require( "plugin.steamworks" ) -- Fetch information about the currently logged in user's medium-sized avatar local imageInfo = steamworks.getUserImageInfo( "mediumAvatar" ) if ( imageInfo == nil ) then return end -- Display the user's avatar scaled to 64x64 content coordinates on the left local avatarImage = steamworks.newImageRect( imageInfo.imageHandle, 64, 64 ) if ( avatarImage ) then avatarImage.x = display.contentWidth * 0.25 avatarImage.y = display.contentCenterY end -- Display the user's avatar unscaled and "pixel perfect" on the right local avatarImage = steamworks.newImageRect( imageInfo.imageHandle, imageInfo.pixelWidth * display.contentScaleX, imageInfo.pixelHeight * display.contentScaleY ) if ( avatarImage ) then avatarImage.x = display.contentWidth * 0.75 avatarImage.y = display.contentCenterY end