simplify style system

This commit is contained in:
airstruck
2015-12-07 04:22:36 -05:00
parent 367535ad33
commit 69703fdce0
41 changed files with 2227 additions and 292 deletions

View File

@@ -85,6 +85,7 @@ Backend.run = function ()
end
end
sdl.renderSetClipRect(renderer, nil)
sdl.setRenderDrawColor(renderer, 0, 0, 0, 255)
sdl.renderClear(renderer)
callback.draw()
@@ -273,8 +274,6 @@ local stack = {}
Backend.pop = function ()
local history = stack[#stack]
local color = history.color or { 0, 0, 0, 255 }
Backend.setColor(history.color or { 0, 0, 0, 255 })
Backend.sdl = sdl
sdl.setRenderDrawColor(renderer,
color[1], color[2], color[3], color[4] or 255)

View File

@@ -36,18 +36,9 @@ local function renderMulti (self, font, text, color, align, limit)
local height = #lines * lineHeight
color = sdl.Color(color or 0)
local r, g, b, a
--[[
if sdl.BYTEORDER == sdl.BIG_ENDIAN then
r, g, b, a = 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF
else
r, g, b, a = 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000
end
--]]
-- values from SDL_ttf.c
r, g, b, a = 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000
-- mask values from SDL_ttf.c
-- TODO: something with sdl.BYTEORDER == sdl.BIG_ENDIAN ?
local r, g, b, a = 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000
local surface = ffi.gc(
sdl.createRGBSurface(sdl.SWSURFACE, limit, height, 32, r, g, b, a),
@@ -61,7 +52,7 @@ local function renderMulti (self, font, text, color, align, limit)
sdl.freeSurface)
if lineSurface ~= nil then
sdl.setSurfaceBlendMode(lineSurface, sdl.BLENDMODE_NONE)
local w, h = lineSurface.w, lineSurface.h
local top = (index - 1) * lineHeight