Search found 75 matches

by bnpph
Sun Jul 10, 2011 7:55 am
Forum: Programming Discussion
Topic: 2d Platform Slope Collision
Replies: 24
Views: 6287

Re: 2d Platform Slope Collision

There is no need to use either of those methods for simple 45 degree tile slopes. How I would do it: 1. Check if player is withing tile boundary box 2. If so, check if relative x >= relative y Most definitely yes. But if you're going to add 45 degree slopes, using this method you can add slopes of ...
by bnpph
Sat Jul 09, 2011 1:36 pm
Forum: Programming Discussion
Topic: 2d Platform Slope Collision
Replies: 24
Views: 6287

Re: 2d Platform Slope Collision

There is no need to use either of those methods for simple 45 degree tile slopes.

How I would do it:
1. Check if player is withing tile boundary box
2. If so, check if relative x >= relative y
by bnpph
Sat Jul 09, 2011 9:39 am
Forum: Programming Discussion
Topic: Visual C++ 2008 Express And Templates
Replies: 10
Views: 1333

Re: Visual C++ 2008 Express And Templates

You can do it in source files if you know the types you are using. Also if you use a non-standard extension.
by bnpph
Fri Jul 08, 2011 5:54 pm
Forum: Programming Discussion
Topic: Visual C++ 2008 Express And Templates
Replies: 10
Views: 1333

Re: Visual C++ 2008 Express And Templates

This is working fine for me on VS 2008: template <class T> class myClass { public: myClass() { } ~myClass() { } void doSomething(T *obj); }; template <class T> void myClass<T>::doSomething(T *obj) { // Whatever } int main () { int var; myClass<int> cl; cl.doSomething(&var); return 0; } Post the ...
by bnpph
Thu Jul 07, 2011 11:28 pm
Forum: Programming Discussion
Topic: C++ boost alternitive.
Replies: 7
Views: 2158

Re: C++ boost alternitive.

Why do you need to use boost::any? You can probably achieve the same result using a different way.
by bnpph
Mon Jul 04, 2011 2:49 pm
Forum: Programming Discussion
Topic: PTL Library
Replies: 12
Views: 1727

Re: PTL Library

I've run some quick tests, but there really is no good way to benchmark this sort of thing. Do some large scale insertion, deletion, and maybe even sorting (though this opens a whole subsection of extra benchmarking). The reason why they are meaningless is because the user is the one who will be de...
by bnpph
Mon Jul 04, 2011 2:42 pm
Forum: Programming Discussion
Topic: How do YOU structure your game engine(s)?
Replies: 16
Views: 4370

Re: How do YOU structure your game engine(s)?

Keep sound/graphics/game-objects as separate components.
Decide what you need and stick to it. You don't need a fully-featured game engine for a tiny platformer.
by bnpph
Sun Jul 03, 2011 2:18 pm
Forum: Programming Discussion
Topic: PTL Library
Replies: 12
Views: 1727

Re: PTL Library

I took a closer look and put some more thought into evaluating your library's features, and I have to admit - it's pretty cool. The use of preprocessor macros to provide features reminds me of QObjects, and that's a good thing in my opinion. Keep up development, but don't disregard the importance o...
by bnpph
Sat Jul 02, 2011 3:04 pm
Forum: Programming Discussion
Topic: PTL Library
Replies: 12
Views: 1727

Re: PTL Library

STD == STL ? STL usually refers to C++ STD's containers and algorithms, but I don't think it is an official term. I should probably take this opportunity to point out why standard containers are good: they are GUARANTEED to have certain functionality, no matter what platform you're on. All of the c...
by bnpph
Fri Jul 01, 2011 3:57 pm
Forum: Programming Discussion
Topic: PTL Library
Replies: 12
Views: 1727

PTL Library

PTL is a library I am working on that provides similar functionality to STD containers, but it is designed to be extremely fast and extendable. Out of the box, PTL has a collection of simple containers: ptl::parray<typename>; ptl::pstack<typename>; ptl::pvector<typename>; ptl::plist<typename>; //etc...
by bnpph
Thu Jun 30, 2011 6:52 pm
Forum: Programming Discussion
Topic: Signal/Slot Library Suggestion?
Replies: 19
Views: 4017

Re: Signal/Slot Library Suggestion?

Are you sure signals/slots are what you need?

I have never used them, but I always thought they were designed for GUI things.
by bnpph
Sat Jun 25, 2011 3:55 pm
Forum: Programming Discussion
Topic: Pass a class object as a parameter? (C++/SDL)
Replies: 6
Views: 1201

Re: Pass a class object as a parameter? (C++/SDL)

Using a member function is read-only if it has const after it: void method() const {} (I forget the term for this) This is how you could use references: void foo(int& x) { x += 5; } int main() { int var = 10; foo(var); //var is now 15 } so, this would be correct? That wouldn't work. This should:...
by bnpph
Sat Jun 25, 2011 3:09 pm
Forum: Programming Discussion
Topic: Pass a class object as a parameter? (C++/SDL)
Replies: 6
Views: 1201

Re: Pass a class object as a parameter? (C++/SDL)

References are like pointers, except they use a different syntax.

void option(Card &card); can do the same things that void option(Card *card) can.
A const reference is read-only. If you want to write, you generally use pointers instead, although references work too.
by bnpph
Sat Jun 25, 2011 2:21 pm
Forum: Programming Discussion
Topic: Quick and easy prime number test because...
Replies: 1
Views: 600

Re: Quick and easy prime number test because...

sqrt() is slow. Especially math.h's version. There might be a builtin for finding next power of 2, but I forgot it. bool isPrime2(unsigned int n) { if (n % 2 == 0) return false; unsigned int nl = n; nl |= (nl >> 1); nl |= (nl >> 2); nl |= (nl >> 4); nl |= (nl >> 8); nl |= (nl >> 16); nl += 1; nl >>=...
by bnpph
Fri Jun 24, 2011 1:28 pm
Forum: Programming Discussion
Topic: XNA FPS?
Replies: 12
Views: 2320

Re: XNA FPS?

2.5 FPS? What is that supposed to mean?

XNA is not the sort of thing you'd write a retro raycaster in - just use d3d as you would for a normal FPS.