stainless at January 26th, 2014 08:25 — #1
I have to do a demo in a couple of weeks, and decided to put it together in HTML 5.
What a mistake.
Nothing works as you expect it to.
Lets start with setting a canvas size, first I tried ...
<canvas id="c" width="800" height="600"></canvas>
The canvas was full screen. So then I tried.
<canvas id="c" width="800" height="600" style='width:800px;height:600px'></canvas>
var canvas = document.getElementsByTagName('canvas');
canvas.width = 800;
canvas.height = 600;
I get a null pointer exception. So next I tried ....
canvas = document.getElementById('c');
The canvas was full screen. After banging my head against the wall for ten minutes, I tried adding some css
Guess what, the canvas was full screen.
At this point I have given up and binned it
I will do my demo using c++ and opengl even though I will have to do a lot more work.
Anybody actually got HTML 5 to work as expected?
spolsh at January 26th, 2014 09:02 — #2
<canvas id="c" width="800" height="600" style="border-style:solid;"> </canvas>
Only added style to your first try so you can see the dimensions. Works for me. tested on chrome and firefox.
btw. How to fix code markup?
thenut at January 26th, 2014 12:04 — #3
var canvas = document.getElementById("MyCanvas");
canvas.width = window.innerWidth
canvas.height = window.innerHeight
BTW, as spolsh mentioned, it would be nice to have a preview/syntax guide for markdown. I too have difficulty getting certain things to work. I use DokuWiki and Confluence all the time and this markdown stuff keeps messing me up
stainless at January 26th, 2014 15:38 — #4
instead of [code] you have to put four spaces on the front of each line of code, don't know why. Maybe the code monkey eats spaces. Makes no sense to me.
I am using chrome (latest version, made sure of that), on windows xp.
None of the code I have tried, or any of the suggestions I have seen anywhere work.
fireside at January 26th, 2014 16:14 — #5
You have to use "pre" instead of "code", with less than/greater than brackets.
reedbeta at January 26th, 2014 18:44 — #6
It's because the new forums use Markdown. Four spaces indented is what signals code in Markdown. It's a different syntax than the old BBCode, but it doesn't take long to learn.
(I don't know why inline code (text inside backticks) turns red,
like this, though.)
vilem_otte at January 26th, 2014 19:04 — #7
I'd like to note that following is not my own opinion, but rather opinion of few people I've talked with...
HTML5 is mainly an Apple propagated pseudo-standard that doesn't have solid support across the browsers (there are still issues after few years), yet the companies that created it heavily propagate it. As opposing to Flash (yet this one works as plugin), it works differently across browsers and even in same browser in different operating systems.
My point of view is a bit different, I think that HTML5 is really step in good way, yet I think that whoever stands behind HTML5 standard must be crying now. The standard looks similar to what SQL standards are - different in each implementation, yet never actually implementing standard correctly, nor fully. It's better than before, but still it is terribly bad.
reedbeta at January 26th, 2014 20:48 — #8
Isn't this always the way with new web standards? Think how long it took for CSS and the DOM to work consistently across all browsers and platforms...those were bad old days in the late 90s and early 2000s. I don't know why this seems to be the disease of the web particularly, but it'll get ironed out.
rouncer at January 26th, 2014 23:01 — #9
i tried to make a mud with ASP and i was dead in all directions. if u want to make a client server game, it ends paying not using ASP to do it, and just use c++. so i wonder if HTML5 is just as horrible to use.
stainless at January 27th, 2014 04:10 — #10
Having written a web browser, I know how hard it is to get this mess of a 'standard' to work consistently. Hell there are 20 different ways of doing anything, all of which are supposed to look the same over all browsers. It's a mess.
I would much prefer a compiled system along the lines of LLVM, compiled byte code, much smaller than text files, easier to parse, et al ad nauseum. However of course in this I am in a minority of one.
stainless at January 27th, 2014 04:17 — #11
What I am finding is that HTML 5 works...... sometimes.
I found that changing a single line of code and turn an app running perfectly at 60 Hz, to a heap of brown and smelly running at 1 Hz
I am sure that if you use windows 8, internet explorer, and run Microsoft's web server, everything works.
Change any one of those elements and bad things can happen.
Or maybe Chrome on Ubuntu Linux with Apache
Or IOS and Firefox......
Or a brick, a hand, and a head. Hand applies velocity to brick which applies force to head.