diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2b7292..4bf9846 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ name: CI + on: pull_request: branches: @@ -7,6 +8,7 @@ on: branches: - master tags: '*' + jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} @@ -48,3 +50,22 @@ jobs: - uses: codecov/codecov-action@v1 with: file: lcov.info + + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + - uses: julia-actions/cache@v2 + with: + version: '1' + - run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - run: julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ea13b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*Manifest.toml +docs/build diff --git a/README.md b/README.md index fdb970b..c97d8cf 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ # GLFW.jl [![CI](https://github.com/JuliaGL/GLFW.jl/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/JuliaGL/GLFW.jl/actions/workflows/ci.yml) +[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliagl.github.io/GLFW.jl/stable) +[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliagl.github.io/GLFW.jl/dev) - -[Julia][julia] interface to [GLFW 3][glfw], a multi-platform library for creating windows with [OpenGL][opengl] or OpenGL ES contexts and receiving many kinds of input. GLFW has native support for Windows, OS X and many Unix-like systems using the X Window System, such as Linux and FreeBSD. +This is a[Julia][julia] interface to [GLFW 3][glfw], see the +[docs](https://juliagl.github.io/GLFW.jl/stable) for more information. [julia]: https://julialang.org [glfw]: https://www.glfw.org [opengl]: https://wikipedia.org/wiki/OpenGL -Example -------- - +## Example ```julia using GLFW @@ -36,19 +36,3 @@ end GLFW.DestroyWindow(window) ``` - -Interface ---------- - -Read the [GLFW documentation][docs] for detailed instructions on how to use the library. The Julia interface is almost identical to the underlying C interface, with a few notable differences: - -* Clipboard (`glfwGetClipboard`, `glfwSetClipboard`) and time (`glfwGetTime`, `glfwSetTime`) functions have been omitted because Julia's standard library already supports similar functionality. -* `glfwInit` and `glfwTerminate` are called automatically using the `__init__` and `atexit` functions. While it is okay to still call them explicitly, it is redundant and not required. - -[docs]: https://www.glfw.org/docs/latest/ - - -Footnotes ---------- - -* Special thanks to [@afterwise](https://github.com/afterwise) for writing an early implementation of GLFW 3 support. diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..7226711 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,4 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +GLFW = "f7f18e0c-5ee9-5ccd-a5bf-e8befd85ed98" +LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..04a0712 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,22 @@ +import GLFW +using Documenter + +makedocs(; + modules=[GLFW], + authors="Jay Petacat and Simon Danisch ", + sitename="GLFW.jl", + format=Documenter.HTML(; + prettyurls=get(ENV, "CI", "false") == "true", + canonical="https://juliagl.github.io/GLFW.jl", + assets=String[], + size_threshold=400000 + ), + pages=[ + "Introduction" => "index.md", + "API Reference" => "api.md" + ] +) + +deploydocs(; + repo="github.com/JuliaGL/GLFW.jl.git", +) diff --git a/docs/src/api.md b/docs/src/api.md new file mode 100644 index 0000000..0d9df5c --- /dev/null +++ b/docs/src/api.md @@ -0,0 +1,14 @@ +```@meta +CurrentModule = GLFW +``` + +# API reference + +!!! warning + Not all functions/types are documented yet, you may have to read the source + to find them all. + +```@autodocs +Modules = [GLFW] +Order = [:type, :function] +``` diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..9c75e52 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,50 @@ +# GLFW.jl + +A [Julia](https://julialang.org) interface to [GLFW 3](https://www.glfw.org), a +multi-platform library for creating windows with +[OpenGL](https://wikipedia.org/wiki/OpenGL) or OpenGL ES contexts and receiving +many kinds of input. GLFW has native support for Windows, OS X and many +Unix-like systems using the X Window System, such as Linux and FreeBSD. + +## Example + +```julia +using GLFW + +# Create a window and its OpenGL context +window = GLFW.CreateWindow(640, 480, "GLFW.jl") + +# Make the window's context current +GLFW.MakeContextCurrent(window) + +# Loop until the user closes the window +while !GLFW.WindowShouldClose(window) + + # Render here + + # Swap front and back buffers + GLFW.SwapBuffers(window) + + # Poll for and process events + GLFW.PollEvents() +end + +GLFW.DestroyWindow(window) +``` + +## Interface +Read the [GLFW documentation](https://www.glfw.org/docs/latest/) for detailed +instructions on how to use the library. The Julia interface is almost identical +to the underlying C interface, with a few notable differences: + +- Clipboard (`glfwGetClipboard`, `glfwSetClipboard`) and time (`glfwGetTime`, + `glfwSetTime`) functions have been omitted because Julia's standard library + already supports similar functionality. +- `glfwInit` and `glfwTerminate` are called automatically using the `__init__` + and `atexit` functions. While it is okay to still call them explicitly, it is + redundant and not required. + + +## Acknowledgements +* Special thanks to [@afterwise](https://github.com/afterwise) for writing an + early implementation of GLFW 3 support.