Random SDL_Rects resizing/deleting themselves?
Moderator: Coders of Rage
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Random SDL_Rects resizing/deleting themselves?
I'm making a map editor for a 2D RPG, and I'm using SDL_Rects for collision, so I can do custom collision for pretty much whatever I want. In the editor, you draw them with the Middle Mouse Button... For some reason, whenever I scroll away from where I drew the Rectangle... when I come back 1/20th of the time, the rectangle has resized itself, or completely deleted itself. Does anyone know of/ has had any problems relating to this, with rectangles randomly deciding to give themselves a haircut?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- programmerinprogress
- Chaos Rift Devotee
- Posts: 632
- Joined: Wed Oct 29, 2008 7:31 am
- Current Project: some crazy stuff, i'll tell soon :-)
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++!
- Location: The UK
- Contact:
Re: Random SDL_Rects resizing/deleting themselves?
I had a similar problem once before, I believe I was colliding some SDL rects really fast into a wall, and shrank to half their size, but in all honesty, I don't know how I fixed it, and I don't have a clue what I did in the first place (but it's never happened again)
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Random SDL_Rects resizing/deleting themselves?
it seemed that any rects with a w/h that ends up past 1024 or 768 respectively, cuts itself down to size to fit into that, or into the screen. After like a half hour of researching through the docs, I ended up making my own class. It works perfectly now.
Code: Select all
class rect {
Public:
int x,y,w,h
};
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
Re: Random SDL_Rects resizing/deleting themselves?
It's been a looong while since I've used SDL...But I do seem to recall having a similar problem. From what I understood, you cannot move a rect offscreen...Ever. You'd be blitting off the surface. So SDL simply resizes the rect to give the appearance that it's going off the screen--basically it catches your fuckup gracefully.
Though there's always the fat chance that I don't remember correctly, am an idiot, etc, so don't quote me on this one. ;p
Have you tried googling it?
Though there's always the fat chance that I don't remember correctly, am an idiot, etc, so don't quote me on this one. ;p
Have you tried googling it?
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Random SDL_Rects resizing/deleting themselves?
It works now. But thanks, that's pretty much what I guessed except a little more detailed. I'm using Visual basic to make a NPC editor, I'm suprised at how EASy it is!ibly31 wrote:it seemed that any rects with a w/h that ends up past 1024 or 768 respectively, cuts itself down to size to fit into that, or into the screen. After like a half hour of researching through the docs, I ended up making my own class. It works perfectly now.
Code: Select all
class rect { Public: int x,y,w,h };
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
Re: Random SDL_Rects resizing/deleting themselves?
Haha, true dat.
Start building...But without a framework.
That's something we'd probably make peter pull out of his asshole.
Yes, things are always easier in BASIC languages for that reasoning...Until you begin trying to solve some of the more complex problems. Then you end up running into language limitations and would have been better off starting off in C++ or another powerful, lower-level language.
Start building...But without a framework.
That's something we'd probably make peter pull out of his asshole.
Yes, things are always easier in BASIC languages for that reasoning...Until you begin trying to solve some of the more complex problems. Then you end up running into language limitations and would have been better off starting off in C++ or another powerful, lower-level language.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
Re: Random SDL_Rects resizing/deleting themselves?
Just nitpicking a litte; since you're not using any class "things":
Don't start a holy war, please.
Code: Select all
struct rect {
int x,y,w,h;
};
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Random SDL_Rects resizing/deleting themselves?
BTW, the struct and class keywords do EXACTLY the same thing in C++. Only difference is structs are public by default where as classes are private.Scoody wrote:Just nitpicking a litte; since you're not using any class "things":Don't start a holy war, please.Code: Select all
struct rect { int x,y,w,h; };
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: Random SDL_Rects resizing/deleting themselves?
As I said, only nitpicking.dandymcgee wrote: BTW, the struct and class keywords do EXACTLY the same thing in C++. Only difference is structs are public by default where as classes are private.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Random SDL_Rects resizing/deleting themselves?
Same.Scoody wrote:As I said, only nitpicking.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!