Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 10d98d9

Browse files
committed
Overhauled to support v1.1.0
1 parent db77e29 commit 10d98d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+842
-1058
lines changed

.github/workflows/go.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Set up Go 1.14
17+
uses: actions/setup-go@v1
18+
with:
19+
go-version: 1.14
20+
id: go
21+
22+
- name: Check out code into the Go module directory
23+
uses: actions/checkout@v2
24+
25+
- name: Get dependencies
26+
run: |
27+
go get -v -t -d ./...
28+
29+
- name: Build
30+
run: go build -v ./go-ultralight

.travis.yml

-17
This file was deleted.

README.md

+11-21
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ Ultralight (https://ultralig.ht) is a HTML UI library, written in C++, that prov
1414
#### Licensing
1515

1616
While this wrapper is open-source, the Ultralight project is not. Use of the binaries downloaded
17-
either manually or using the tool must be in accordance with their licensing terms. From their website:<br>
18-
> Ultralight is free for non-commercial use, educational use, and also free for commercial use by
19-
> small indie developers making less than US$100,000 a year. You can find full terms in the SDK.
20-
> Pricing plans for larger commercial projects will be announced later. For more information,
21-
> email us (at [email protected]).
17+
either manually or using the tool must be in accordance with their licensing terms. Usage is free for non-commercial
18+
applications, with the full pricing hierarchy available on the website linked below:
19+
20+
[https://ultralig.ht/#pricing]()
2221

2322
# Installation
2423

@@ -30,7 +29,7 @@ You must have a working CGo installation and have the GOPATH set.
3029

3130
1. Run:<br/><br/> `go get github.com/maneac/go-ultralight/go-ultralight` <br/><br/>to download the project and the installation and setup utility.
3231

33-
## Automated - RECOMMENDED
32+
## Automated - Copying only
3433

3534
2. Navigate to your project's directory and execute:<br/><br/>`go-ultralight [OPTIONS]`<br/><br/>to automatically download the Ultralight SDK, and copy the necessary binaries for running your application. For more information on the available options, please read the utility's help (`go-ultralight --help`).
3635
3. That's it! Now you're ready to Go-Ultralight!
@@ -48,18 +47,11 @@ You must have a working CGo installation and have the GOPATH set.
4847
|-go-ultralight
4948
|-examples
5049
|-SDK
51-
|-bin
52-
|-linux
53-
|-libAppCore.so
54-
|-libUltralight.so
55-
...
56-
|-windows
57-
|-x64
58-
|-AppCore.dll
59-
...
60-
|-x86
61-
|-AppCore.dll
62-
...
50+
|-bin
51+
|-AppCore.dll
52+
|-AppCore.dylib
53+
|-libAppCore.so
54+
|-...
6355
|-deps
6456
|-include
6557
...
@@ -77,9 +69,6 @@ You must have a working CGo installation and have the GOPATH set.
7769
# Use
7870
7971
### If you are a non-Windows user, run the following to enable detection of the binaries:
80-
```bash
81-
export CGO_LDFLAGS_ALLOW=-Wl,-rpath.*
82-
```
8372
8473
After installation, use the setup utility `go-ultralight` , or follow step 4 of the manual installation to copy the necessary binary files to your project directory. These files are required to run the compiled program.
8574
@@ -89,6 +78,7 @@ For examples, please see the 'examples' directory, which contains Go implementat
8978
9079
# To Do
9180
81+
- Fix javascript functions / browser example
9282
- Implement the mouse and keyboard events
9383
- Write tests
9484
- Fix any memory leaks

app.go

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package ultralight
2+
3+
// #cgo CPPFLAGS: -I"./SDK/include"
4+
// #cgo windows,amd64 LDFLAGS: -L'./SDK/lib' -lUltralight -lUltralightCore -lWebCore -lAppCore
5+
// #include <ultralight.h>
6+
import "C"
7+
8+
// App wraps the underlying App struct
9+
type App struct {
10+
a C.ULApp
11+
}
12+
13+
// CreateApp creates an App instance (create only one per application lifetime)
14+
func CreateApp(settings *Settings, conf *Config) *App {
15+
return &App{C.ulCreateApp(settings.s, conf.c)}
16+
}
17+
18+
// Destroy deletes the App instance
19+
func (a *App) Destroy() {
20+
C.ulDestroyApp(a.a)
21+
}
22+
23+
// SetWindow sets the main window. This must be called before
24+
// App.Run()
25+
func (a *App) SetWindow(win *Window) {
26+
C.ulAppSetWindow(a.a, win.w)
27+
}
28+
29+
// GetWindow returns the main Window
30+
func (a *App) GetWindow() *Window {
31+
return &Window{C.ulAppGetWindow(a.a)}
32+
}
33+
34+
// IsRunning returns whether the App is running
35+
func (a *App) IsRunning() bool {
36+
return bool(C.ulAppIsRunning(a.a))
37+
}
38+
39+
// GetMainMonitor returns the main Monitor instance
40+
func (a *App) GetMainMonitor() *Monitor {
41+
return &Monitor{C.ulAppGetMainMonitor(a.a)}
42+
}
43+
44+
// GetRenderer returns the underlying Renderer instance
45+
func (a *App) GetRenderer() *Renderer {
46+
return &Renderer{C.ulAppGetRenderer(a.a)}
47+
}
48+
49+
// Run executes the main loop. Ensure App.SetWindow() has been called
50+
// prior to calling
51+
func (a *App) Run() {
52+
C.ulAppRun(a.a)
53+
}
54+
55+
// Quit exits the application
56+
func (a *App) Quit() {
57+
C.ulAppQuit(a.a)
58+
}

app_callbacks.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package ultralight
2+
3+
// #cgo CPPFLAGS: -I"./SDK/include"
4+
// #cgo windows,amd64 LDFLAGS: -L'./SDK/lib' -lUltralight -lUltralightCore -lWebCore -lAppCore
5+
// #include <ultralight.h>
6+
import "C"
7+
8+
import "unsafe"
9+
10+
var appUpdate func()
11+
12+
// SetUpdateCallback executes the specified function whenever the App updates
13+
func (a *App) SetUpdateCallback(callFunc func()) {
14+
appUpdate = callFunc
15+
C.setAppUpdateCallback(a.a)
16+
}
17+
18+
//export appUpdateFunction
19+
func appUpdateFunction(_ unsafe.Pointer) {
20+
if appUpdate != nil {
21+
appUpdate()
22+
}
23+
}

0 commit comments

Comments
 (0)