This file contains hidden or 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
| // resource.h | |
| // | |
| #ifndef _RESOURCE_H | |
| #define _RESOURCE_H | |
| template <typename T> | |
| class Resource | |
| { | |
| protected: | |
| T* data; |
This file contains hidden or 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
| // Zach J. Elko | |
| // 2010 | |
| // skater.cpp | |
| // | |
| // I've wanted to make one of these for a while now. I got bored and | |
| // whipped this up in about 3 hours. There are a lot of improvements | |
| // that can/should be made, but it's not bad for the short amount of | |
| // time put into it. | |
| // | |
| // Basic C/C++ code obfuscator. |
This file contains hidden or 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
| # If we need to rotate our player (character is a ball, etc...) | |
| if (self.rotate == True and moveX != 0): | |
| if (moveX < 0): self.image = pygame.transform.rotate(self.image, -90) | |
| else: self.image = pygame.transform.rotate(self.image, 90) |
This file contains hidden or 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
| def render(self, screen): | |
| screen.blit(self.image, (self.rect.x, self.rect.y)) | |
| if (self.drops > 0): | |
| x = self.rect.x + 2 | |
| rainColor = () | |
| if (self.full): | |
| level = 1 | |
| rainColor = (255,0,0) | |
| else: |
This file contains hidden or 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
| # Find the shortest beaker so we know which drops to check for collisions | |
| # against | |
| beakerHeights = [] | |
| shortest = 0 | |
| for beaker in level.beakers: beakerHeights.append(beaker.rect.y) | |
| beakerHeights.sort() | |
| if (beakerHeights): shortest = beakerHeights[0] |
This file contains hidden or 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
| // CircularList.hpp | |
| // | |
| // Zach Elko | |
| // 2010 | |
| // | |
| // Simple templated data structure that allows you to toggle 'wrap-around' behavior | |
| // to achieve a circular list. | |
| // | |
| #ifndef CIRCULAR_LIST_H | |
| #define CIRCULAR_LIST_H |
This file contains hidden or 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
| //utils.h | |
| #ifndef UTILS_H | |
| #define UTILS_H | |
| #include | |
| struct Point2d | |
| { | |
| float x; |
This file contains hidden or 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
| void swap(char str[], | |
| const int firstIndex, | |
| const int secondIndex) | |
| { | |
| char temp = str[firstIndex]; | |
| str[firstIndex] = str[secondIndex]; | |
| str[secondIndex] = temp; | |
| } | |
| void reverse2(char src[]) |
This file contains hidden or 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
| void reverse(char str[]) | |
| { | |
| // Add 1 for the terminating character | |
| int len = strlen(str) + 1; | |
| char temp[len]; | |
| // Data resides from indices 0-2 | |
| int i = len - 2; | |
| for (; i >= 0; --i) | |
| { |
This file contains hidden or 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 Foo | |
| { | |
| public: | |
| Foo() { std::cout << "ctor\n"; } | |
| ~Foo() { std::cout << "dtor\n"; } | |
| }; | |
| int main() | |
| { | |
| std::vector<Foo> foos; | |
| { |