1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2024-12-28 04:18:21 +01:00
Diya-API/Diya/AssetManager.class.st

55 lines
1016 B
Smalltalk
Raw Normal View History

Class {
#name : #AssetManager,
#superclass : #DiyaBaseObject,
#instVars : [
'assets',
'base'
],
#category : #'Diya-Core'
}
{ #category : #'instance creation' }
AssetManager class >> fromLocation: loc [
^self new from: loc; yourself
]
2022-08-09 00:22:18 +02:00
{ #category : #adding }
AssetManager >> addAsset: value [
assets at: value name put: value.
^ value
2022-08-09 00:22:18 +02:00
]
{ #category : #adding }
AssetManager >> addAssetName: name value: value [
assets at: name put: value.
^ value
2022-08-09 00:22:18 +02:00
]
{ #category : #'instance creation' }
AssetManager >> from: location [
base := location
]
{ #category : #initialization }
AssetManager >> initialize [
super initialize.
assets := Dictionary new.
base := DiyaSystemSettings assetPath
]
2022-08-09 00:22:18 +02:00
{ #category : #accessing }
AssetManager >> name: name [
^assets at: name.
]
{ #category : #accessing }
AssetManager >> name: name of: type [
^assets at: name ifAbsentPut: [
(type fromFile: (base / name))].
]
2022-08-09 00:22:18 +02:00
{ #category : #accessing }
AssetManager >> texture: name [
^self name: name of: DiyaImageTex
]