![]() |
drawLine()
PHP Code:
PHP Code:
The function will draw polygon from xy1 to xy2, thickness of the line is based on the 4th param (if layer is 4 or lower, it is given in tiles. If 5 or higher thickness is in pixels (This goes to coordinats to (xy1 and xy2)) A nifty little function that I thought I could share :) |
Hmm... does the thickness take into account the direction of the line? From reading it it doesn't seem it, maybe that'd be a good addition.
|
The fancy one you have should be drawline2(), and just have a simple drawline(x1, y1, x2, y2) like in Java and have setcolor() and stuff seperate :o
|
Quote:
It now works, but it makes some sharp corners: ..______ ./......../ /_____/ (Where you remove the dots (pm, this is a zoomed version of the line :p)) I could add some checking to see which direction it is going based on the gived coords tho.. |
I think Graal should have brush functionality much like C#. ;(
|
Quote:
|
Why will people do something like
PHP Code:
PHP Code:
|
Quote:
|
It's just a matter of preference.
|
showimg() = GS1 >:(
As far as I'm concerned considering the way you can use findimg(), I consider showimg() to just be a remnant of GS1 existing for compatibility. |
Quote:
Will probably start using findimg(). |
Quote:
|
I use showimg because it's shorter. If I'm going to be showing an image and change a lot about it though, I'll usually use findimg.
|
Quote:
Quote:
And, I find using findimg() easier to read and debug |
PHP Code:
|
What he needs to do is get the angle of the line, then draw the points half of thickness 90 degree's out to each side.
|
Quote:
It seems superfluous to me to use the with-findimg construct for (essentially) static images. |
Quote:
well, getangle(xy1[0]-xy2[0], xy1[1]-xy2[1]); would do that, but, I haven't got to work on this little function as much, because I've been busy with other stuff :( |
showimg() being GS1? Try to use findimg() serverside.
|
findimg() is listed in the serverside script functions.
I always use findimg() now because I don't want to alternate between two days of doing the same thing. findimg() works for the simple and the complex and is much more readable. Quote:
So theres now 3 ways to do the same thing: PHP Code:
|
Quote:
GS1 is PHP Code:
PHP Code:
PHP Code:
|
Quote:
|
Invern is right, showImg(); was made just for compatibility with showimg; GS2 is technically not related to GS1. You should use findImg, it is more object oriented than showImg;
|
Quote:
|
Quote:
|
Quote:
|
Quote:
Quote:
But showimg involves no lookup. |
Quote:
|
I seem to recall showtext working clientside only back in the GS1 days.
Quote:
And how do you mean that showimg() involves no lookup? |
showimg is a fine function. I personally do something like
this.whatevz = showimg(whatevz); then generally reference the variable when i want to change anything this.whatevz.red = rad; |
findimg() vs. showimg() is just a matter from preference. one isn't more OO than the other; one isn't more 'GS2' than the other. they are pretty much equivalent.
For example, taking Quote:
PHP Code:
|
I came across this thread when trying to find out if there was a built in drawLine() function. However, I needed the width of the line to be the same regardless of angle and made this:
PHP Code:
PHP Code:
PHP Code:
|
All times are GMT +2. The time now is 02:11 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.