Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add initial documentation #236

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI

on:
pull_request:
branches:
Expand All @@ -7,6 +8,7 @@ on:
branches:
- master
tags: '*'

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand Down Expand Up @@ -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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*Manifest.toml
docs/build
26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLFW = "f7f18e0c-5ee9-5ccd-a5bf-e8befd85ed98"
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
22 changes: 22 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import GLFW
using Documenter

makedocs(;
modules=[GLFW],
authors="Jay Petacat <jay@jayschwa.net> and Simon Danisch <sdanisch@gmail.com>",
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",
)
14 changes: 14 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -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]
```
50 changes: 50 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -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.