Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lsp_def/classes/atlas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
---@field raw_key? boolean Sets whether the mod prefix is added to atlas key. Used for overriding vanilla sprites.
---@field language? string Key to a language. Restricts the atlas to only when this language is enabled.
---@field disable_mipmap? boolean Sets if the sprite is affected by the mipmap.
---@field force_pixel? boolean If enabled, will always load the 1x sprite and force pixel smoothing off. Useful for lower resolution pixel art that looks odd with smoothing.
---@field __call? fun(self: SMODS.Atlas|table, o: SMODS.Atlas|table): nil|table|SMODS.Atlas
---@field extend? fun(self: SMODS.Atlas|table, o: SMODS.Atlas|table): table Primary method of creating a class.
---@field check_duplicate_register? fun(self: SMODS.Atlas|table): boolean? Ensures objects already registered will not register.
Expand Down
8 changes: 7 additions & 1 deletion src/game_object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
-- language specific sprites override fully defined sprites only if that language is set
if self.language and G.SETTINGS.language ~= self.language and G.SETTINGS.real_language ~= self.language then return end
local texture_scaling = G.SETTINGS.GRAPHICS.texture_scaling
if self.force_pixel then
texture_scaling = 1
end
if not self.language and (self.obj_table[('%s_%s'):format(self.key, G.SETTINGS.language)] or self.obj_table[('%s_%s'):format(self.key, G.SETTINGS.real_language)]) then return end
self.full_path = NFS.getNormalizedPath((self.path_mod or self.mod or SMODS).path ..
'assets/' .. texture_scaling .. 'x/' .. file_path)
Expand Down Expand Up @@ -509,7 +512,10 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
self.image_data = imageData2
end
self.image = love.graphics.newImage(self.image_data,
{ mipmaps = true, dpiscale = G.SETTINGS.GRAPHICS.texture_scaling })
{ mipmaps = true, dpiscale = texture_scaling })
if self.force_pixel then
self.image:setFilter("nearest", "nearest")
end
self.columns = self.image:getWidth() / self.px
self.rows = self.image:getHeight() / self.py
G[atlas_table_map[self.atlas_table]][self.key_noloc or self.key] = self
Expand Down