Adding getLine and getPoint
So, I was always cool with
getPoint (functions which would return both components of the state of lines/points) not existing, because there is already
getPointStyle/Size. However, now I disagree with my past self and I think they should be added for these reasons:
1: It's probably nicer in practice. For example, one use for these getters which I assume could be quite common is for remembering the current state, changing stuff, then setting it back to the previous state.
local style, width = love.graphics.getLineStyle(), love.graphics.getLineWidth() -- Other stuff... love.graphics.setLine(style, width)
local style, width = love.graphics.getLine() -- Other stuff... love.graphics.setLine(style, width)
It's now concise and symmetrical!
2: Less (things to remember) is more (good), and more (getters) is less (things to remember)!
Because almost all state which has a setter also has a getter, instead of remembering which states have getters, one remembers which states don't have getters. So adding getters for the
setPoint setters actually reduces the complexity of the API IMO.
3: It's consistent with other functions which set/get more than one component of some state.
One possible objection to these getters could be that they're redundant because the information can be accessed with other getters. Also, I used to think that
setPoint should actually be removed, because their names are a bit confusing and they're also redundant.
However, when there is a state which has multiple components and is conceptually about the same thing (color, window mode, filter modes, source volume limits, etc.), there seems to always be a setter/getter for setting/getting all of the components, and then setters/getters for individual components only if they're especially useful (such as
Another possible objection (maybe, I dunno :D) could be that it's not obvious what the functions would return and in what order, however this could be said for the setter functions too, and any other functions which sets/gets multiple components. Also, the symmetry with
setLine/Point should make this more obvious.