Added GLFW specific functionality from GLWindow.jl#118
Conversation
Made it so MonitorProperties doesn't depend on GeometryTypes, I think for performance its ok. If something constructs it without using the constructor there might be some trouble in current implementations
jayschwa
left a comment
There was a problem hiding this comment.
Reorganizing files makes it hard to review the functional changes. Please do either one or the other in this PR.
For file reorganization, I think it makes more sense to group things by functionality (e.g. context, input, window, etc) rather than by kind (e.g. functions, types, constants). http://www.glfw.org/docs/latest/modules.html groups API names by functionality and can probably inform a reorg.
|
I agree on functionality over "kind". Wouldn't this create a lot of very small files? |
|
Thanks for dialing back the file reorg. It will make the other changes easier to digest. |
| props = MonitorProperties(GetPrimaryMonitor()) | ||
| w,h = props.videomode.width, props.videomode.height | ||
| # Vec(Int(w),Int(h)) | ||
| Vector([Int(w),Int(h)]) |
There was a problem hiding this comment.
Just return (Int(w), Int(h))
This should keep previous functionality without depending on GeometryTypes, with the same performace as well
jayschwa
left a comment
There was a problem hiding this comment.
Removing the ceremony from changing window properties and including saner defaults seems good. Some of the other additions aren't obvious wins to me, so I requested removal. I'm open to having them added in future PRs where they can be debated.
If this gets merged, I'll probably still tweak things a bit before cutting a new release.
| @@ -1,4 +1,4 @@ | |||
| #************************************************************************ | |||
| ************************************************************************ | |||
|
|
||
| function poll_glfw() | ||
| PollEvents() | ||
| end |
There was a problem hiding this comment.
Remove this function. It is not adding value.
| Integer: The number of the Monitor to Select | ||
| Bool: if true, primary monitor gets fullscreen, false no fullscren (default) | ||
| GLFW.Monitor: Fullscreens on the passed monitor | ||
| """ |
There was a problem hiding this comment.
Remove this function. It appears to be unused.
| KEY_UP == b && return :up | ||
| end | ||
| return :nothing | ||
| end No newline at end of file |
There was a problem hiding this comment.
Remove this function. It appears to be unused.
|
|
||
| MakeContextCurrent(window) | ||
|
|
||
| debugging && glDebugMessageCallbackARB(_openglerrorcallback, C_NULL) |
There was a problem hiding this comment.
glDebugMessageCallbackARB appears to be undefined. This line might need to be removed.
| window.handle == C_NULL && return | ||
| SwapBuffers(window) | ||
| return | ||
| end |
There was a problem hiding this comment.
Remove this function. It's not adding enough value in my opinion.
| (Symbol(last(split(string(f),"."))), f(window)) | ||
| end | ||
| Dict{Symbol, Any}(tmp) | ||
| end |
There was a problem hiding this comment.
Remove this function (for now). I think it's a little too magical.
|
|
||
| function Base.resize!(x::Window, w::Integer, h::Integer) | ||
| SetWindowSize(x, w, h) | ||
| end |
There was a problem hiding this comment.
Remove this function (for now). The documented description of resize! is for collections, so using it here seems a bit off. The alternative (calling SetWindowSize) isn't any longer.
| function Base.isopen(window::Window) | ||
| window.handle == C_NULL && return false | ||
| !WindowShouldClose(window) | ||
| end |
There was a problem hiding this comment.
Remove this function (for now). "is open" and "should not close" are two different concepts in my opinion, and the alternative can still be done in one line.
I agree on all of the comments. Some of the functions aren't used/belong somewhere else like you correctly assessed! I will make sure to pay more attention to these things in the future.
|
I'm not against any tweaking on your part I'm sure you know better what to do with this package than I do. If you want I can also delete all the annotations I made, like where blocks of code originated from. |
jayschwa
left a comment
There was a problem hiding this comment.
A few changes requested. The annotations don't need to be removed. I like seeing where they came from. Once tests are green, I'll merge and take it from there.
| @@ -1,2 +1,3 @@ | |||
| deps/* | |||
| !deps/build.jl | |||
|
|
|||
| Base.show(io::IO, m::Monitor) = write(io, "Monitor($(m.handle == C_NULL ? m.handle : GetMonitorName(m)))") | ||
|
|
||
| const WindowHandle = Ptr{Void} | ||
|
|
| Base.showerror(io::IO, e::GLFWError) = print(io, "GLFWError ($(e.code)): ", e.description) | ||
|
|
||
| #Came from GLWindow.jl/types.jl | ||
| struct MonitorProperties |
There was a problem hiding this comment.
Change struct to immutable for Julia 0.5 compatibility.
|
Also, not sure if you care, but GitHub is setting your name to "Unknown" as the author. I believe that can be changed under GitHub settings. |
|
Merged via #122. Thanks for the contribution! |
|
Very Good, thanks to you too! |
glfw3.jltofunctions.jlglfw3.jltotypes.jlglfw3.jltoconstants.jlgl_createcontextout ofGLWindow.jl/screen.jlto a constructor forWindow.Windowrelated functionality fromGLWindow.jl/screen.jl,types.jl,core.jltotypes.jl.MonitorPropertiesfromGLWindow.jl/types.jltotypes.jlMonitorPropertiesso it doesn't depend onGeometryTypes: Vechit in performance shouldn't matter imo.GLFW.jlrelated functionality fromGLWindow/screen.jl,core.jltoextensions.jlTests work, also ran the tests for the pullrequest in
GLWindow.jlGeneral Idea: Firstly, splitting pure
GLFW.jlrelated functionality fromGLWindow.jlwill allow it to be less backend specific, and act as a interface to differentOpenGLwindow/context providers. This is in light of hopefully seperating Windowing functionality in 'GLWindow' fromGLAbstraction.jland provide more of anAPIexperience.Secondly, I understand this makes the package no-longer a barebones wrap around the
GLFWlibrary, but was it really purely that to begin with, and would people not use the added functionality that only depends onGLFWif it is there?