mirror of
https://github.com/krislamo/Trololo
synced 2024-12-16 02:30:36 +00:00
Added blue codfish, removed white house background
This commit is contained in:
parent
012576f9b4
commit
70d2d541bb
17
README.md
17
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/).
|
@ -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.
|
||||
|
BIN
images/Originals/1-12645025581iOw.jpg
Normal file
BIN
images/Originals/1-12645025581iOw.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 KiB |
BIN
images/Originals/200px-Trollface.svg.png
Normal file
BIN
images/Originals/200px-Trollface.svg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
images/Originals/animals-30828_640.png
Normal file
BIN
images/Originals/animals-30828_640.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
3
images/Reference.txt
Normal file
3
images/Reference.txt
Normal 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
BIN
images/characters.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 203 KiB |
BIN
images/characters.psd
Normal file
BIN
images/characters.psd
Normal file
Binary file not shown.
BIN
images/stage1.bmp
Normal file
BIN
images/stage1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
39
main.cpp
39
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);
|
||||
|
Loading…
Reference in New Issue
Block a user