displaying an image

Discuss the development of plugins for Ashita v3 here.
Locked
gilles
Posts: 30
Joined: Sun May 15, 2016 1:53 pm

displaying an image

Post by gilles » Thu May 03, 2018 7:21 pm

hello, i'm not sure i'm doing it correctly

Code: Select all

IFontObject* f = this->m_AshitaCore->GetFontManager()->Create("name");
f->SetPositionX(X);
f->SetPositionY(Y);
IPrimitiveObject* prim = f->GetBackground();
prim->SetColor(0x3F000000);
prim->SetTextureFromFile("image.png");
prim->SetVisibility(true);
f->SetFontHeight(10);
f->SetVisibility(true);
f->SetLocked(true);
f->SetText(" ");
first problem i have is the image is very small.
it seems dependant on the font size and the text length
so to display it correctly i have to use

Code: Select all

f->SetFontHeight(50);
f->SetText("        ");
second problem i have is that using code below is completly ignored (500 or 1 is same result)

Code: Select all

prim->SetWidth(500);
prim->SetHeight(500);
this is a headache because i want to make my image being resizable by a multiplier and i can't put some numbers like 10.1 or 10.25 in SetFontHeight
User avatar
atom0s
Site Admin
Posts: 457
Joined: Sat May 14, 2016 5:13 pm

Re: displaying an image

Post by atom0s » Thu May 03, 2018 9:08 pm

Set the auto resize property (SetAutoResize) to false so that the size of the object is handled by you manually.
Lead Ashita Developer

Want to donate to say thanks?
https://www.paypal.me/atom0s
gilles
Posts: 30
Joined: Sun May 15, 2016 1:53 pm

Re: displaying an image

Post by gilles » Thu May 03, 2018 10:39 pm

thanks, it's working correctly now.
Locked