diff --git a/.gitignore b/.gitignore index a7a8883..84f9f82 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,9 @@ # Linux Binary # ################ -Trololo +mario # Windows scripts # ################### *.bat + diff --git a/README.md b/README.md index 5829bcf..14f45f7 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ -# Trololo -I'm building this while learning from [Lazy Foo' Productions' SDL Tutorials](http://lazyfoo.net/SDL_tutorials/). +# Mario +A fork of Trololo. Trololo was a project that wasn't really headed in any direction, well this is where it is headed now. Mario is a temporary name and will hopefully gain a unique name closer to its release. ## About -Trololo is written in C++ with SDL 1.2.15 (32 bit) with the SDL extension libraries: SDL_image (1.2.12) and SDL_tff (2.0.11). +Mario is written in C++ with SDL 1.2.15 (32 bit) with the SDL extension libraries: SDL_image (1.2.12) and SDL_tff (2.0.11). ## License This software is released under the GNU General Public License Version 3. Please read the LICENSE file to know your rights before continuing. ## System Support -* Windows 7 Home Premium x86_64 (Service Pack 1) (g++ 4.7.0) -* Linux 3.2 Debian 6.0 x86_64 (g++ 4.4.5) +* Windows 7 Home Premium x86_64 (Service Pack 1) (g++ 4.x) + +## Planning to Support +* Linux 3.2 x86_64 (g++ 4.x) ## 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 +This software is in an unstable state. \ No newline at end of file diff --git a/References.txt b/References.txt index 08b13e3..5d54a96 100644 --- a/References.txt +++ b/References.txt @@ -1,17 +1,8 @@ - Bibliography + Bibliography -Green Arrow up. Digital image. Symbols & Shapes - Green Arrow up - Public Domain - Clip Art. N.p., n.d. Web. 2 Jan. 2013. . +Nintendo. Dancing Mario GIF. Digital image. DeviantART. SuperLink9, n.d. Web. 2 + Mar. 2013. . -Kratochvil, Petr. Pool Tiles Underwater. Digital image. Free Stock Photo - Public - Domain Pictures. N.p., n.d. Web. 28 Oct. 2012. - . - -OCAL. Illustration Of A Blue Codfish. Digital image. Free Stock Photos. N.p., n.d. - Web. 28 Oct. 2012. . - -Trollface. Digital image. Wikipedia. N.p., n.d. Web. 28 Oct. 2012. - . +KeR-. Mario World HD. Digital image. DeviantART. KeR-, n.d. Web. 2 Mar. 2013. + . \ No newline at end of file diff --git a/SDL.dll b/SDL.dll new file mode 100644 index 0000000..69fd61e Binary files /dev/null and b/SDL.dll differ diff --git a/SDL_image.dll b/SDL_image.dll new file mode 100644 index 0000000..e891b16 Binary files /dev/null and b/SDL_image.dll differ diff --git a/bin/IMG0.bmp b/bin/IMG0.bmp new file mode 100644 index 0000000..93cd1cf Binary files /dev/null and b/bin/IMG0.bmp differ diff --git a/bin/IMG1.bmp b/bin/IMG1.bmp new file mode 100644 index 0000000..f6a0ee9 Binary files /dev/null and b/bin/IMG1.bmp differ diff --git a/bin/IMG2.bmp b/bin/IMG2.bmp new file mode 100644 index 0000000..927be92 Binary files /dev/null and b/bin/IMG2.bmp differ diff --git a/bin/IMG3.bmp b/bin/IMG3.bmp new file mode 100644 index 0000000..a0fbd31 Binary files /dev/null and b/bin/IMG3.bmp differ diff --git a/bin/IMG4.bmp b/bin/IMG4.bmp new file mode 100644 index 0000000..d1ab585 Binary files /dev/null and b/bin/IMG4.bmp differ diff --git a/bin/IMG5.bmp b/bin/IMG5.bmp new file mode 100644 index 0000000..b2df6dd Binary files /dev/null and b/bin/IMG5.bmp differ diff --git a/bin/Originals/Dancing_Mario_GIF_by_SuperLink9.gif b/bin/Originals/Dancing_Mario_GIF_by_SuperLink9.gif new file mode 100644 index 0000000..0475fd0 Binary files /dev/null and b/bin/Originals/Dancing_Mario_GIF_by_SuperLink9.gif differ diff --git a/bin/Originals/stage.jpg b/bin/Originals/stage.jpg new file mode 100644 index 0000000..b1e4f4d Binary files /dev/null and b/bin/Originals/stage.jpg differ diff --git a/bin/stage.bmp b/bin/stage.bmp new file mode 100644 index 0000000..4ba5287 Binary files /dev/null and b/bin/stage.bmp differ diff --git a/core.cpp b/core.cpp index 874afd3..a617b37 100644 --- a/core.cpp +++ b/core.cpp @@ -65,7 +65,7 @@ namespace scrns { SDL_Surface *screen = NULL; SDL_Surface *vid_init; - int init, ttf_ret; + int init;//, ttf_ret; // Initiate SDL and check init = SDL_Init(SDL_INIT_VIDEO); @@ -96,7 +96,7 @@ namespace scrns // Set window title SDL_WM_SetCaption(WINDOW_TITLE " " VERSION, 0); - + /* // Initialize SDL_ttf and check ttf_ret = TTF_Init(); if(ttf_ret == -1) @@ -104,6 +104,7 @@ namespace scrns fprintf(stderr, "True Type Font initialization failed: %s", SDL_GetError()); return NULL; } + */ SDL_FreeSurface(vid_init); @@ -111,25 +112,21 @@ namespace scrns return screen; } - SDL_Surface *MainMenu() + /*SDL_Surface *MainMenu() + { + + }*/ + + SDL_Surface *Stage1() { // Screen SDL_Surface *screen = NULL; - SDL_Surface *background = NULL; - SDL_Surface *characters = NULL; - SDL_Surface *message = NULL; - SDL_Surface *indicator = NULL; // Image filenames - const char *background_image = "bin/stage1.bmp"; - const char *characters_image = "bin/characters.bmp"; - const char *indicator_image = "bin/indicator.bmp"; - - // Char - SDL_Rect clip[2]; + const char *background_image = "bin/stage.bmp"; - screen = initiateSDL(900, 675); + screen = initiateSDL(900, 646); if(screen == NULL) { @@ -140,230 +137,109 @@ namespace scrns { // Load images background = scrnfunk::load_image(background_image); - characters = scrnfunk::load_image(characters_image); - indicator = scrnfunk::load_image(indicator_image); - - // The troll's coordinates - clip[0].x = 0; - clip[0].y = 0; - clip[0].w = 200; - clip[0].h = 160; - - // 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 - scrnfunk::RemoveColor(characters, 0x00, 0xFF, 0x00); // Green - + // Blit background image scrnfunk::apply_image(0, 0, background, screen); - - // Blit troll image - scrnfunk::apply_image(700, 40, characters, screen, &clip[0]); - - // Blit codfish image - scrnfunk::apply_image(150, 300, characters, screen, &clip[1]); - // Open font at title size. - TTF_Font *font = TTF_OpenFont("bin/CaviarDreams.ttf", 80); - - - if(!font) - { - fprintf(stderr, "TTF_OpenFont: %s\n", TTF_GetError()); - return NULL; - } - - // Setup Title text - const char* title_text = "Welcome to Trololo"; - SDL_Color whitecolor = { 255, 255, 255 }; - - // Get Title text render - if(font != 0 && title_text != 0) // 0 into the text or font causes segfaults and undefined behavior - message = TTF_RenderText_Solid(font, title_text, whitecolor); - else - fprintf(stderr, "TFF Render Text Solid Error: init error\n"); - - // Apply Title text render - if(message != 0) - scrnfunk::apply_image(100, 200, message, screen); - else - fprintf(stderr, "TFF Render Text Solid Error: apply error\n"); - - // Setup option 1 (New game) - const char* option1_text = "New game"; - SDL_Color blackcolor = { 0,0,0 }; - font = TTF_OpenFont("bin/CaviarDreams.ttf", 55); // reopen to resize - - // Apply option 1 (New game) - if(font != 0 && option1_text != 0) - message = TTF_RenderText_Solid(font, option1_text, blackcolor); - else - fprintf(stderr, "TFF Render Text Solid Error: init error\n"); - - // Apply message option 1 (New game) - if(message != 0) - scrnfunk::apply_image(620, 300, message, screen); - else - fprintf(stderr, "TFF Render Text Solid Error: apply error\n"); - - // Setup exit option (Exit) - const char* exit_text = "Exit"; - font = TTF_OpenFont("bin/CaviarDreams.ttf", 55); // reopen to resize - - // Apply exit option (Exit) - if(font != 0 && option1_text != 0) - message = TTF_RenderText_Solid(font, exit_text, blackcolor); - else - fprintf(stderr, "TFF Render Text Solid Error: init error\n"); - - // Apply exit option (Exit) - if(message != 0) - scrnfunk::apply_image(620, 370, message, screen); - else - fprintf(stderr, "TFF Render Text Solid Error: apply error\n"); - - // Remove white around the indicator image - scrnfunk::RemoveColor(indicator, 0xFF, 0xFF, 0xFF); // white - - // Apply starting point of indicator - scrnfunk::apply_image(550, 306, indicator, screen); - // Update screen with all applied images if(screen != 0) SDL_Flip(screen); else fprintf(stderr, "Couldn't update screen.\n"); - - // Free old surfaces - SDL_FreeSurface(background); - SDL_FreeSurface(characters); - SDL_FreeSurface(message); - SDL_FreeSurface(indicator); } - + + // Free old surfaces + SDL_FreeSurface(background); + SDL_FreeSurface(screen); + return screen; } - - SDL_Surface *MainMenu_survey(SDL_Surface *screen) + + SDL_Surface *Movement(SDL_Surface *screen) { - // Return values - // 1 -- User wants option 1 (start new game) - // 2 -- User wants to quit + // Movement + // D -- Mario move LEFT + // A -- Mario move RIGHT + + SDL_Surface *background = NULL; + SDL_Surface *mario0 = NULL; + //SDL_Surface *mario1 = NULL; + //SDL_Surface *mario2 = NULL; + SDL_Surface *mario3 = NULL; + //SDL_Surface *mario4 = NULL; + //SDL_Surface *mario5 = NULL; + + int x,y; + x = 125; + y = 520; + + // Image filenames + const char *background_image = "bin/stage.bmp"; + const char *mario_image0 = "bin/IMG0.bmp"; + //const char *mario_image1 = "bin/IMG1.bmp"; + //const char *mario_image2 = "bin/IMG2.bmp"; + const char *mario_image3 = "bin/IMG3.bmp"; + //const char *mario_image4 = "bin/IMG4.bmp"; + //const char *mario_image5 = "bin/IMG5.bmp"; + + background = scrnfunk::load_image(background_image); + mario0 = scrnfunk::load_image(mario_image0); + //mario1 = scrnfunk::load_image(mario_image1); + //mario2 = scrnfunk::load_image(mario_image2); + mario3 = scrnfunk::load_image(mario_image3); + //mario4 = scrnfunk::load_image(mario_image4); + //mario5 = scrnfunk::load_image(mario_image5); + + SDL_Rect clip; + + clip.x = x; + clip.y = y; + clip.w = 100; + clip.h = 100; + + scrnfunk::RemoveColor(mario0, 0x00, 0x00, 0xFF); // Blue + //scrnfunk::RemoveColor(mario1, 0x00, 0x00, 0xFF); // Blue + //scrnfunk::RemoveColor(mario2, 0x00, 0x00, 0xFF); // Blue + scrnfunk::RemoveColor(mario3, 0x00, 0x00, 0xFF); // Blue + scrnfunk::apply_image(x, y, mario0, screen); + + if(screen != 0) + SDL_Flip(screen); SDL_Event event; - int menu_option, current; - menu_option = current = 1; - - bool option_wanted = false; - - SDL_Surface *background = NULL; - SDL_Surface *indicator = NULL; - - // Image filenames - const char *background_image = "bin/stage1.bmp"; - const char *indicator_image = "bin/indicator.bmp"; - - background = scrnfunk::load_image(background_image); - indicator = scrnfunk::load_image(indicator_image); - - // Remove white around the indicator image - scrnfunk::RemoveColor(indicator, 0xFF, 0xFF, 0xFF); // white - - // Background clipping points - SDL_Rect clip[2]; - - // Cover points on the background for option 1 - clip[0].x = 550; - clip[0].y = 306; - clip[0].w = 48; - clip[0].h = 48; - - // Cover points on the background for option 2 - clip[1].x = 550; - clip[1].y = 375; - clip[1].w = 48; - clip[1].h = 48; - - while(!option_wanted) + while(1) { while(SDL_PollEvent(&event)) { - if(event.type == SDL_QUIT) return NULL; - + else if(event.type == SDL_KEYDOWN) { - - if(event.key.keysym.sym == 274) // down arrow key - { - if(menu_option < 2) // Less than the max amount of options - menu_option++; + if(event.key.keysym.sym == SDLK_d) // RIGHT + { + scrnfunk::apply_image(x, y, background, screen, &clip); // Cover current Mario + x=x+10; + clip.x = x; + scrnfunk::apply_image(x, y, mario3, screen); // Place new Mario } - - else if(event.key.keysym.sym == 273) // up arrow key + else if(event.key.keysym.sym == SDLK_a) // LEFT { - if(menu_option > 1) - menu_option--; + scrnfunk::apply_image(x, y, background, screen, &clip); // Cover current Mario + x=x-10; + clip.x = x; + scrnfunk::apply_image(x, y, mario3, screen); // Place new Mario } - - else if(event.key.keysym.sym == 13) // enter key - option_wanted = true; - } - - - - if(menu_option != current) - { - current = menu_option; - - switch(menu_option) - { - case 1: - scrnfunk::apply_image(550, 306, indicator, screen); // Indicator on option 1 - scrnfunk::apply_image(550, 375, background, screen, &clip[1]); // Cover option 2 - break; - case 2: - scrnfunk::apply_image(550, 375, indicator, screen); // Indicator on option 2 - scrnfunk::apply_image(550, 306, background, screen, &clip[0]); // Cover option 1 - break; - default: - cout << "Error: MainMenu_survey didn't update correctly." << endl; - break; - } - - - if(screen != 0) - SDL_Flip(screen); - else - fprintf(stderr, "Couldn't update screen.\n"); } } - } - - - switch(menu_option) - { - case 1: - // User wants to start a new game - cout << "Starting new game..." << endl; - break; - case 2: - // User wants to exit the game - cout << "Exiting..." << endl; - break; - default: - cout << "Fatal Error: Main Menu option given was unknown." << endl; + if(screen != 0) + SDL_Flip(screen); + else + fprintf(stderr, "Couldn't update screen.\n"); } - + return screen; } - - } diff --git a/main.cpp b/main.cpp index cfe0690..a6ee396 100644 --- a/main.cpp +++ b/main.cpp @@ -7,10 +7,10 @@ int main(int argc, char* args[]) SDL_Surface *screen; // Display main menu - screen = scrns::MainMenu(); + screen = scrns::Stage1(); // Main menu keyboard surveying - screen = scrns::MainMenu_survey(screen); + screen = scrns::Movement(screen); SDL_FreeSurface(screen); return 0; diff --git a/main.h b/main.h index c673001..ec88456 100644 --- a/main.h +++ b/main.h @@ -4,7 +4,7 @@ // SDL dependencies #include "SDL/SDL.h" // SDL 1.2.15 (32 bit) #include "SDL/SDL_image.h" // SDL_image (1.2.12) -#include "SDL/SDL_ttf.h" // SDL_tff (2.0.11) +//#include "SDL/SDL_ttf.h" // SDL_tff (2.0.11) // Standard dependencies #include @@ -13,8 +13,8 @@ namespace scrns { SDL_Surface * initiateSDL(int x, int y); - SDL_Surface * MainMenu(); - SDL_Surface * MainMenu_survey(SDL_Surface *screen); + SDL_Surface * Stage1(); + SDL_Surface * Movement(SDL_Surface *screen); } namespace scrnfunk @@ -25,6 +25,6 @@ namespace scrnfunk } #define VERSION "0.1-alpha" -#define WINDOW_TITLE "Trololo" +#define WINDOW_TITLE "Mario" #endif diff --git a/makefile b/makefile index 28920c8..e960150 100644 --- a/makefile +++ b/makefile @@ -7,4 +7,4 @@ else endif all: - g++ -Wall main.cpp core.cpp main.h -o Trololo ${INCLUDES} ${SDL_LIBS} + g++ -Wall main.cpp core.cpp main.h -o mario ${INCLUDES} ${SDL_LIBS} diff --git a/zlib1.dll b/zlib1.dll new file mode 100644 index 0000000..0eeaa29 Binary files /dev/null and b/zlib1.dll differ