Skip to content
Snippets Groups Projects
Commit 2be1bd4f authored by dg's avatar dg
Browse files

neat!

git-svn-id: http://svn.net-core.org/repos/t-engine4@5486 51575b47-30f0-44d4-a5cc-537603b46e54
parent a305e46e
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ function _M:init()
self.areas = {}
self.areas_name = {}
self.status = {}
self.last_pos = { x = 0, y = 0 }
end
--- Called when a mouse is pressed
......@@ -36,6 +37,7 @@ end
-- @param isup true if the key was released, false if pressed
-- @param force_name if not nil only the zone with this name may trigger
function _M:receiveMouse(button, x, y, isup, force_name, extra)
self.last_pos = { x = x, y = y }
self.status[button] = not isup
if not isup then return end
......@@ -53,7 +55,12 @@ function _M:receiveMouse(button, x, y, isup, force_name, extra)
end
end
function _M:getPos()
return self.last_pos.x, self.last_pos.y
end
function _M:receiveMouseMotion(button, x, y, xrel, yrel, force_name, extra)
self.last_pos = { x = x, y = y }
if _M.drag then
if _M.drag.on_move then return _M.drag.on_move(_M.drag, button, x, y, xrel, yrel) end
end
......
......@@ -168,107 +168,58 @@ function _M:drawFrame(f, x, y, r, g, b, a, w, h, total_w, total_h, loffset_x, lo
total_w = total_w or 0
total_h = total_h or 0
f.w = w or f.w
f.h = h or f.h
x = math.floor(x)
y = math.floor(y)
f.w = math.floor(w or f.w)
f.h = math.floor(h or f.h)
clip_area = clip_area or { h = f.h, w = f.w }
-- check if anything is visible
-- first of all check if anything is visible
if total_h + f.h > loffset_y and total_h < loffset_y + clip_area.h then
local clip_y_start = 0
local clip_y_end = 0
local total_clip_y_start = 0
local total_clip_y_end = 0
local one_by_tex_h = 1
local fw = 0
local fh = 0
-- if it started before visible area then compute its top clip
if total_h < loffset_y then
clip_y_start = loffset_y - total_h
end
-- if it ended after visible area then compute its bottom clip
if total_h + f.b7.h > loffset_y + clip_area.h then
clip_y_end = total_h + f.b7.h - loffset_y - clip_area.h
total_clip_y_end = clip_y_end
end
-- check if top is visible
if total_h + f.b7.h > loffset_y and total_h < loffset_y + clip_area.h then
one_by_tex_h = 1 / f.b7.th
fw, fh = f.b7.w, f.b7.h
f.b7.t:toScreenPrecise(x, y, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b7.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- left top
one_by_tex_h = 1 / f.b8.th
fw, fh = f.w - f.b7.w - f.b9.w, f.b8.h
f.b8.t:toScreenPrecise(x + f.b7.w, y, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b8.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- top
one_by_tex_h = 1 / f.b9.th
fw, fh = f.b9.w, f.b9.h
f.b9.t:toScreenPrecise(x + f.w - f.b9.w, y, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b9.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- right top
-- check if top (top right, top and top left) is visible
if total_h + f.b8.h > loffset_y and total_h < loffset_y + clip_area.h then
util.clipTexture({_tex = f.b7.t, _tex_w = f.b7.tw, _tex_h = f.b7.th}, x, y, f.b7.w, f.b7.h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) --left top
_, _, clip_y_start, clip_y_end = util.clipTexture({_tex = f.b8.t, _tex_w = f.b8.tw, _tex_h = f.b8.th}, x + f.b7.w, y, f.w - f.b7.w - f.b9.w, f.b8.h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- top
util.clipTexture({_tex = f.b9.t, _tex_w = f.b9.tw, _tex_h = f.b9.th}, x + f.w - f.b9.w, y, f.b9.w, f.b9.h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- right top
total_clip_y_start = clip_y_start
total_clip_y_end = clip_y_end
else
total_clip_y_start = f.b7.h
end
total_h = total_h + f.b7.h
local mid_h = f.h - f.b2.h - f.b8.h
clip_y_start = 0
clip_y_end = 0
-- if it started before visible area then compute its top clip
if total_h < loffset_y then
clip_y_start = loffset_y - total_h
total_clip_y_start = f.b8.h
end
-- if it ended after visible area then compute its bottom clip
if total_h + mid_h > loffset_y + clip_area.h then
clip_y_end = total_h + mid_h - loffset_y - clip_area.h
total_clip_y_end = total_clip_y_end + clip_y_end
end
-- check if center is visible
if total_h + mid_h > loffset_y and total_h < loffset_y + clip_area.h then
one_by_tex_h = 1 / f.b4.th
fw, fh = f.b4.w, mid_h
f.b4.t:toScreenPrecise(x, y + f.b7.h - total_clip_y_start, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b4.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- left
one_by_tex_h = 1 / f.b6.th
fw, fh = f.b6.w, mid_h
f.b6.t:toScreenPrecise(x + f.w - f.b9.w, y + f.b7.h - total_clip_y_start, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b6.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- right
one_by_tex_h = 1 / f.b5.th
fw, fh = f.w - f.b7.w - f.b3.w, mid_h
f.b5.t:toScreenPrecise(x + f.b7.w, y + f.b7.h - total_clip_y_start, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b5.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- center
total_h = total_h + f.b8.h
local mid_h = math.floor(f.h - f.b2.h - f.b8.h)
-- check if mid (right, center and left) is visible
if total_h + mid_h > loffset_y and total_h < loffset_y + clip_area.h then
util.clipTexture({_tex = f.b4.t, _tex_w = f.b4.tw, _tex_h = f.b4.th}, x, y + f.b7.h - total_clip_y_start, f.b4.w, mid_h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- left
_, _, clip_y_start, clip_y_end = util.clipTexture({_tex = f.b6.t, _tex_w = f.b6.tw, _tex_h = f.b6.th}, x + f.w - f.b9.w, y + f.b7.h - total_clip_y_start, f.b6.w, mid_h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- center
util.clipTexture({_tex = f.b5.t, _tex_w = f.b5.tw, _tex_h = f.b5.th}, x + f.b7.w, y + f.b7.h - total_clip_y_start, f.w - f.b7.w - f.b3.w, mid_h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- right
total_clip_y_start = total_clip_y_start + clip_y_start
total_clip_y_end = total_clip_y_end + clip_y_end
else
total_clip_y_start = total_clip_y_start + mid_h
end
total_h = total_h + mid_h
clip_y_start = 0
clip_y_end = 0
-- if it started before visible area then compute its top clip
if total_h < loffset_y then
clip_y_start = loffset_y - total_h
end
-- if it ended after visible area then compute its bottom clip
if total_h + f.b2.h > loffset_y + clip_area.h then
clip_y_end = total_h + f.b2.h - loffset_y - clip_area.h
total_clip_y_end = total_clip_y_end + clip_y_end
end
-- check if bottom is visible
if total_h + f.b2.h > loffset_y and total_h < loffset_y + clip_area.h then
one_by_tex_h = 1 / f.b1.th
fw, fh = f.b1.w, f.b1.h
f.b1.t:toScreenPrecise(x, y + f.h - f.b1.h - total_clip_y_start, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b1.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- left bottom
one_by_tex_h = 1 / f.b2.th
fw, fh = f.w - f.b7.w - f.b9.w, f.b2.h
f.b2.t:toScreenPrecise(x + f.b7.w, y + f.h - f.b2.h - total_clip_y_start, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b2.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- bottom
-- check if bottom (bottom right, bottom and bottom left) is visible
if total_h + f.b2.h > loffset_y and total_h < loffset_y + clip_area.h then
util.clipTexture({_tex = f.b1.t, _tex_w = f.b1.tw, _tex_h = f.b1.th}, x, y + f.h - f.b1.h - total_clip_y_start, f.b1.w, f.b1.h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- left bottom
_, _, clip_y_start, clip_y_end = util.clipTexture({_tex = f.b2.t, _tex_w = f.b2.tw, _tex_h = f.b2.th}, x + f.b7.w, y + f.h - f.b2.h - total_clip_y_start, f.w - f.b7.w - f.b9.w, f.b2.h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- bottom
util.clipTexture({_tex = f.b3.t, _tex_w = f.b3.tw, _tex_h = f.b3.th}, x + f.w - f.b3.w, y + f.h - f.b3.h - total_clip_y_start, f.b3.w, f.b3.h, 0, total_h, 0, loffset_y, clip_area, r, g, b, a) -- right bottom
one_by_tex_h = 1 / f.b3.th
fw, fh = f.b3.w, f.b3.h
f.b3.t:toScreenPrecise(x + f.w - f.b3.w, y + f.h - f.b3.h - total_clip_y_start, fw, fh - (clip_y_start + clip_y_end), 0, fw / f.b3.tw, clip_y_start * one_by_tex_h, (fh - clip_y_end) * one_by_tex_h, r, g, b, a ) -- right bottom
total_clip_y_start = total_clip_y_start + clip_y_start
total_clip_y_end = total_clip_y_end + clip_y_end
else
total_clip_y_start = total_clip_y_start + f.b2.h
end
return 0, 0, total_clip_y_start, total_clip_y_end
......
......@@ -92,7 +92,7 @@ function _M:generate()
end
-- if it ended after visible area then compute its bottom clip
if total_h + h > loffset_y + dest_area.h then
clip_y_end = total_h + h - loffset_y - dest_area.h
clip_y_end = total_h + h - loffset_y - dest_area.h
end
-- get entity texture with everything it has i.e particles
local texture = item.object:getEntityFinalTexture(nil, h, h)
......
......@@ -44,7 +44,7 @@ function _M:init(t)
self.all_clicks = t.all_clicks
self.floating_headers = t.floating_headers or true
self.hide_columns = t.hide_columns or false
self.dest_area = t.dest_area and t.dest_area or { h = self.h }
self.clip_area = t.clip_area and t.clip_area or { w = self.w, h = self.h }
self.text_shadow = t.text_shadow or self.text_shadow
self.click_select = t.click_select or false
self.only_display = t.only_display or false
......@@ -202,7 +202,7 @@ function _M:generateRow(row, force)
end
if col.direct_draw then
row.cells[j].w, row.cells[j].h = col.direct_draw(row, 0, 0, col.width, self.row_height, 0, 0, 0, 0, self.dest_area) or self.row_height, self.row_height
row.cells[j].w, row.cells[j].h = col.direct_draw(row, 0, 0, col.width, self.row_height, 0, 0, 0, 0, self.clip_area) or self.row_height, self.row_height
else
if type(col.display_prop) == "function" then
text = tostring(col.display_prop(row))
......@@ -221,9 +221,9 @@ function _M:generateRow(row, force)
row.h = self.row_height or max_h
end
function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x, loffset_y, dest_area)
function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x, loffset_y, clip_area)
nb_keyframes = (nb_keyframes or 0) * 0.5
dest_area = dest_area or self.dest_area
clip_area = clip_area or self.clip_area
local column_w_offset = x
local clip_y_start = 0
local clip_y_end = 0
......@@ -246,16 +246,16 @@ function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x,
if not self.only_display then
if self.sel == row_i then
if self.focused then
self:drawFrame(col.frame_sel, column_w_offset, y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, dest_area)
self:drawFrame(col.frame_sel, column_w_offset, y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, clip_area)
else
self:drawFrame(col.frame_usel, column_w_offset, y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, dest_area)
self:drawFrame(col.frame_usel, column_w_offset, y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, clip_area)
end
else
if row.focus_decay then
if self.focused then self:drawFrame(col.frame_sel, column_w_offset, y, 1, 1, 1, row.focus_decay * self.one_by_focus_decay, nil, nil, 0, total_h, 0, loffset_y, dest_area)
else self:drawFrame(col.frame_usel, column_w_offset, y, 1, 1, 1, row.focus_decay * self.one_by_focus_decay, nil, nil, 0, total_h, 0, loffset_y, dest_area) end
if self.focused then self:drawFrame(col.frame_sel, column_w_offset, y, 1, 1, 1, row.focus_decay * self.one_by_focus_decay, nil, nil, 0, total_h, 0, loffset_y, clip_area)
else self:drawFrame(col.frame_usel, column_w_offset, y, 1, 1, 1, row.focus_decay * self.one_by_focus_decay, nil, nil, 0, total_h, 0, loffset_y, clip_area) end
else
self:drawFrame(col.frame, column_w_offset, y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, dest_area)
self:drawFrame(col.frame, column_w_offset, y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, clip_area)
end
end
......@@ -263,7 +263,7 @@ function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x,
local c = row.special_bg
if type(c) == "function" then c = c(row) end
if c then
self:drawFrame(col.frame_special, column_w_offset, y, c.r, c.g, c.b, c.a or 1, nil, nil, 0, total_h, 0, loffset_y, dest_area)
self:drawFrame(col.frame_special, column_w_offset, y, c.r, c.g, c.b, c.a or 1, nil, nil, 0, total_h, 0, loffset_y, clip_area)
end
end
if total_h < loffset_y then
......@@ -274,7 +274,7 @@ function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x,
if clip_y_start > clip_maxy_start then clip_maxy_start = clip_y_start end
if col.direct_draw then
_, _, clip_x_start, clip_x_end, clip_y_start, clip_y_end = col.direct_draw(row, column_w_offset, y, col.width, self.row_height, total_w, total_h, loffset_x, loffset_y, dest_area) or 0, 0, 0, 0, 0, 0
_, _, clip_x_start, clip_x_end, clip_y_start, clip_y_end = col.direct_draw(row, column_w_offset, y, col.width, self.row_height, total_w, total_h, loffset_x, loffset_y, clip_area) or 0, 0, 0, 0, 0, 0
frame_clip_y = 0
elseif row.cells[j]._tex then
local center_h = ( (self.row_height and self.row_height or row.cells[j].h) - row.cells[j].h) * 0.5
......@@ -285,8 +285,8 @@ function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x,
frame_clip_y = center_h
end
-- if it ended after visible area then compute its bottom clip
if total_h + row.cells[j].h + center_h > loffset_y + dest_area.h then
clip_y_end = total_h + row.cells[j].h + center_h - loffset_y - dest_area.h
if total_h + row.cells[j].h + center_h > loffset_y + clip_area.h then
clip_y_end = total_h + row.cells[j].h + center_h - loffset_y - clip_area.h
end
-- clip clipping to avoid texture display errors
......@@ -526,8 +526,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
local clip_y_start = 0
local clip_y_end = 0
local frame_clip_y = 0
local dest_area = {}
dest_area.h, dest_area.fixed = self.dest_area.h, self.dest_area.fixed
local clip_area = table.clone(self.clip_area)
local frame_clip_y_start, frame_clip_y_end
local max_h = 0
......@@ -542,10 +541,10 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
else self:drawFrame(col.frame_col_sel, x + current_x, y + current_y) end
local one_by_tex_h = 1 / col._tex_h
col._tex:toScreenPrecise(x + current_x + col.frame_sel.b4.w, y + current_y + center_h, col.w, col.h - (clip_y_start + clip_y_end), 0, col.w / col._tex_w, clip_y_start * one_by_tex_h, (col.h - clip_y_end) * one_by_tex_h )
elseif total_h + self.max_h_columns > loffset_y and total_h < loffset_y + dest_area.h then
elseif total_h + self.max_h_columns > loffset_y and total_h < loffset_y + clip_area.h then
if self.cur_col == j then _, _, frame_clip_y_start, frame_clip_y_end = self:drawFrame(col.frame_col, x + current_x, y + current_y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, dest_area)
else _, _, frame_clip_y_start, frame_clip_y_end = self:drawFrame(col.frame_col_sel, x + current_x, y + current_y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, dest_area) end
if self.cur_col == j then _, _, frame_clip_y_start, frame_clip_y_end = self:drawFrame(col.frame_col, x + current_x, y + current_y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, clip_area)
else _, _, frame_clip_y_start, frame_clip_y_end = self:drawFrame(col.frame_col_sel, x + current_x, y + current_y, nil, nil, nil, nil, nil, nil, 0, total_h, 0, loffset_y, clip_area) end
self.mouse:updateZone(("column header%d"):format(j), current_x, current_y, col.width, self.row_height - frame_clip_y_start - frame_clip_y_end)
if self.only_display then frame_clip_y = center_h else frame_clip_y = loffset_y - total_h end
......@@ -557,11 +556,11 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
end
-- if it ended after visible area then compute its bottom clip
if total_h + col.h + center_h > loffset_y + dest_area.h then
clip_y_end = total_h + col.h + center_h - loffset_y - dest_area.h
if total_h + col.h + center_h > loffset_y + clip_area.h then
clip_y_end = total_h + col.h + center_h - loffset_y - clip_area.h
end
local one_by_tex_h = 1 / col._tex_h
if total_h + col.h > loffset_y and total_h < loffset_y + dest_area.h then
if total_h + col.h > loffset_y and total_h < loffset_y + clip_area.h then
col._tex:toScreenPrecise(x + current_x + col.frame_sel.b4.w, y + current_y + center_h - frame_clip_y, col.w, col.h - (clip_y_start + clip_y_end), 0, col.w / col._tex_w, clip_y_start * one_by_tex_h, (col.h - clip_y_end) * one_by_tex_h )
end
end
......@@ -572,10 +571,10 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
max_h = self.row_height or max_h
if self.floating_headers then
dest_area.h = dest_area.h - max_h
clip_area.h = clip_area.h - max_h
current_y = current_y + max_h
loffset_y = loffset_y + max_h
elseif total_h + max_h > loffset_y and total_h < loffset_y + dest_area.h then
elseif total_h + max_h > loffset_y and total_h < loffset_y + clip_area.h then
current_y = current_y + max_h
if not self.only_display then current_y = current_y + total_h - loffset_y end
end
......@@ -592,12 +591,12 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
if self.focus_decay_max then self.list[self.sel].focus_decay = self.focus_decay_max end
-- if we are too deep then end this
if total_h > loffset_y + dest_area.h then return end
if total_h > loffset_y + clip_area.h then return end
for i = 1, #self.list do
row = self.list[i]
-- if its visible then draw it
if total_h + row.h > loffset_y and total_h < loffset_y + dest_area.h then
_, _, clip_y_start, clip_y_end = self:drawRow(row, i, nb_keyframes, x, y + current_y, 0, total_h, 0, loffset_y, dest_area)
if total_h + row.h > loffset_y and total_h < loffset_y + clip_area.h then
_, _, clip_y_start, clip_y_end = self:drawRow(row, i, nb_keyframes, x, y + current_y, 0, total_h, 0, loffset_y, clip_area)
row.last_display_x = screen_x
row.last_display_y = screen_y + current_y
......@@ -615,7 +614,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
-- add full size of row
total_h = total_h + row.h
-- if we are too deep then end this
if total_h > loffset_y + dest_area.h then break end
if total_h > loffset_y + clip_area.h then break end
end
-- show scrollbar only if there is one, total size of UI element is greater than visible one and only_display switch is not set
......
......@@ -1284,6 +1284,64 @@ local hex_opposed_dir = table.readonly{
util = {}
function util.clipOffset(w, h, total_w, total_h, loffset_x, loffset_y, dest_area)
w, h = math.floor(w), math.floor(h)
local clip_y_start = 0
local clip_y_end = 0
local clip_x_start = 0
local clip_x_end = 0
-- if its visible then compute how much of it needs to be clipped, take centering into account
if total_h < loffset_y then clip_y_start = loffset_y - total_h end
-- if it ended after visible area then compute its bottom clip
if total_h + h > loffset_y + dest_area.h then clip_y_end = total_h + h - (loffset_y + dest_area.h) end
-- if its visible then compute how much of it needs to be clipped, take centering into account
if total_w < loffset_x then clip_x_start = loffset_x - total_w end
-- if it ended after visible area then compute its bottom clip
if total_w + w > loffset_x + dest_area.w then clip_x_end = total_w + w - (loffset_x + dest_area.w) end
if clip_x_start > w then clip_x_start = w end
if clip_x_end < 0 then clip_x_end = 0 end
if clip_y_start > h then clip_y_start = h end
if clip_y_end < 0 then clip_y_end = 0 end
return clip_x_start, clip_x_end, clip_y_start, clip_y_end
end
function util.clipTexture(texture, x, y, w, h, total_w, total_h, loffset_x, loffset_y, dest_area, r, g, b, a)
if not texture then return 0, 0, 0, 0 end
x, y, w, h = math.floor(x), math.floor(y), math.floor(w), math.floor(h)
local clip_y_start = 0
local clip_y_end = 0
local clip_x_start = 0
local clip_x_end = 0
-- if its visible then compute how much of it needs to be clipped, take centering into account
if total_h < loffset_y then clip_y_start = loffset_y - total_h end
-- if it ended after visible area then compute its bottom clip
if total_h + h > loffset_y + dest_area.h then clip_y_end = total_h + h - (loffset_y + dest_area.h) end
-- if its visible then compute how much of it needs to be clipped, take centering into account
if total_w < loffset_x then clip_x_start = loffset_x - total_w end
-- if it ended after visible area then compute its bottom clip
if total_w + w > loffset_x + dest_area.w then clip_x_end = total_w + w - (loffset_x + dest_area.w) end
local one_by_tex_h = 1 / texture._tex_h
local one_by_tex_w = 1 / texture._tex_w
--talent icon
texture._tex:toScreenPrecise(x, y, w - (clip_x_start + clip_x_end), h - (clip_y_start + clip_y_end), clip_x_start * one_by_tex_w, (w - clip_x_end) * one_by_tex_w, clip_y_start * one_by_tex_h, (h - clip_y_end) * one_by_tex_h, r, g, b, a)
if clip_x_start > w then clip_x_start = w end
if clip_x_end < 0 then clip_x_end = 0 end
if clip_y_start > h then clip_y_start = h end
if clip_y_end < 0 then clip_y_end = 0 end
return clip_x_start, clip_x_end, clip_y_start, clip_y_end
end
local is_hex = 0
function util.hexOffset(x)
return 0.5 * (x % 2) * is_hex
......
This diff is collapsed.
......@@ -883,7 +883,7 @@ void create_particles_thread()
MAX_THREADS = nb_cpus - 1;
MAX_THREADS = (MAX_THREADS < 1) ? 1 : MAX_THREADS;
MAX_THREADS = 1;
// MAX_THREADS = 1;
threads = calloc(MAX_THREADS, sizeof(particle_thread));
cur_thread = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment