Skip to content

Commit

Permalink
Merge pull request #2 from Roktaal/master
Browse files Browse the repository at this point in the history
Replaced button texts with icons
  • Loading branch information
GopherAtl committed Apr 4, 2016
2 parents 20c8cd6 + 3efbfa4 commit 8fbea71
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 28 deletions.
6 changes: 3 additions & 3 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ end

local function doButtons(player_index)
if not game.players[player_index].gui.top.blueprint_flipper_flow then
local flow=game.players[player_index].gui.top.add{type="flow",name="blueprint_flipper_flow",direction="vertical"}
flow.add{type="button",name="blueprint_flip",caption="Flip BP Horiz.",style="bpflip_button_style"}
flow.add{type="button",name="blueprint_flop",caption="Flip BP Vert.",style="bpflip_button_style"}
local flow=game.players[player_index].gui.top.add{type="flow", name="blueprint_flipper_flow", direction="vertical"}
flow.add{type="button", name="blueprint_flip", style="blpflip_button_horizontal"}
flow.add{type="button", name="blueprint_flop", style="blpflip_button_vertical"}
end
end

Expand Down
25 changes: 1 addition & 24 deletions data.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
data:extend({
{
type = "font",
name = "bpflip_font",
from = "default",
size = 10,
},
})

local button_style = {
type = "button_style",
parent = "button_style",
font = "bpflip_font",
scalable = false,
top_padding = 0,
bottom_padding = 0,
left_padding = 2,
right_padding = 2,
bottom_margin=0,
top_margin=0,
}


data.raw["gui-style"].default["bpflip_button_style"] = button_style
require("prototypes.style")
Binary file added graphics/gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueprint_flipper",
"version": "0.1.1",
"version": "0.1.2",
"title": "Blueprint Flipper",
"author": "GopherAtl",
"homepage": "",
Expand Down
106 changes: 106 additions & 0 deletions prototypes/style.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
data:extend(
{
{
type = "font",
name = "blpflip_font",
from = "default",
size = 10
}
}
)

data.raw["gui-style"].default["blpflip_button_horizontal"] =
{
type = "button_style",
parent = "button_style",
width = 32,
height = 32,
top_padding = 6,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "blpflip_font",
default_graphical_set =
{
type = "monolith",
monolith_image =
{
filename = "__blueprint_flipper__/graphics/gui.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 0,
}
},
hovered_graphical_set =
{
type = "monolith",
monolith_image =
{
filename = "__blueprint_flipper__/graphics/gui.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 32,
}
},
clicked_graphical_set =
{
type = "monolith",
monolith_image =
{
filename = "__blueprint_flipper__/graphics/gui.png",
width = 32,
height = 32,
x = 32,
}
}
}

data.raw["gui-style"].default["blpflip_button_vertical"] =
{
type = "button_style",
parent = "button_style",
width = 32,
height = 32,
top_padding = 6,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "blpflip_font",
default_graphical_set =
{
type = "monolith",
monolith_image =
{
filename = "__blueprint_flipper__/graphics/gui.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 64,
}
},
hovered_graphical_set =
{
type = "monolith",
monolith_image =
{
filename = "__blueprint_flipper__/graphics/gui.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 96,
}
},
clicked_graphical_set =
{
type = "monolith",
monolith_image =
{
filename = "__blueprint_flipper__/graphics/gui.png",
width = 32,
height = 32,
x = 96,
}
}
}

0 comments on commit 8fbea71

Please sign in to comment.