1
0
mirror of https://github.com/krislamo/Trololo synced 2024-11-10 00:30:35 +00:00

Added blue codfish, removed white house background

This commit is contained in:
Kris Lamoureux 2012-10-24 22:55:35 -07:00
parent 012576f9b4
commit 70d2d541bb
10 changed files with 47 additions and 16 deletions

View File

@ -1,5 +1,14 @@
# Trololo # Trololo
### Trololo was written in C++ with SDL 1.2.12 (32 bit) I'm building this while learning from [Lazy Foo' Productions' SDL Tutorials](http://lazyfoo.net/SDL_tutorials/).
### SDL Extension Libraries: SDL_image (1.2.12)
#### Compiles with g++ 4.7.0 on Windows 7 Home Premium 64 bit (Service Pack 1) ## About
Trololo was built after doing [Lazy Foo' Production's SDL tutorials](http://lazyfoo.net/SDL_tutorials/index.php). This software is released under the GNU General Public License Version 3. Please read the LICENSE file to know your rights. Trololo is written in C++ with SDL 1.2.12 (32 bit) with the SDL extension library: SDL_image (1.2.12).
## License
This software is released under the GNU General Public License Version 3. Please read the LICENSE file to know your rights before continuing.
## Support
* Windows 7 Home Premium 64 bit (Service Pack 1) (g++ 4.7.0)
## Current State
This software doesn't do much yet. Nothing is guaranteed to compile but most of the time it should. Binary links will be added in future stable updates on the [latest readme on github](https://github.com/Kris619/Trololo/).

View File

@ -68,14 +68,14 @@ SDL_Surface *load_image(const char *file)
return screen_format; return screen_format;
} }
void apply_image(int x, int y, SDL_Surface* source, SDL_Surface* destination) void apply_image(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL)
{ {
SDL_Rect pos; SDL_Rect pos;
pos.x = x; pos.x = x;
pos.y = y; pos.y = y;
SDL_BlitSurface(source, NULL, destination, &pos); SDL_BlitSurface(source, clip, destination, &pos);
} }
// Removes color from an image. // Removes color from an image.

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

3
images/Reference.txt Normal file
View File

@ -0,0 +1,3 @@
http://www.freestockphotos.biz/stockphoto/10674
http://upload.wikimedia.org/wikipedia/en/thumb/7/78/Trollface.svg/200px-Trollface.svg.png
http://www.publicdomainpictures.net/view-image.php?image=5182&picture=pool-tiles-underwater

BIN
images/characters.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

BIN
images/characters.psd Normal file

Binary file not shown.

BIN
images/stage1.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

@ -10,18 +10,20 @@
// Screen // Screen
SDL_Surface *screen = NULL; SDL_Surface *screen = NULL;
// Images
SDL_Surface *background = NULL; SDL_Surface *background = NULL;
SDL_Surface *troll = NULL; SDL_Surface *characters = NULL;
// Image filenames // Image filenames
const char *background_image = "whitehouse.bmp"; const char *background_image = "stage1.bmp";
const char *troll_image = "troll.bmp"; const char *characters_image = "characters.bmp";
// Char
SDL_Rect clip[2];
int main(int argc, char* args[]) int main(int argc, char* args[])
{ {
screen = StartUp(WINDOW_TITLE,678,678); screen = StartUp(WINDOW_TITLE, 900, 675);
if(screen == NULL) if(screen == NULL)
{ {
@ -32,14 +34,31 @@ int main(int argc, char* args[])
{ {
// Load images // Load images
background = load_image(background_image); background = load_image(background_image);
troll = load_image(troll_image); characters = load_image(characters_image);
// Remove the background (green) of the troll // The troll's coordinates
RemoveColor(troll, 0x00,0xFF,0x00); clip[0].x = 0;
clip[0].y = 0;
clip[0].w = 200;
clip[0].h = 160;
// Blit // The codfish's coordinates
clip[1].x = 0;
clip[1].y = 160;
clip[1].w = 200;
clip[1].h = 100;
// Remove the background from the characters
RemoveColor(characters, 0x00, 0xFF, 0x00); // Green
// Blit background image
apply_image(0, 0, background, screen); apply_image(0, 0, background, screen);
apply_image(0, 0, troll, screen);
// Blit troll image
apply_image(0, 0, characters, screen, &clip[0]);
// Blit codfish image
apply_image(300, 300, characters, screen, &clip[1]);
if(screen != NULL) if(screen != NULL)
SDL_Flip(screen); SDL_Flip(screen);