# Manages all assets usable by an Mnit app
module assets
-import app
-import display
+import mnit_app
+import mnit::display
# General asset
-interface Asset
+interface MnitAsset
end
# An String is an asset, returned from a text file
redef class String
- super Asset
+ super MnitAsset
end
# An Image is an asset
redef interface Image
- super Asset
+ super MnitAsset
end
redef class App
# Load a genereal asset from file name
# Will find the file within the assets/ directory
# Crashes if file not found
- fun load_asset( id: String ): Asset
+ fun load_asset( id: String ): MnitAsset
do
var asset = try_loading_asset( id )
if asset == null then # error
- log_error( "asset <{id}> could not be loaded." )
+ print_error "asset <{id}> could not be loaded."
abort
else
return asset
if asset isa Image then
return asset
else
- log_error( "asset <{id}> is not an image." )
+ print_error "asset <{id}> is not an image."
abort
end
end
# Load an assets without error if not found
- fun try_loading_asset( id: String ): nullable Asset is abstract
+ fun try_loading_asset( id: String ): nullable MnitAsset is abstract
end