Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [AGK2] HTML Parser / Interpreter

Author
Message
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 12th May 2015 00:31 Edited at: 27th May 2015 03:27
HTML Parser / Interpreter

What is that?: This code can read HTML files and display them using sprites and text commands.

Why do I create such thing?: Being able to display a lot of content in a app can be very hard. HTML could help.


Current features:
Can display all the text from a HTML file
<a> - can interpet these lines, but does not work atm. (wip)
<font> - color only (fonts are wip)
<title>
<h1> - <h6>
<body bgcolor>
<center>
<align>
<br>
<hr>



Planned features:
Tables
Improve all commands


Download Source Code 0.3:
https://forumfiles.thegamecreators.com/download/2560820


How to use:


Use the arrowkeys on your keyboard to scroll though the website.
The spacekey activates the parser buffer for debugging.
Use the backspace key to leave the parser buffer screen.


Current bug level: Very high
Some alignments are wrong due to the fact, that I cant measure the width of the last line of text, only the whole block. Another problem this code has, is if there are multiple text objects on the same line, that needed to be centered. This code is wip and barely readable. This problems are seen due to the fact, that I work on it. The linkbar is marked red for coming offset operations.



Additional information:


What is parsing and how it is done:
http://en.wikipedia.org/wiki/Parsing

HTML:
http://en.wikipedia.org/wiki/HTML




I thought I have to share this one with you guys.
What do you thing of that?




Some screens from AGK:




[/url]

Attachments

Login to view attachments
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 12th May 2015 12:03
This is an interesting project, and with the absence of any proper "Webview" commands yet in AGK2, this will probably offer a good stop-gap for anyone who needs web content in their apps.

Good work!

V2 T1 (Mostly)
Uzmadesign
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 13th May 2015 16:51
Yes interesting thing.
I remember when i developed an HTML parser for Trackmania (a game by Nadeo) that used ManiaLinks to show things on a layer in the game.

If you need help ask!!

unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 13th May 2015 20:46
I commend you for attempting an HTML renderer in AppGameKit! Good luck and looks interesting.

Using AppGameKit v2 T1 + T2
Systems: Primary: Mac OS X 10.10
Secondary: Windows 7
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 18th May 2015 02:04 Edited at: 18th May 2015 02:04
Thanks for the positive feedback If I need any help I will ask you for shure



Version 0.2 code:


Acutally there are no big visible changes right now, but the first line interpreter(will scan each line of the html file for commands or text) is completly new. There is much more control and a very reduced code on that operation.





The next big thing will be, that the parser will set the priority and order for the rendering.


[/url]
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 27th May 2015 03:25
Version 0.3:

======================

Finally I could port the whole core of the code to the new array system being able to store more information in it. 0.3 is just missing some like break alignments, but is a lot easier to read and understand. I have added
tons of comments to explain the code. If you are interested in the development, this version will be a good starting point.


[/url]

Attachments

Login to view attachments
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 27th May 2015 05:37
Some free extended fonts for the browser in normal/bold/italic/bolditalic.

Maybe you need this for something else


[/url]

Attachments

Login to view attachments
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 27th May 2015 19:37
@Jack,

Just wandering in here as it seemed like and interesting thread, was surprised to see a credit for some HexToDec() function. Dunno where that came from, but I've a feeling such functionality is built into AGK2 these days. So it'd be best use the built in stuff where/if you can.


For what its worth, that HexToDec function has a number of potential function calls in the inner loops. I say potential, as i've not looked that AGK2 instruction set/compiler to see if it automatically evaluates constant functions/expressions at compile time. DB/DBPRO doesn't, but maybe AppGameKit does.





The second version supports upper/lower case without needing to force the string to upper. Depending upon the string engine such functions can still have some memory trashing in them.. If you know the input text is upper case, you can get rid of it.


Anyway, well done..

Login to post a reply

Server time is: 2024-11-25 21:37:13
Your offset time is: 2024-11-25 21:37:13