Native ZScript line drawing function

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Native ZScript line drawing function

Re: Native ZScript line drawing function

by Gutawer » Wed Aug 02, 2017 7:25 pm

Sure -

Code: Select all

class LineHandler : StaticEventHandler {
	override void RenderOverlay(RenderEvent e) {
		Screen.DrawLine(0, 0, Screen.GetWidth(), Screen.GetHeight(), Color(0xFF, 0xFF, 0x00, 0xFF));
		Screen.DrawLine(0, Screen.GetHeight(), Screen.GetWidth(), 0, Screen.PaletteColor(200));
	}
}
Draws two diagonal lines, one from RGBA and one from the palette.

Re: Native ZScript line drawing function

by Rachael » Wed Aug 02, 2017 6:57 pm

Can you post your test example please, for easier review, that you showed pictures of on Discord?

Re: Native ZScript line drawing function

by Gutawer » Wed Aug 02, 2017 6:31 pm

Decided to do this myself, since this got no attention: https://github.com/coelckers/gzdoom/pull/355

Re: Native ZScript line drawing function

by Major Cooke » Wed Aug 02, 2017 5:26 pm

Damn. There's a version for each renderer and I don't know how to call those. Otherwise I'd make a PR.

Re: Native ZScript line drawing function

by DrPyspy » Wed Aug 02, 2017 5:14 pm

I don't have it on hand due to the code being on PasteBin, but if you ask him on Discord he might lend it.

Re: Native ZScript line drawing function

by Major Cooke » Wed Aug 02, 2017 5:13 pm

Where is his version?

Re: Native ZScript line drawing function

by DrPyspy » Wed Aug 02, 2017 5:09 pm

Seeing as there hasn't been a response to this, I'd like to propose a case in which this function would be useful.

Image

This minimap currently works by printing a 4096-character string to the screen. However, printing 4096 characters to the screen at once tends to hurt performance. My plan to optimize it involves grabbing nearby linedefs and printing them to the screen using a line drawing function. However, without a native method of doing this, it cannot be done properly. Attempts to use Gutawer's line drawing function actually brought the performance down slightly more than the original method.

Re: Native ZScript line drawing function

by Major Cooke » Mon Jun 26, 2017 2:51 pm

Fourthed. Using something like this would allow special effects, arrows, etc to be used by the hud system and grant an undeniable amount of custom rendering. I can already see holographic effects happening with this.

Re: Native ZScript line drawing function

by DrPyspy » Mon Jun 26, 2017 12:58 pm

Thirded. A native function would make the process of drawing lines to the screen much more accessible with ZScript.

Re: Native ZScript line drawing function

by Nash » Thu Jun 08, 2017 9:59 am

Seconded! I had the cheeky idea to make some homegrown solution for drawing GUI panels and stuff using screen fill as the pixel-blitting API (like what the save/load menu is currently doing with the blue selector) but I quickly stopped when I realized it's pointless and will probably be damn slow...

Native ZScript line drawing function

by Gutawer » Thu Jun 08, 2017 9:39 am

Would be nice to have a native line drawing algorithm for the Screen struct and the BaseStatusBar class - line drawing algorithms can be implemented in ZScript by the user, but will be slow as the function couldn't be native. A native function DrawLine function like this would be a real help for, for example, drawing the map to the screen as an in-hud automap.

Top