About Store Forum Documentation Contact



Post Reply 
image fit to screen
Author Message
bart1234 Offline
Member

Post: #1
image fit to screen
he i have made a temporary background .png image for the login screen. i load the image it like this:

------------------------------------------------------------------------
Image image;

image.Import("data/gfx/logo/Loginbackground.png",-1,IMAGE_2D);
image.draw(-1, 0.5f, 2, 1);
------------------------------------------------------------------------
but i was wondering is it possible to make the image fit to screen for every resolution and also so it automaticly adjust size when someone changes resolution.

my second question is: I have created some basic interface file named Account login.gobj and saved the file in folder -->Data\Gui\Obj\
however i cant seem to find anything in the tutorials on how to load these files into the game
so would be verry verry nice if some one could clear this up to me.

i hope someone can guide me a bit with these 2 questions

thx alot

Bart Hertman
(This post was last modified: 05-18-2011 05:40 PM by bart1234.)
05-18-2011 05:19 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #2
RE: image fit to screen
I use this:
Quote:Image.draw(Rect(-D.w(),-D.h(),D.w(),D.h()));
But you also have:
Quote:Image.drawFs();
05-18-2011 05:31 PM
Find all posts by this user Quote this message in a reply
bart1234 Offline
Member

Post: #3
RE: image fit to screen
(05-18-2011 05:31 PM)Seba Wrote:  I use this:
Quote:Image.draw(Rect(-D.w(),-D.h(),D.w(),D.h()));
But you also have:
Quote:Image.drawFs();

thx alot for the supper fast reply. however i have some difficulty with this.
first of al when i do this.
Quote:Image image;
image.Import("data/gfx/logo/Loginbackground.png",-1,IMAGE_2D);
Image.draw(Rect(-D.w(),-D.h(),D.w(),D.h()));

i get error: error C2143: syntax error : missing ';' before '.'

so i was hoping maybe you could explain to me what the line below stands for and what i have to do with it to get it working

-D.w(),-D.h(),D.w(),D.h()

sorry for this question but i'm still learning c++
(This post was last modified: 05-18-2011 05:59 PM by bart1234.)
05-18-2011 05:56 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #4
RE: image fit to screen
D is object of struct Display.
Quote:Flt w () {return _w ;} // get Display Width (in screen coordinates, usually something near 1.3, depends on selected resolution and aspect mode)
Flt h () {return _h ;} // get Display Height (in screen coordinates, usually something near 1.0, depends on selected resolution and aspect mode)
But you need change:
Quote:Image to image
To
Quote:image.draw(Rect(-D.w(),-D.h(),D.w(),D.h()));
because you have:
Quote:Image image;
05-18-2011 06:37 PM
Find all posts by this user Quote this message in a reply
bart1234 Offline
Member

Post: #5
RE: image fit to screen
Thx for the fast and verry good explenation i understand it now and got it working witouth any effort thx to you smile

thx again.

Bart hertman

ps. could you plz ready my second question i have added to my first message of this post.
thx alot. (i know how to create windows/buttons etc using code)
(This post was last modified: 05-18-2011 06:52 PM by bart1234.)
05-18-2011 06:50 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #6
RE: image fit to screen
Advanced->1->Gui->08 - Loading Gui Objects.cpp
05-18-2011 07:06 PM
Find all posts by this user Quote this message in a reply
bart1234 Offline
Member

Post: #7
RE: image fit to screen
(05-18-2011 07:06 PM)Seba Wrote:  Advanced->1->Gui->08 - Loading Gui Objects.cpp

haha nice i have been looking for such an tut i tought it was strange there wasnt any lol. haha my bad overlooked it.

thx for all your help man you'r the best
(This post was last modified: 05-18-2011 07:20 PM by bart1234.)
05-18-2011 07:20 PM
Find all posts by this user Quote this message in a reply
NxShape Offline
Member

Post: #8
RE: image fit to screen
image.drawFit(Rect(-D.w(),-D.h(),D.w(),D.h()));
05-19-2011 02:34 PM
Find all posts by this user Quote this message in a reply
Post Reply