diff --git a/README.md b/README.md index 4cc4180..0f8d1e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # Trololo -### Trololo was written in C++ with SDL 1.2.12 (32 bit) -### SDL Extension Libraries: SDL_image (1.2.12) -#### Compiles with g++ 4.7.0 on Windows 7 Home Premium 64 bit (Service Pack 1) -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. +I'm building this while learning from [Lazy Foo' Productions' SDL Tutorials](http://lazyfoo.net/SDL_tutorials/). + +## About +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/). \ No newline at end of file diff --git a/commonSDL.h b/commonSDL.h index 7365117..0321ab3 100644 --- a/commonSDL.h +++ b/commonSDL.h @@ -68,14 +68,14 @@ SDL_Surface *load_image(const char *file) 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; pos.x = x; pos.y = y; - SDL_BlitSurface(source, NULL, destination, &pos); + SDL_BlitSurface(source, clip, destination, &pos); } // Removes color from an image. diff --git a/images/Originals/1-12645025581iOw.jpg b/images/Originals/1-12645025581iOw.jpg new file mode 100644 index 0000000..c25515a Binary files /dev/null and b/images/Originals/1-12645025581iOw.jpg differ diff --git a/images/Originals/200px-Trollface.svg.png b/images/Originals/200px-Trollface.svg.png new file mode 100644 index 0000000..a28f703 Binary files /dev/null and b/images/Originals/200px-Trollface.svg.png differ diff --git a/images/Originals/animals-30828_640.png b/images/Originals/animals-30828_640.png new file mode 100644 index 0000000..6024888 Binary files /dev/null and b/images/Originals/animals-30828_640.png differ diff --git a/images/Reference.txt b/images/Reference.txt new file mode 100644 index 0000000..cb4d886 --- /dev/null +++ b/images/Reference.txt @@ -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 \ No newline at end of file diff --git a/images/characters.bmp b/images/characters.bmp new file mode 100644 index 0000000..e2eb39d Binary files /dev/null and b/images/characters.bmp differ diff --git a/images/characters.psd b/images/characters.psd new file mode 100644 index 0000000..6a8b714 Binary files /dev/null and b/images/characters.psd differ diff --git a/images/stage1.bmp b/images/stage1.bmp new file mode 100644 index 0000000..231db21 Binary files /dev/null and b/images/stage1.bmp differ diff --git a/main.cpp b/main.cpp index 6ea7dd7..b651d26 100644 --- a/main.cpp +++ b/main.cpp @@ -10,18 +10,20 @@ // Screen SDL_Surface *screen = NULL; -// Images SDL_Surface *background = NULL; -SDL_Surface *troll = NULL; +SDL_Surface *characters = NULL; // Image filenames -const char *background_image = "whitehouse.bmp"; -const char *troll_image = "troll.bmp"; +const char *background_image = "stage1.bmp"; +const char *characters_image = "characters.bmp"; + +// Char +SDL_Rect clip[2]; int main(int argc, char* args[]) { - screen = StartUp(WINDOW_TITLE,678,678); + screen = StartUp(WINDOW_TITLE, 900, 675); if(screen == NULL) { @@ -32,14 +34,31 @@ int main(int argc, char* args[]) { // Load images background = load_image(background_image); - troll = load_image(troll_image); + characters = load_image(characters_image); - // Remove the background (green) of the troll - RemoveColor(troll, 0x00,0xFF,0x00); + // The troll's coordinates + 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, 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) SDL_Flip(screen);