Search found 49 matches
- November 9th, 2016, 11:52 pm
- Forum: Everything
- Topic: Entity Components as apposed to derived classes
- Replies: 16
- Views: 5264
Re: Entity Components as apposed to derived classes
I have looked into a template architecture but it does confuse me a bit ( I haven't used them much). I do have the ability to decipher whats going on when i read code (for the most part), so an example would be appreciated. Here's a quick example I just put together (Uses exceptions, but you could ...
- November 9th, 2016, 11:08 am
- Forum: Everything
- Topic: Entity Components as apposed to derived classes
- Replies: 16
- Views: 5264
Re: Entity Components as apposed to derived classes
Just some tips looking over your code If you intend to grow this more, I'd suggest using some type defs/aliases for things like XMMATRIX/XMVECTOR While not a perfect rule you should avoid adding things to an interface that are unrelated (e.g. Component::GetMatrix) Instead of having a raw pointer, an...
- October 30th, 2016, 12:06 pm
- Forum: Everything
- Topic: Virtual base class...what?
- Replies: 12
- Views: 3985
Re: Virtual base class...what?
ITimer *pTimer = new Timer; <-didn't initialize the vtable so pTimer->Start() would crash program This should not be the case the default-constructor should initialize the vtable. If it is not report a bug? What compiler are you using? I just tried VS 2015 and it worked just fine. This shouldn't ma...
- October 30th, 2016, 9:36 am
- Forum: Everything
- Topic: Virtual base class...what?
- Replies: 12
- Views: 3985
Re: Virtual base class...what?
There is nothing to initialize for ITimer, it needs to do nothing. There is no point in time it needs to use the ITimer vtable, so can not create it so there will only be a Timer vtable, that should be set by the constructor.
I am confused but what the issue you have is?
I am confused but what the issue you have is?
- October 29th, 2016, 8:26 am
- Forum: Everything
- Topic: Bool construct
- Replies: 8
- Views: 2898
Re: Bool construct
I think casting to bool, checks bit patterns, which 0.f is also 0x0, but -0.f is not 0x0 in integer numbers Conversion has nothing to do with bits its about the value (zero). bool test = val != 0.f; Never do this unless you are assigning it directly to 0. I can not reiterate enough avoid exact comp...
- October 28th, 2016, 10:33 pm
- Forum: Everything
- Topic: Bool construct
- Replies: 8
- Views: 2898
Re: Bool construct
Floating point numbers are hard. While not exactly floats open windows calculator and do "sqrt(4) - 2" notice this is not 0 but near 0?
- October 28th, 2016, 10:30 pm
- Forum: Everything
- Topic: Bool construct
- Replies: 8
- Views: 2898
Re: Bool construct
All values of exactly 0 get converted to false, everything else is true. However if you are working with any float that is calculated and wanting to check if its zero, do not do this as due to precision you might not be dealing with exactly 0 but close to 0
- October 27th, 2016, 2:01 pm
- Forum: Everything
- Topic: Circular dependency
- Replies: 11
- Views: 3758
Re: Circular dependency
What are the error message(s)? If your using include guards or "pragma once" then your includes are less of an issue then what they contain. You should also rely on forward declarations where you can get away with incomplete types. For debugging these sort of issues, I suggest finding individual fil...
- October 26th, 2016, 11:38 am
- Forum: Everything
- Topic: Wondering if this is a used much
- Replies: 6
- Views: 2096
Re: Wondering if this is a used much
Usage of C variaric functions is error prone and unsafe and should generally be avoided as everyone has already said. This gets even worse when you start having a method on an interface that takes different arguments based on implementation. Your code for this would already have to know the implemen...
- October 25th, 2016, 8:59 am
- Forum: Everything
- Topic: Is this a good use of a lamba function, it's my first ..
- Replies: 11
- Views: 3895
Re: Is this a good use of a lamba function, it's my first ..
If your measuring performance you should generally be only focused on Release mode, you will find pretty much no noticable difference between iterators and indexes. Using Debug mode it varies on implementations for what will be faster iterators or indexes, but you should not be doing this comparison...