- Joined
- May 9, 2011
- Messages
- 37
Hey guys I've been playing around with Maker's CustomWindow to make a full screen hero selection system. The problem is that when I create an image to be mapped to a window, the image is always drawn below the image of the window.
Here is the code:
Here is a picture of what happens:
That was the result. If you adjust the camera angle via the scroll wheel, you can see whats below:
I suspect it has to do with either
All other leaks n shit that are not destroyed here are destroyed within another function which is unimportant to the problem.
Thanks in advance,
Tauren_009
edit:
I managed to get the icon be shown above the window but its being rendered weirdly
Here is the code:
JASS:
scope WindowManager initializer Init
globals
private constant string TRACKABLE_MODEL = "Doodads\\Terrain\\InvisiblePlatform\\InvisiblePlatform.mdx"
private constant integer NUMBER_OF_HEROES = 2
private constant integer BACKGROUND_ID = 'B000'
private constant integer WINDOW_SIZE = 100
private constant integer WINDOW_SIZE_BONUS = 15
private constant integer WINDOW_X_OFFSET = 100
private constant integer WINDOW_START_X = -700
private constant integer WINDOW_START_Y = 100
private constant real WINDOW_SCALE = 0.3
private constant integer WINDOW_HERO_LENGTH_COUNT = 3
private constant integer WINDOW_HERO_WIDTH_COUNT = 8
private Table table
private string array title
private string array text
private string array icons
private integer array units
private trackable array trackables
private image array images
private CustomWindow array window
private destructable bg
endglobals
private function InitHeroes takes nothing returns nothing
// initialize stuff here
// I commented this stuff out as it is doesn't affect the height of the image
endfunction
private function InitializeHeroScreen takes nothing returns nothing
local integer row = 0
local integer col = 0
local image im
local real x = WINDOW_START_X
local real y = WINDOW_START_Y
local integer id
local integer i = 1
local CustomWindow CW
// probably has something to do with this (I've set the image type to 3 which should be drawn below the icon but its not)
set CW = CustomWindow.create(1.0, ((WINDOW_SIZE+WINDOW_SIZE_BONUS) + WINDOW_X_OFFSET)*WINDOW_HERO_LENGTH_COUNT, (WINDOW_SIZE + WINDOW_SIZE_BONUS)*WINDOW_HERO_WIDTH_COUNT, x, y, 3)
// I set the height just in case
call CW.setHeight(100)
call CW.show(true)
set window[i] = CW
loop
exitwhen i > NUMBER_OF_HEROES
set trackables[i] = CreateTrackable(TRACKABLE_MODEL, x, y, 0)
// image type is set to 1 and height to 200 just in case
set images[i] = CreateImage(icons[i], WINDOW_SIZE, WINDOW_SIZE, 0, x - WINDOW_SIZE/2, y - WINDOW_SIZE/2, 200, 0, 0, 200, 1)
call SetImageRenderAlways(images[i], true)
call ShowImage(images[i], true)
set id = GetHandleId(trackables[i])
set table[id].real[0] = x
set table[id].real[1] = y
set table[id].real[2] = count
set table[id].integer[3] = units[i]
set x = x + WINDOW_X_OFFSET
set i = i + 1
call TriggerRegisterTrackableTrackEvent(track, trackables[i])
call TriggerRegisterTrackableHitEvent(hit, trackables[i])
endloop
endfunction
function Init takes nothing returns nothing
local unit dum = CreateUnit(NEUTRAL_PASSIVE, DUMMY_ID, 0, 0, 270)
local integer i = 0
local CustomWindow CW
local CustomTextWindow CTW
call TriggerAddAction(track, function Track)
call TriggerAddAction(hit, function Hit)
set table = Table.create()
set ct = NewTimer()
set bg = CreateDestructableZ(BACKGROUND_ID, 0, 0, 0, 270, 1000, 1)
if(GetPlayerSlotState(GetLocalPlayer()) == PLAYER_SLOT_STATE_PLAYING) then
call CameraSetupApplyForceDuration(gg_cam_Start_Camera, true, 0.00)
call LockCameraToUnit(GetLocalPlayer(), dum)
call InitHeroes()
call InitializeHeroScreen()
endif
set dum = null
endfunction
endscope
Here is a picture of what happens:
That was the result. If you adjust the camera angle via the scroll wheel, you can see whats below:
I suspect it has to do with either
set CW = CustomWindow.create(1.0, ((WINDOW_SIZE+WINDOW_SIZE_BONUS) + WINDOW_X_OFFSET)*WINDOW_HERO_LENGTH_COUNT, (WINDOW_SIZE + WINDOW_SIZE_BONUS)*WINDOW_HERO_WIDTH_COUNT, x, y, 3)
or set images[i] = CreateImage(icons[i], WINDOW_SIZE, WINDOW_SIZE, 0, x - WINDOW_SIZE/2, y - WINDOW_SIZE/2, 200, 0, 0, 200, 1)
, which is weird as I set the image type of CW to 3 and images to 1, which means images is drawn above CW and adjusted the height just in case (to no effect).All other leaks n shit that are not destroyed here are destroyed within another function which is unimportant to the problem.
Thanks in advance,
Tauren_009
edit:
I managed to get the icon be shown above the window but its being rendered weirdly
Attachments
Last edited: