Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Howto:Dynamic Liveries via Canvas
(view source)
Revision as of 22:46, 17 September 2014
12 bytes removed
,
22:46, 17 September 2014
m
→Canvas Code
:
more intuitive to use a hash here ?
Line 66:
Line 66:
# vector with all images added (beginning at 0)
# vector with all images added (beginning at 0)
−
var layers =
[]
;
+
var layers =
{}
;
# texture path
# texture path
var path="Aircraft/EF2000/Models/";
var path="Aircraft/EF2000/Models/";
foreach(var image; ['EF2000.png','EF2000-dirt.png']) {
foreach(var image; ['EF2000.png','EF2000-dirt.png']) {
−
# append each added image to a vector so that we can address them later on
+
# Put a raster image into the canvas
and save the image in a hash: layers['EF2000.png].setScale(0.2);
−
append(layers,
+
layers[image] =
root.createChild("image")
−
# Put a raster image into the canvas
−
root.createChild("image")
.setFile( path~image )
.setFile( path~image )
.setSize(2048,2048)
.setSize(2048,2048)
−
);
}
}
Hooray
Administrators
19,527
edits
Navigation menu
Personal tools
Create account
Log in
Namespaces
Howto
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Village pump
Help
Portals
User
Developer
Wiki
FlightGear
Website
Forum
Mailing lists
Bug tracker
Source
Scenery
Liveries
Build server
Tools
Upload file
Special pages
Printable version