 | [TOC] Chapter 2: Tools and Languages |  |
Lots of the most powerful tools you need are free and integrated into your web-browser!
The purpose of these tutorials is to help you learn WebGPU. However, you can't really get started with WebGPU without a basic understanding of HTML and CSS along with a comprehensive understanding of JavaScript.
We'll look at some of these things here to get you up to speed on these preliminary skills.
You can edit and write your programs using a good old text editor (like notepad++). It's a wizard, its' free and it even has syntax highlighting. However, it just makes it tedious each time you want to check your code - as you have to do multiple steps.
An easier solution is a good integrated development environment (IDE) - it helps group together all your files (manage and keep track of a complex project). Their are also lots of features and debugging resources - not to mention a one click option to run your test programs.
Visual Studio Code is free, and has tons of free plugins to make your life so much easier. You can download and install it from https://code.visualstudio.com/.
If you want to load files, you need to run a local web server on your computer. Trying to run programs locally on your machine from the file directly without a server will not work correctly (as you can't open files - unless they're on a server).
The program files must be loaded into your browser by a web server.
A free and simple resource for running a local server is XAMPP. You can download and install XAMPP which will setup everything for you (Apache + MariaDB + PHP + Perl) - everything you need.
If you don't want to install anything - you can even do all of your programming, debugging and testing online in a browser. You can get editors and debuggers that run in the browser! Few examples include:
• webgpulab (webgpulab.xbdev.net)
• jsfiddle (jsfiddle.net)
• codesandbox (codesandbox.io)
 | HTML and CSS |  |
HTML (hypertext markup language) and CSS (cascading style sheets) are used to describe web pages. HTML describes the content of the page while CSS describes the formatting of various elements on the page. If a web page is designed with special care, the HTML code that describes the content of a page can remain static, while the CSS style sheets might change based on the target screen size. That is, the web page would have the same content, but could have very different layouts for a large desktop computer screen as compared to a mobile phone screen.
Since our goal in these tutorials is to learn WebGPU, please don't try to become an expert web designer at this time. To build WebGPU programs you only need to understand the basics of HTML and CSS code.
As with all software development, when you design a web page you should start with a very simple HTML document and add complexity a little at a time.
Basic HTML and CSS can be learned from many on-line tutorials. Please use the tutorials at code academy to learn how to create basic HTML and CSS code. Note that you can change from one lesson to the next using the table of contents popup menu in the lower left corner of the interface.
ResourcesThese cheat sheets will be helpful to you:
• HTML 4.0 Cheat Sheet (source: http://www.cheatography.com/davechild/cheat-sheets/html4/)
• CSS 3.0 Cheat Sheet (source: http://gamifyedu.co/wd/epicquest/extras/css3-cheat-sheet.pdf)
HTML Coding StandardsThese coding standards were introduced in section 1, but please study them again after you have studied HTML and CSS.
Always declare the document type as the first line in your document: <!doctype html>
Use lower case element names: <p>, <div>
Close all elements: <p> ... </p>
Close empty elements: <br />
Use lowercase attribute names: <div class="...">
Quote all attribute values for consistency: <div class="...">
Don't use spaces around equal signs: <div class="...">
Try to avoid code lines longer than 80 characters
For readability, add blank lines to separate large or logical code blocks.
For readability, add 2 spaces of indentation for code inside a parent element. Do not use TAB characters.
Always include a <html> , <head> and <body> tag.
Always include the language, character encoding, and <title> :
<!doctype html> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>HTML5 Syntax and Coding Style</title> </head>
|