Quark #

Modules #

Quark v1.2.0 Documentation


quark/window #

Interface: Options #

Options #

options.olorType? #

init window color type

options.msaa? #

init window gpu render msaa count

options.frame? #

init window params

options.title? #

init window title

options.backgroundColor? #

init window background color

options.navigationColor? #

Is need draw navigation buttons for android.

Class: NativeWindow #

NativeWindow #

nativewindow.scale #

The scaling ratio of the physical pixel size of the window to the drawing size

nativewindow.defaultScale #

The default recommended scaling ratio between window physical pixels and drawing size

nativewindow.fsp #

Current drawing frame rate

nativewindow.atomPixel #

Atom pixel size, Exp: 1 / scale

nativewindow.root #

The only root view in the window

nativewindow.focusView #

Current focus view

  • @get focusView: View

nativewindow.navigationRect #

Navigation rect, possibly in the Android bottom navigation button area

nativewindow.size #

  • Set the logical size of the window. When this value changes, the change event will be triggered.
  • When both width and height are set to zero, the most comfortable default display size is automatically set.
  • If the width is set to non-zero, it means the width is fixed, and the height is automatically set according to the window ratio.
  • If the height is set to non-zero, it means the height is fixed, and the width is automatically set according to the window ratio.
  • size: types.Vec2

nativewindow.backgroundColor #

The background color for the window

nativewindow.surfaceSize #

Window physical surface pixel size

nativewindow.nextFrame(cb) #

When rendering next frame call

nativewindow.activate() #

Activate the display window or taking the window to the foreground

nativewindow.close() #

To close or destroy the window

nativewindow.pending() #

Taking window to background and pending

nativewindow.setFullscreen(fullscreen) #

Setting whether the window is displayed in full screen mode

nativewindow.setCursorStyle(style) #

Setting the mouse cursor style

nativewindow.constructor(opts?) #

Class: Window #

Window #

window.rootCtr #

The only root view controller in the window

window.render(vdom) #

Create a view or view controller DOM by vdom

  • @return DOM

Example:

import {Application,Window,ViewController} from 'quark'
import * as http from 'quark/http'
import * as buffer from 'quark/buffer'
class MyCtr extends ViewController<{param: number}, {data?: Uint8Array}> {
    triggerLoad() {
        return http
            .get('[`http://192.168.1.100:1026/README.md?param='`](http://192.168.1.100:1026/README.md?param=') + this.props.param)
            .then(e=>this.setState({data:e.data}));
    }
    render() {
        return (
            <box width={100} height={100} backgroundColor="#f00">
                {this.state.data&&buffer.toString(this.state.data)}
            </box>
        )
    }
}
new Application();
new Window().activate().render(
    <MyCtr param={10} />
);