• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] How to display images in we?!

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
333
The question is, how can I add an image on my map? For example, I try to create a legendary map(the world map), and then put the image on the floor to sketch it. However, the image should be the size of the entire map, so if the size of the map is 480x480, the image size should be the same?

JASS:
function CreateImageEx takes string imagePath, real size, real x, real y, real z, boolean showImage returns image
    local image i = CreateImage(imagePath, size, size, 0, x - (size / 2), y - (size / 2), z, 0, 0, 0, 2)
    call SetImageRenderAlways(i, true)
    call ShowImage(i, showImage)
    return i
endfunction

function CreateImageExLoc takes string imagePath, real size, location whichLocation, real z, boolean showImage returns image
    return CreateImageEx(imagePath, size, GetLocationX(whichLocation), GetLocationY(whichLocation), z, showImage)
endfunction


Untitled Trigger 001
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        Set tmpPoint = (Center of (Playable map area))
        Custom script:   set udg_tmpImage = CreateImageExLoc["war3mapImported\high-resolution-world-maps-2.blp" udg_tmpPoint,0,true]
 
Using such a big image won't work. Images are only visible when the point that is seen as image center is on the local screen, which is hardly the case for such a big image beeing as big as the whole map.

JASS:
CreateImage(imagePath, size, size, 0, x - (size / 2), y - (size / 2), z, 0, 0, 0, 2)
This is not a good way to create an image. It result will be that the image is where you want it to be, but it is only visible when the bottomleft of the image is on the screen. It also means that you have to use the size/2 offset in every image reposing.


Better is this one.
JASS:
CreateImage(file, sizeX, sizeY, 0, x, y, z, sizeX/2, sizeY/2, 0, 2)
It creates an image and adjusts the image center by sizeX/2 and sizeY/2. Now the image is visible when the images center is on the screen and using SetImagePosition will move the image center to the wanted x&y.
 
Status
Not open for further replies.
Top