Steam HTML5 Compiler

Previous topic - Next topic

spacefractal

#30
im can finally confirm as MOUSEAXIS and MOUSESTATE, any mouse buttons sends to the first button.

Its howover possible to detect you using touch or mouse, so when on mouse, its would been nice to uses rightclick for sure as rightclick menu is disabled for the canvas anyway.

etc if you can move the mouse without click, then its a mouse, you cant do that with touch, which x and y is allways is 0 when no button clicked.....

etc code like this:

Code (glbasic) Select

MOUSESTATE mx, my, b1, b2
IF i=0 AND b1=0 AND (mx>0 OR my>0) THEN ISAMOUSE=1



So im will confirm its a bug.

Im is recently fully doing a html5 port for one of the game.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#31
im just finally got right mouse click working. Im have sent the changes to Gernot. The changes required is in lib_glb_plus.js...... of course if a user uses touch, rightclick wont work. MouseState does still not works yet. but that part was not important really.

Im think html5 is a cool platform, much more fun than Android for me, so im might take a full focus on this platform rather than Android me think.

Im should have take a look much eailer. so sorry about it.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

I'm back, didn't really go, always checked in to see new developments.
Had a bit of a career change from working on Fire and Security systems to teaching apprentices to be qualified to do the same.
My spare time was limited so never really had a GLBasic project to work on.
Now that I can see HTML5-GL looks stable, I decided to jump to the steam version.(still worth paying twice)
After a lot of compile error and messing about I managed to get a few projects working.
I love it that things like grabsprite work, but mousewait crashes.

I've tasked myself with writing some code for teaching apps but before I start have to work everything out.

does anyone have the minimal HTML that is required to run .js / wasm. I was messing with the generated one and removed about 60% of the code, but removing code that looks irrelevant sometimes kill it.

File access is limited, will HTML5 in GLBasic be able save an image. I am thinking of certificates being downloaded for the learners.


Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

spacefractal

#33
MOUSEWAIT would newer work on that platform as its will more or less just freeze the game, due how that platform works, which is heavy tied to GLB_ON_LOOP. You cant also load assest in one go, but need to go throught  GLB_ON_LOOP as well.

So nothing im can do here.

Uses MOUSESTATE instead. That command works fine.

So if you ask me, MOUSEWAIT should been depreacted completly.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#34
the main thing also dont uses loops without GLB_ON_LOOP. (called once per frame/gameupdate). GLB_ON_LOOP is automatic called by the language on new frame on the framerate you choice.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

#35
Wasn't really complaining about MOUSEWAIT, I used it a lot on previous project so parts of my code could be paused so I could check it was doing the right thing.
Started doing testing, I have a Zyxel NAS that allows me to web publish. I converted my old unlimited sprites demo and put it up. funny thing is it only plays music if you touch  the screen on my android phone, but OK on PC, runs fast and smooth.

I use a  4k Screen and the IDE icons are so small, luckily I can increase the font size for code.

I want to add the projects to my own web pages, any one know of a tutorial or tool that can do this?, As I said previous the GLBasic html adds 3 weird symbols at the start and the blue button menu, removing it with a text editor works to a point, but you can easily mess it up. 


Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

spacefractal

#36
its simply due that whay Android and WebGl is pretty much the same.

MOUSEWAIT is a bad command, because its does not show any graphics in meantimes and also halt GLB_ON_LOOP operation in meantime (very bad idea). Due that, the system thinks the app is gonna to been in crash, due its does not repons as GLB_ON_LOOP was newer finished in time. MOUSEWAIT was orignally only meant to been a debug command.

That is due SHOWSCREEN is now required to been used with GLB_ON_LOOP calls. GLB_ON_LOOP should been in the main loop and glbasic automatic call it when the functions ens with the desirered framerate.

Old projects might not uses it, but need to been changed to only uses GLB_ON_LOOP as main function. Some of my games diddent do that either back in the time.

Remember Android/Webgl behaiver quite different than Windows.

For the Cave Heroes project, here is what my function is to give it idea:

Code (glbasic) Select

SUB GLB_ON_LOOP:
?IFDEF HTML5
LOCAL x,y
GETSCREENSIZE x,y
LOCAL changed=CheckCanvasSize()
IF changed=TRUE
OS_Default_Settings()
ENDIF
?ENDIF

IF S_Status$="load"
LOADGAME()
PaintLogo()
LOADER=LOADER+1
ENDIF
IF S_Status$="pause"
UpdateTicks=update_Delay()
Ctrl()
GamePaint()
ENDIF
IF S_Status$="show" OR S_Status$="menu"
UpdateTicks=update_Delay()

IF UpdateTicks<1
GameUpdate()
ELSE
LOCAL updat=INTEGER(UpdateTicks)
UpdateTicks=UpdateTicks/updat
FOR i=1 TO updat
GameUpdate()
NEXT
UpdateTicks=UpdateTicks*updat
ENDIF
GamePaint()
ENDIF
IF S_Status$="menu"
GameMenu()
ENDIF
SHOWSCREEN
IF S_Status$="show" OR S_Status$="menu" OR S_Status$="pause"
IF GAMEFADE=0 AND GAMEON=0 //AND Objectdata[0].dat[16]=1
RESET(1)
POWER=1
Map_LoadXML()
UpdateTicks=update_Delay()
UpdateTicks=0.1
GAMEON=1
DoRandomLevels=0
ENDIF
IF GAMEON=1
GAMEFADE=GAMEFADE+0.05*UpdateTicks
IF GAMEFADE>1 THEN GAMEFADE=1
ELSEIF GAMEON=0
GAMEFADE=GAMEFADE-0.05*UpdateTicks
IF GAMEFADE<0
GAMEFADE=0
ENDIF
ENDIF
ENDIF
ENDSUB
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

If anyone needs the minimal HTML code to run compiled Emscripten .js. I got totally lost looking at the HTLM code generated when compiling to HTLM5. Hope this helps

Code (glbasic) Select

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
<center>
    <canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
    <script type='text/javascript'>
        var Module = {
            canvas: (function() { return document.getElementById('canvas'); })()
        };
    </script>
    <script src="Insert File Name.js"></script>
</center>
</body>

</html>
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

Qedo

 great very useful Paul

spacefractal

#39
you should checkout this post with the changes im did:
https://www.glbasic.com/forum/index.php?topic=11576.msg102262#msg102262

This also include a tool, that does adds icons etc after compiling and canvas resize checking and more.

This minimal version would sadly not work with the tool and fixes im did, that also have a loading presentation with loading status (which take some time, before the canvas actuelly starts) and canvas, saving (which was a pain to get working correctly), resize etc and... yes fixed the right click issue.

And yep, that version im did was designed to been more release presentation. Just checkout any of my games. All my games using this tool and code. And yep. The logs in the textarea used is nonesense as.... browsers can showup the logcat if needed anyway.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hi, Just to mention i did notice a slight screen tear issue when trying Greedy Mouse - on my browser..?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

its could have fails to deviver 60fps? since im was aware webgl is slower, that why im added back 30 fps and graphics settings for that game, a game that is quite fillrate hungry (its now only uses the 200px tileset, that property got downscaled). and a game that diddent uses systemtimer, but frameskips, something im wont change. Lucky its not a action game at all.

Im does do vsync in that game.....
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

I've written loads of programs that handle the b1 on MOUSESTATE so that it only records one press at a time. however I cant get any of my code to work with HTML5-GL
without it doing nothing or crashing, all work under win32.  Every touch records about 3-5 loops. Any pointers anyone.
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

spacefractal

#43
dont uses MOUSESTATE variable directly as its just checking or should checking its either held down or not. You should uses something like this?

Code (glbasic) Select

MOUSESTATE mx, my, mba, mbb
IF mba=1
PRESSED=PRESSED+1
ELSE
PRESSED=0
ENDIF


Remember the main loop for webgl is allways GLB_ON_LOOP, so using GOTO for looping is a very bad idea and might crash (im did removed comply of those in my own games when that got changed). Hence MOUSEWAIT would newer work....
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

Thanks this worked. So simple, I started off with something similar but it got out of hand with frustration. :nw:
Going to add it to the playsound so its not  being called 3-5 times a push.
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI