JGE++ question
Re: JGE++ question
This is because of bilinear filtering. If you know you will never scale your quads, I suggest you deactivate bilinear filtering in JGE (I believe you can call a function to do that, can't remember the name).
If you need to scale your textures, then bilinear filtering is suggested. In that case, either load the textures with 1 pixel less than what they are on top and left (or is it bottom and right ?).
For example, if your texture is 32x32, your quad should look like:
(0,0,31,31) instead of (0,0,32,32).
(or (1,1,31,31), I'm not sure anymore...
If you need to scale your textures, then bilinear filtering is suggested. In that case, either load the textures with 1 pixel less than what they are on top and left (or is it bottom and right ?).
For example, if your texture is 32x32, your quad should look like:
(0,0,31,31) instead of (0,0,32,32).
(or (1,1,31,31), I'm not sure anymore...
-
- Posts: 61
- Joined: Sat Oct 31, 2009 10:30 pm
Re: JGE++ question
I think 1,1,31,31. I'll just disable bilinear filtering I guess cause I dont really need to scale them (so far at least I dont need to).
Here's a screenshot btw, if you are curious
http://img704.imageshack.us/img704/5899 ... shotdk.png
Thanks, turning off filtering helps!
Here's the function call in case you are interested:
renderer->EnableTextureFilter(false);
Here's a screenshot btw, if you are curious
http://img704.imageshack.us/img704/5899 ... shotdk.png
Thanks, turning off filtering helps!
Here's the function call in case you are interested:
renderer->EnableTextureFilter(false);
Re: JGE++ question
It's looking good! I would love to play HOMM on the PSP
-
- Posts: 61
- Joined: Sat Oct 31, 2009 10:30 pm
Re: JGE++ question
Finally, after almost 2 month of break from writing the code(was too busy at work and school), I spent the day today to create some simple pathfinding logic. Works pretty good actually Take a look.
http://www.megaupload.com/?d=DYGU0TGX
http://www.megaupload.com/?d=DYGU0TGX
Re: JGE++ question
Nice progress, this looks good
Re: JGE++ question
Glad to see that you're still working on this one.
-
- Posts: 61
- Joined: Sat Oct 31, 2009 10:30 pm
Re: JGE++ question
Yeah, too bad I have so little time lately. Because I've got a lot of things I want to work on, like map editor, AI, castles, and all the other good stuff. I guess I'll have more time when I get done with my masters in the end of April.
-
- Posts: 61
- Joined: Sat Oct 31, 2009 10:30 pm
Re: JGE++ question
A new demo video, guys! I guess I can already call this version 0.01.
Some new features:
- AI! (Very simple one so far, it just finds a random "clickable" object on the map and runs to it)
- Multiple heroes for AI and Player
- Switch between heroes by pressing a Square button
- Dynamically calculated path based on the amount of obstacles present (if you switch between your heroes, move one of them out of the way to the target, and switch back, a new path will be calculated)
- Treasure chests are now collectible for gold or experience
- Objects disappear from the map, once collected by Player
- Main menu (So far only one option - exit game by pressing X)
http://www.megaupload.com/?d=SDEGOTXL
Some new features:
- AI! (Very simple one so far, it just finds a random "clickable" object on the map and runs to it)
- Multiple heroes for AI and Player
- Switch between heroes by pressing a Square button
- Dynamically calculated path based on the amount of obstacles present (if you switch between your heroes, move one of them out of the way to the target, and switch back, a new path will be calculated)
- Treasure chests are now collectible for gold or experience
- Objects disappear from the map, once collected by Player
- Main menu (So far only one option - exit game by pressing X)
http://www.megaupload.com/?d=SDEGOTXL
-
- Posts: 61
- Joined: Sat Oct 31, 2009 10:30 pm
Re: JGE++ question
An actual question for you guys:
I have a 2-d array of pointers to objects:
where MapObj is the base class for the objects on the map. Now, I also have some derived classes (MapObjTest, for example) and some of the MapObjects are pointers to objects of this type. For example,
This derived class has a method ReturnVar that I'd like to call (not part of the base class), which returns an int. Is there any other way to do this other than:
Am I even doing this right at all? It seems to work, but I'm not sure if i can assign pointers to class MapObjTest to pointers of type MapObj without consequences.
I have a 2-d array of pointers to objects:
Code: Select all
MapObj *MapObjects[MapWidth][MapHeight];
where MapObj is the base class for the objects on the map. Now, I also have some derived classes (MapObjTest, for example) and some of the MapObjects are pointers to objects of this type. For example,
Code: Select all
MapObjects[0][0] = new MapObjTest(IMPASS,"knight_castle_bot4",0,0,5);
Code: Select all
x = dynamic_cast<MapObjTest*>(MapObjects[0][0])->ReturnVar();
Re: JGE++ question
Basically if you have an array of objects and that all these objects don't share the same method names I would start by questioning the design (Wagic has lots of such bad code, by the way). Maybe the method should be in the base class (virtual, of course) and do nothing in the default parent class ?
You need to test that the dynamic cast didn't return null first.
Code: Select all
x = dynamic_cast<MapObjTest*>(MapObjects[0][0])->ReturnVar();