Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Create my own Rect for clipping?
Create my own Rect for clipping? [message #7696] Mon, 15 January 2007 21:05 Go to next message
snap2000 is currently offline  snap2000
Messages: 14
Registered: January 2007
Promising Member
Hi. I'm trying to create a chess game, and I have my chess pieces laid out in a single png image. My intentions were to simply clip the image to display a particular piece, which I can do fine by putting in the coordinates myself... however, that isn't very practical. It'd be much nicer to be able to use Clip(const Rect&) instead of Clip(int, int, int, int)...

So, I was wondering how I'm supposed to create my own Rect? I noticed in GTypes.h that the Rect template has four Set functions, but I can't seem to be able to use them...
Re: Create my own Rect for clipping? [message #7698 is a reply to message #7696] Mon, 15 January 2007 23:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Rect r(left, top, right, bottom);

r = RectC(x, y, cx, cy);

r.left = x; r.top = y, r.right = x + cx; r.bottom = y + cy;

......



Mirek
Re: Create my own Rect for clipping? [message #7699 is a reply to message #7698] Tue, 16 January 2007 01:55 Go to previous message
snap2000 is currently offline  snap2000
Messages: 14
Registered: January 2007
Promising Member
Ah! Thank you. I'd forgotten about that. =)
Previous Topic: Wrong Size problem..
Next Topic: How to zoom images? [PARTLY SOLVED...]
Goto Forum:
  


Current Time: Wed Nov 20 08:32:13 CET 2019

Total time taken to generate the page: 0.02595 seconds