Application Framework
The Application Framework toolbox holds the kinds of application a document can be, and what each needs:
- Basic Application: a program that starts, runs and finishes. An Events graph built on it runs its Start event.
- Realtime Application: a window that redraws many times a second, for 2D games and simulations, from Glaze, Divooka's 2D game framework. It draws shapes, text, images and sprites, plays sound and reads input.
- Web servers and web apps: servers built with Ol'ista, Divooka's web server, whose endpoints are answered by your graphs, plus responses, a small database and helpers for passwords and HTML.
Use it when your document is a program that waits for something: a key press, a frame, or a web request.
- Included in: Divooka Explore and Divooka Compute. In Compute the basic application is in every tier. Glaze's realtime application comes with the Game Development workload, and Ol'ista's web server with the Web Development workload; you can also add Glaze Realtime or Web Applications with Add reference (
Ctrl+Shift+L). - Maturity: Usable · Support: Tier 1 (proposed) · what these mean
- Open it: node library (
Ctrl+Shift+Space) → Application Framework, or search for a node withCtrl+Space. - Examples and reference:
Ctrl+Shift+E→ Web Development, Glaze and Basics · node reference
New to graphs? Start with Your first program.
Main ideas
An application calls your graphs. You do not write the main loop. The framework calls the events you place, such as Start, Initialized, Update or Key Down, and your graphs answer.
A web endpoint is a Function graph. Ol'ista receives a request and calls the graph you named for that endpoint. The graph's answer becomes the response.
Example: a web API answered by a graph
The task: start a web server with one endpoint, GET /hello, call it, print the answer and stop the server.
Open Web Development > Serving a Web API (Ctrl+Shift+E). The document has a Function graph Greet, which reads the name from the request's query string and returns the reply, and a Routine graph that:
- Create Web API Capability, Method
GET, Endpoint/hello, with Greet as its handler. - Create Server builds a server with that capability, on this computer only (
127.0.0.1), at a port the system chooses. - Start, Max Seconds
30, starts the server in the background and returns its address. - Format, Template
{0}/hello?name=Divooka, makes the address to call, and Get Text (from Software Development) calls it like any client. - Print Line prints the reply, then the Routine stops the server and prints whether it is still running.
Run it with F5:
Hello, Divooka! This reply was made by a Divooka graph.
Still serving after Stop: False
To serve your own content: change Greet, add endpoints with more capabilities, or use Create Static File Capability to serve a folder of files. Use Serve instead of Start for a program whose whole job is to serve: it answers until the program is closed.
More examples to open
| Example | What it shows |
|---|---|
| Basics > Events Graph Members | A basic application's Start event calling members |
| Glaze > Sky Hopper | A whole 2D game: Initialized, Key Down and Update |
| Glaze > Sky Hopper Deluxe | The same game with menus and artwork |
| Glaze > Gem Garden | A 3D garden drawn into a game window |
Tips and limits
- Start stops by itself. Start's Max Seconds stops the server after that time whatever happens, so a test run cannot leave it running.
- Serve listens on every network interface by default, unlike the example's server, which is created for
127.0.0.1. Other computers on your network may reach it; check your firewall before you serve anything private. - Rates in a game are per second. In Glaze, multiply speeds by the frame's elapsed time in Update, so the game runs the same at any frame rate.
Goes well with: Game Components for input and seeded random numbers in Glaze games, Web Pages for HTML, Software Development to call web APIs.
What is in the toolbox
| Category | Some of its nodes |
|---|---|
| Realtime Application | Make Realtime Application, Clear, Close Microphone, Draw Arc and 74 more |
| Database Result | Make Database Result, Deconstruct, Equals, First To Json and 12 more |
| Ol'ista Website Builder | Create Directory Browser Capability, Create Directory Service Capability, Create FTP Server Capability, Create Realtime Chat Capability and 12 more |
| Web Apps | Create Web App, Map Delete, Map Fallback, Map Get and 13 more |
| Endpoint Response | Make Endpoint Response, Equals, Content, Get Content Type and 8 more |
| App Database | Default File Name, Path Variable, Url Variable, Batch and 10 more |
| Database Statement | Make Database Statement, Deconstruct, Equals, Parameters and 5 more |
| Web Results | Bad Request, Conflict, Created, Forbidden and 6 more |
| Web App | Equals, Endpoints, Name, Get Hash Code and 3 more |
| Glaze Sprite | Get Scale, Get Size, Get Source Start, Set Scale and 2 more |
| Quick Serve | Build, Get Blank Page, Serve HTML, Test |
| Responses | Html Response, Json Response, Redirect, Text Response and 1 more |
| Web Text | Hash Password, Html Encode, Json String, Verify Password |
| Running Web App | Address, Is Running, To String |
| Running Server | Address, Is Running, To String |
| Basic Application | Make Basic Application, Start |
| Dashboard Builder | Configure Dashboard |
See also
- Application Framework node reference
- Glaze! - the 2D game framework, with tutorials.
- Ol'ista - the web server framework.
- Toolboxes - every other toolbox.