Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 04 Feb 2008
Online Last Active Today, 08:24 PM

#5179623 And this is why you don't change names to lowercase

Posted by fastcall22 on 11 September 2014 - 10:36 AM

expertsexchange dot com --

Wait, wait, wait... MD? Game? 68K?
A megadrive game? Ooh, do tell!!

#5176037 Distance formula in c++

Posted by fastcall22 on 25 August 2014 - 12:19 PM

For points A and B, the distance between them is:
C = A-B
sqrt(C dot C)

It's essentially just the Pythagorean theorem.

If you're only comparing distances, then you can leave out the sqrt, keep the distances squared, and only sqrt when you need to. This is because a < b and sqrt(a) < sqrt(b) is always true, for a and b >= 0.

#5174809 Using old array or stl

Posted by fastcall22 on 19 August 2014 - 01:31 PM


#5173504 Jump start ?

Posted by fastcall22 on 13 August 2014 - 11:17 PM

Start anywhere. Start now. Start with Game Maker, if you want to get familiar with basic programming. Start with Python, Java, or C#, if you want to go for the long haul.

#5173498 C++ Runtime Error With Odd Workaround

Posted by fastcall22 on 13 August 2014 - 10:04 PM

Unable to reproduce.


What is the exact code that produces the error?

#5170944 Isn't "delete" so pesky to type? Wish there was a better way?

Posted by fastcall22 on 01 August 2014 - 01:21 PM

if ( Washu == phil67rpg, fir, cthulu )

#5169357 'pass through member function'

Posted by fastcall22 on 26 July 2014 - 01:41 PM

You could treat Class A as an iterator:
class B;
class A {
	B& operator*() {
		return vec[idx];

	B* operator->() {
		return &vec[idx];
	int idx;
	vector<B> vec;

class B {
	void frobnicate();

void test(A& a) {

#5168696 Color bar Interpolation

Posted by fastcall22 on 23 July 2014 - 11:59 AM

Use either of the HSL or HSV color spaces, interpolate in that space, and then convert to RGB when needed.

#5168419 [Help] c++ Allegro, PuyoPuyo colors comparative?

Posted by fastcall22 on 22 July 2014 - 11:29 AM

well something like that ....establishing all the possible IF opcions :S... but there is a easier way to detect the collisions??

This is important step in your growth as a programmer: When you realize what you have learned is infeasible here and that there must be an easier way. While it is certainly possible to code the logic entirely of IF-statements, it quickly becomes unmanageable and buggy. So, as a programmer, you must solve the problem in a generic way. For instance, the procedure could look something like this, in pseudo code:

1. For every unvisited tile on the board:
2.	For each unvisited neighbor of this tile:
3.		Visit each neighbor of the same color:
4.			Count and mark this neighbor tile
5.			Move to this tile and repeat step 2 for this neighbor tile
6.	If there are no more neighbors, and we have moved to this tile:
7.		Move back, and continue on step 5
8.	If we found four or more tiles of the same color neighboring this tile:
9.		Score and remove these tiles
Notice steps 2, 5, and 7: Recursion might be helpful here.

#5166869 Game doesn't crash if currently printing

Posted by fastcall22 on 14 July 2014 - 05:31 PM

Well, it's a bit more complicated than that:

void thing(const char* text) { 
    // Do stuff with text


int main() {
    const char* a = "abc";
    const char b[] = "def"
    char* c = malloc(4);
    char* d = new char[4];

    thing("mno"); // No!
    thing(a);     // No!
    thing(b);     // No!
    thing(c);     // Okay
    thing(d);     // No!

    // free(c);
    // delete[] d;
Here, thing is assuming ownership of text which isn't always the desired behavior, as shown in the sample program here.

#5166832 Storing position of member variable

Posted by fastcall22 on 14 July 2014 - 03:45 PM

Actually, if you're using any of the latest Visual Studio versions, there should be a local database file with your project that contains metadata about your project. Usually, this database is used for intellisense, but you can connect to the database externally and perform SQL queries against it. With this, you can query information about your project, classes, and its members. Extending this, you could write a PowerShell script to automatically generate reflection information from all of your classes. Then you could add this to your build process, and... well, I'm getting ahead of myself, here. smile.png

#5166827 Win32 BOOL and bool ?

Posted by fastcall22 on 14 July 2014 - 03:36 PM

The Win32 API is a C library. C does not have a boolean type. Therefore, Win32 has defined BOOL as being an integer having zero and nonzero for false and true respectively.

See Win32 Data Types.

#5166808 Adding Collider To a LineRenderer - Unity3D

Posted by fastcall22 on 14 July 2014 - 02:40 PM

You could always split the curve into smaller straight segments.

#5166780 Is c++ good

Posted by fastcall22 on 14 July 2014 - 12:56 PM

If you're worried about "wasting time" learning C++, then stop worrying. The most important thing you can learn while learning a language is learning the concepts of programming themselves. Once you've picked up these concepts, it's only a matter of learning how a language describes those concepts (and sometimes the syntax).

#5166483 optymizations by self modifying code

Posted by fastcall22 on 12 July 2014 - 05:17 PM

Those stories about people optymizing wrong places sound a bit strange to me - i naver had such a situation, It was always clear what is a hotspot and indeed every 'optymization session' i was

Except you have had such a situation.

In your speeding this with sse or sse intrinsics thread, you were looking to optimize an inner loop with SSE. Ohforf showed you could speed up your code by 200% just by using a more efficient algorithm without SSE.