Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WAMS - An API using NodeJS for creating Workspace Application across Multiple Surfaces

Author: Jesse Rolheiser
Contact: jesse.rolheiser@usask.ca

How to run WAMS applications

    1. Install Node or NodeJS from https://nodejs.org/
    2. Download the WAMS package from https://github.com/jlr297/WAMS-API
    3. Open a terminal or command prompt
    4. Navigate to the root of the WAMS package, the directory that contains 'package.json'
    5. Run "npm install"
    6. Change into the 'examples' directory
    7. Run "node x.js", where x is the name of the example you want to run
       The prompt should tell you the ip address and port that your server is listening on
    8. Open a browser on a device and navigate to "ip:port#" in the URL of your browser

Making your own WAMS applications

    1. Look at examples/scaffold.js for the basic structure of an application
    2. Any images you want to use should be png format and put in the examples/Images directory

    WAMS is structured around 3 classes:

        class Workspace(port, settings){
            Fields:
                boundaries: The boundaries of the workspace, conatins x and y values
                MAX_USERS: The maximum number of users that can be connected at a time
                users: A list for the users connected to the workspace
                wsObjects: A list for the objects in the workspace

            Methods:
                addWSObject(WSObject w): Adds w to the workspace
                getUsers: Returns the list of users
                getWidth: Returns boundaries.x
                getHeight: Returns boundaries.y
                getCenter: returns center point of workspace, with x and y coordinates
                setBoundaries(w, h): Sets the boundaries of the workspace
                setClientLimit(x): Sets the max number of users
        }

        class WSObject(imgSRC, x, y, w, h){
            Fields:
                imgsrc: A string of the name of the image in the examples/Images directory
                x: Object's x coordinate
                y: Object's y coordinate
                w: Object's width
                h: Object's height
                id: id number
                type: A string to denote the Object's type

            Methods:
                move(dx, dy): Moves the object by a given amount
                moveToXY(x,y): Moves the object to a specific x,y position
                setImage(imgSRC): Changes the object's image 
                setType(string): Sets the object's type
        }

        class ViewSpace(id){
            Fields:
                x: Viewspace's x coordinate
                y: Viewspace's y coordinate
                w: Device's width
                h: Device's height
                ew: Viewspace's width(takes into account the scale)
                eh: Viewspace's height(takes into account the scale)
                scale: The scale at which the device is zoomed in
                rotation: The rotation of the viewspace within the Workspace
                id: id number
                type: A string to denote the Viewspace's type

            Methods:
                move(dx, dy): Moves the veiwspace by a given amount
                moveToXY(x,y): Moves the viewspace to a specific x,y position
                rescale(x): Rescales the viewspace to a given scale
                top:    Returns the top y coordinate
                bottom: Returns the bottom y coordinate
                left:   Returns the left x coordinate
                right:  Returns the right x coordinate
                center: Return the x,y position of the center of the viewspace
        }

About

An API for making Multi-Surface Applications

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages