These are chat archives for ikkentim/SampSharp

21st
Oct 2016
Xalphox
@Xalphox
Oct 21 2016 16:58
Sorry for the delay - was away on biz
Mind sharing the code?
Unless it's on the git which I'm gonna check now
Tim Potze
@ikkentim
Oct 21 2016 17:00
Fixed it, see textdraw related commits in s# repo
Xalphox
@Xalphox
Oct 21 2016 17:00
GH seems down atm, but pleased to hear
Tim Potze
@ikkentim
Oct 21 2016 17:02
Works for me, but prolly related to dyndns outage earlier
Xalphox
@Xalphox
Oct 21 2016 19:43
:D
Out of interest
why do you do
_font.Do(x => Font = x)
Not criticising, just trying to work out what that means
slash why it's different from Font = _font
Tim Potze
@ikkentim
Oct 21 2016 19:44
My own Nullable<T> extension, basically does if(_font.HasValue){/* action, in this case: */Font = _font; }
Xalphox
@Xalphox
Oct 21 2016 19:45
oh I see
Tim Potze
@ikkentim
Oct 21 2016 19:45
Note type of _font is TextDrawFontType?
Xalphox
@Xalphox
Oct 21 2016 19:45
yeah I'm dumb, didn't see that
Thanks
Tim Potze
@ikkentim
Oct 21 2016 19:45
np :P
In my UI library it all batches up just fine, but i'm wondering if i should make the ui implementation use a different natives wrapper. PlayerTextDraw will update the client by calling ShowPlayerTextDraw(...) after every change. However, when batching changes in the UI, this looks like SetPlayerTextDrawFont(...); ShowPlayerTextDraw(...); SetPlayerTextDrawAlignment(...); ShowPlayerTextDraw(...); SetPlayerTextDrawLetterSize(...); ShowPlayerTextDraw(...); Quite useless calls in this case.
I'll create a repo for the ui lib in a bit btw so you can see how it's coming along
Xalphox
@Xalphox
Oct 21 2016 19:48
Sure
I just had a .Draw/.Redraw
Xalphox
@Xalphox
Oct 21 2016 19:49
Looking good
Have you took into account alignment at all?
Tim Potze
@ikkentim
Oct 21 2016 19:50
Just working on different elements atm, this one, TextArea is supposed to split so it fits the box, but it doesn't split in the right places yet
account alignment?
Xalphox
@Xalphox
Oct 21 2016 19:50
ie. TextDrawAlignment.Left:
X = X
Y = Y
Width = X + width
Height = height
Tim Potze
@ikkentim
Oct 21 2016 19:50
oh nvm
that
Xalphox
@Xalphox
Oct 21 2016 19:50
Textdraw.Centre:
X = X
Y = Y
Width = Height
Height = Width
Tim Potze
@ikkentim
Oct 21 2016 19:50
I'm thinking of ditching the alignment property alltogether, seeing I want to implement anchoring
Xalphox
@Xalphox
Oct 21 2016 19:50
that's fair
Tim Potze
@ikkentim
Oct 21 2016 19:50
because this alignment system is such a pain in the ass
Xalphox
@Xalphox
Oct 21 2016 19:50
agreed
it's terrible
Tim Potze
@ikkentim
Oct 21 2016 19:55
Ultimately, I want to be able to create a panel: Panel panel = new Panel(); and if you want to add a label in the bottom right: Label label = new Label(); label.Text = "Hello, World!"; label.Margin = new Margin(4);/*top, right, bottom, left*/ label.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; label.Position = new Vector2(0, 0);/*is default value, but just for clarity, notice the position origin matches the anchor style. */ panel.Controls.Add(label);
Xalphox
@Xalphox
Oct 21 2016 19:55
Smart
Tim Potze
@ikkentim
Oct 21 2016 20:40
https://github.com/ikkentim/sampsharp-ui . it currently references sampsharp using a relative path to the sampsharp repo since the textdraw fix is not yet on the nuget repo
Xalphox
@Xalphox
Oct 21 2016 22:06
sweet
Xalphox
@Xalphox
Oct 21 2016 22:12
for the designer - don't forget about the bullshit around text rendering Tim
any idea how you're gonna approach that? I might start cooking up the code to render the fonts for you myself
Tim Potze
@ikkentim
Oct 21 2016 22:16
Nope :( I'm looking into possibilities and how the heck winforms designer approaches it but not yet actively looking, first the code, then the designer :) I know it will be quite a challenge at the least, think the rendering will be the easy part, need some research into code analysis from the viewport of VS extensions
Xalphox
@Xalphox
Oct 21 2016 22:17
woo
sounds fun
Tim Potze
@ikkentim
Oct 21 2016 22:17
Ya