oakmound / oak

A pure Go game engine
Apache License 2.0
1.55k stars 83 forks source link

Feature/button shape #142

Closed Implausiblyfun closed 4 years ago

Implausiblyfun commented 4 years ago

x/btn is all about streamlined access to creation of buttons. As part of the ease of use we want to add the ability to create non-rectangular buttons. To do this allow for buttons to have the option to set a shape for the mouse collision as well as the image if it is a color box.

codecov-commenter commented 4 years ago

Codecov Report

Merging #142 into develop will decrease coverage by 2.60%. The diff coverage is 23.72%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #142      +/-   ##
===========================================
- Coverage    95.09%   92.48%   -2.61%     
===========================================
  Files          120      122       +2     
  Lines         5276     4137    -1139     
===========================================
- Hits          5017     3826    -1191     
- Misses         230      279      +49     
- Partials        29       32       +3     
Impacted Files Coverage Δ
collision/space.go 96.66% <0.00%> (+0.17%) :arrow_up:
event/bind.go 100.00% <ø> (ø)
event/bus.go 100.00% <ø> (ø)
event/resolve.go 100.00% <ø> (ø)
render/compositeM.go 82.97% <0.00%> (-17.03%) :arrow_down:
render/default_font.go 33.33% <ø> (ø)
render/defaultfont.go 75.00% <0.00%> (-25.00%) :arrow_down:
render/drawPolygon.go 58.57% <0.00%> (-3.16%) :arrow_down:
render/fps.go 100.00% <ø> (ø)
render/mod/cut.go 87.71% <0.00%> (-12.29%) :arrow_down:
... and 138 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a87153d...299901d. Read the comment docs.

Implausiblyfun commented 4 years ago

Question: it would be inefficient but would it be better to use g.Mod = mod.SafeAnd(mod.CutShape(g.Shape), g.Mod, mod.CutShape(g.Shape))

Just to really make sure the renderable really adheres to the shape? This may be a case of bikeshedding but I wanted to at least bring up the question as I am unsure even though it only affects the simplest variants of buttons anyways.

200sc commented 4 years ago

Question: it would be inefficient but would it be better to use g.Mod = mod.SafeAnd(mod.CutShape(g.Shape), g.Mod, mod.CutShape(g.Shape))

Just to really make sure the renderable really adheres to the shape? This may be a case of bikeshedding but I wanted to at least bring up the question as I am unsure even though it only affects the simplest variants of buttons anyways.

I don't think that's needed right now