This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* File comments updated: Sunday, March 25, 2012 at 12:38 AM | |
* | |
* COLLISION SYSTEM: provides functions to create collision objects | |
* and detect collisions between objects and points. | |
* Used by most animated objects on the canvas to detect collisions. | |
*/ | |
// POINT: contains an x and y position | |
function Point(x, y){ | |
this.x = x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Priority Queue | |
function PriorityQueue(){ | |
this.list = new Array() | |
this.push = function(el, priority){ | |
this.list.push([el, priority]); | |
} | |
this.pop = function(){ | |
if(this.list.length == 0) | |
return null; | |
var minPriority = this.list[0][1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class listNode{ | |
public: | |
listNode *previous; | |
listNode *next; | |
int val; | |
bool remove(){ | |
this->previous->next=this->next; | |
this->next->previous=this->previous; | |
delete this; | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Convert char to wchar_t | |
bool char2wchar_t(char *str1, wchar_t *str2){ | |
std::wstringstream st; | |
st << str1; | |
return !(st >> str2).fail(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char* intToStr(int num){ | |
char* str = (char*)malloc(12); | |
sprintf(str, "%d", num); | |
return str; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char* strmerge(char* str1, char* str2){ | |
char* str = (char*)malloc(strlen(str1) + strlen(str2) + 1); | |
strcpy(str, str1); | |
strcat(str, str2); | |
return str; | |
} |
NewerOlder