Search found 312 matches
- Mon Mar 23, 2009 6:36 am
- Forum: Programming Discussion
- Topic: Random SDL_Rects resizing/deleting themselves?
- Replies: 9
- Views: 703
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. class rect { Public: int x,y,w,h }; It works...
- Sun Mar 22, 2009 9:04 am
- Forum: Programming Discussion
- Topic: Random SDL_Rects resizing/deleting themselves?
- Replies: 9
- Views: 703
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
};
- Fri Mar 20, 2009 10:08 pm
- Forum: Programming Discussion
- Topic: Random SDL_Rects resizing/deleting themselves?
- Replies: 9
- Views: 703
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 o...
- Thu Mar 19, 2009 8:31 pm
- Forum: Programming Discussion
- Topic: SDL Menu?
- Replies: 9
- Views: 1508
Re: SDL Menu?
Off topic: but I'm super excited, I finished pixel perfect scrolling with my 2D rpg. And An array of SDL rects that give pixel perfect collision detection!
- Thu Mar 19, 2009 2:45 pm
- Forum: Programming Discussion
- Topic: SDL Menu?
- Replies: 9
- Views: 1508
Re: SDL Menu?
Never include everyything in your main loop. Make a menu function that has it's own loop that handles the input and checks for someone hitting the X or pressing escape. Don't EVER make your game loop have a whole portion for just the menu, just make a functions that's called before it.
- Wed Mar 18, 2009 7:51 pm
- Forum: Programming Discussion
- Topic: Quick Fill of a Rectangle?
- Replies: 4
- Views: 480
Re: Quick Fill of a Rectangle?
<-- COMPLETELY IGNORE THIS, I AM AN IDIOT--> Oh! *dst shoulda been a flag... Um, how do you use Uint 8? It's like 0xA for black, why can't they just use RGB...? What is the Uint 8 code for Red? {255,0,0} red. <-- END IGNORATION PLOX :3 --> EDIT: Is there a way to have a Red border, with transparent ...
- Wed Mar 18, 2009 7:18 pm
- Forum: Programming Discussion
- Topic: Quick Fill of a Rectangle?
- Replies: 4
- Views: 480
Quick Fill of a Rectangle?
I'm working on the collision for my RPG. The way I'm going to come at it is to have an array of SDL_Rects, and test each one per loop. In the editor, I'm making you draw with the Middle Scroll Wheel. (clicking). To show where the rectangle is that you drew, I'm making it fill the rectangle. Does any...
- Mon Mar 16, 2009 7:59 pm
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Re: Convert String to Code??
Um... Thanks? Well I'm on now, and I got saving done and half of loading done without coming here, so... I am writing my own code? And I've written the entire animation/movement/drawing/cursor/character for both the engine and the level editor made up of 98% my code. (If you don't count the headers ...
- Mon Mar 16, 2009 4:14 pm
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Re: Convert String to Code??
my sister has had 4 essays due for the same class today, and I have been using my iPod to post, I couldn't have done anything. Okay, my next question was gonna be how to interpret strings(.npc files)
- Sun Mar 15, 2009 8:01 pm
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Re: Convert String to Code??
If It is looping through the X and Y things... won't it do each char?
in the string
"1 2 3"
it will return
"1"," ","2"," ","3"
Right??
And How does it know that
12 23 45 67
Isnt 1 2 2 3 4 5 6 7 ??
in the string
"1 2 3"
it will return
"1"," ","2"," ","3"
Right??
And How does it know that
12 23 45 67
Isnt 1 2 2 3 4 5 6 7 ??
- Sun Mar 15, 2009 7:25 pm
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Re: Convert String to Code??
int LoadMap(string map_file) { ifstream loadMap; loadMap.open(map_file.c_str()); int input; for(int i = 0; i < MAX_TILES_HEIGHT; i++) { for(int j = 0; j < MAX_TILES_WIDTH; j++) { loadMap >> input; switch(input) { case 1: map[j][i].set = true; map[j][i].type = GRASS; break; case 2: map[j][i].set = t...
- Sun Mar 15, 2009 7:22 pm
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Re: Convert String to Code??
I know! Thats the whole reason I posted, to be able to not have to to do that. I want to read from external txt files. How?
- Sun Mar 15, 2009 6:11 pm
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Re: Convert String to Code??
I made them C++ code, because for testing purposes I wanted to be able to have a map loaded(change the CODE to load a map) but now I need to be able to read EXTERNAL .map files. Instead of hard code it in, I need to read 1 2 3 4 5 1 2 3 4 5 into levelData[2][5] = {{1,2,3,4,5},{1,2,3,4,5}}; that is m...
- Sun Mar 15, 2009 10:35 am
- Forum: Programming Discussion
- Topic: Convert String to Code??
- Replies: 16
- Views: 1169
Convert String to Code??
I'm making a level editor in SDL, and everything is great, it writes to a .map file, and instead of my own way of compression, or encoding it weird... I made it output this: int levelData[MAP_HEIGHT][MAP_WIDTH] = {{etc,etc,etc},{etc,etc,etc}}; int levelScene[MAP_HEIGHT][MAP_WIDTH] = {{etc,etc,etc},{...
- Sun Mar 15, 2009 10:30 am
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
Re: String help?
I fixed it, the main while(quit == false) loop didn't have another while(pollevent) loop inside it.