diff --git a/SDL2/pong/obj/Release/pong.o b/SDL2/pong/obj/Release/pong.o new file mode 100644 index 0000000..3e88e38 Binary files /dev/null and b/SDL2/pong/obj/Release/pong.o differ diff --git a/SDL2/pong/pong.cbp b/SDL2/pong/pong.cbp new file mode 100644 index 0000000..e68bcdc --- /dev/null +++ b/SDL2/pong/pong.cbp @@ -0,0 +1,59 @@ + + + + + + diff --git a/SDL2/pong/pong.cpp b/SDL2/pong/pong.cpp index 2a19ddb..79638ed 100644 --- a/SDL2/pong/pong.cpp +++ b/SDL2/pong/pong.cpp @@ -1,6 +1,5 @@ #include "../../jade.h" #include "../sdl2.inc" -#include MAIN diff --git a/SDL2/pong/pong.layout b/SDL2/pong/pong.layout new file mode 100644 index 0000000..27f89c8 --- /dev/null +++ b/SDL2/pong/pong.layout @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/SDL2/pong/sdl2.inc b/SDL2/pong/sdl2.inc new file mode 100644 index 0000000..5f2ba0a --- /dev/null +++ b/SDL2/pong/sdl2.inc @@ -0,0 +1,33 @@ +#ifdef _WIN32 + #include "SDL2\SDL.h" + #include "SDL2\SDL_image.h" + #include "SDL2\SDL_mixer.h" + #include "SDL2\SDL_ttf.h" +#else + #include + #include + #include + #include +#endif + +typedef SDL_Window* PWINDOW; +typedef SDL_Surface* PSURFACE; +typedef SDL_Renderer* PRENDERER; +typedef SDL_Event EVENT; +typedef SDL_Rect RECT; + +#define SetRenderDrawColor SDL_SetRenderDrawColor +#define RenderClear SDL_RenderClear +#define RenderDrawRect SDL_RenderDrawRect +#define RenderFillRect SDL_RenderFillRect +#define RenderDrawLine SDL_RenderDrawLine +#define RenderPresent SDL_RenderPresent +#define Delay SDL_Delay +#define Quit SDL_Quit +#define CreateWindow SDL_CreateWindow +#define CreateRenderer SDL_CreateRenderer +#define PollEvent SDL_PollEvent +#define KEYDOWN SDL_KEYDOWN +#define KEYUP SDL_KEYUP +#define Init SDL_Init +#define Rect SDL_Rect diff --git a/SDL2/pong/simplewindow.cpp b/SDL2/pong/simplewindow.cpp new file mode 100644 index 0000000..6d31263 --- /dev/null +++ b/SDL2/pong/simplewindow.cpp @@ -0,0 +1,57 @@ +#include "../jade.h" +#include "sdl2.inc" + +// SCREEN DIMENSIONS +CONSTANT INT SCREEN_WIDTH = 640; +CONSTANT INT SCREEN_HEIGHT = 480; + +MAIN + DIM AS PWINDOW window = NULL; + DIM AS PSURFACE screenSurface = NULL; + DIM AS BOOL quit = false; + DIM AS SDL_Event e; + + IF ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) THEN + PRINT( SDL_GetError() ); + ELSE + //Create Window + window = SDL_CreateWindow( "SDL Simple Window", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + SCREEN_WIDTH, + SCREEN_HEIGHT, + SDL_WINDOW_SHOWN); + + IF ( window == NULL ) THEN + PRINT( SDL_GetError() ); + ELSE + // Get Window Surface + screenSurface = SDL_GetWindowSurface( window ); + + + WHILE (NOT quit) BEGIN + WHILE ( SDL_PollEvent( ADDR e) != 0 ) BEGIN + SELECT (e.type) BEGIN + CASE SDL_QUIT: + quit = true; + ENDCASE + ENDSELECT + WEND + // Fill the surface with White + SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 255, 255, 255 ) ); + // Update the Surface + SDL_UpdateWindowSurface( window ); + + WEND + ENDIF + ENDIF + + //Destroy Window + SDL_DestroyWindow( window ); + + // Shutdown SDL + SDL_Quit(); + + RETURN 0; + +END \ No newline at end of file diff --git a/SDL2/sdl2.inc b/SDL2/sdl2.inc index 271a71b..939ac30 100644 --- a/SDL2/sdl2.inc +++ b/SDL2/sdl2.inc @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include "SDL2/SDL.h" +#include "SDL2/SDL_image.h" +#include "SDL2/SDL_mixer.h" +#include "SDL2/SDL_ttf.h" typedef SDL_Window* PWINDOW; typedef SDL_Surface* PSURFACE; diff --git a/SFML2/ReadMe.txt b/SFML2/ReadMe.txt new file mode 100644 index 0000000..3941048 --- /dev/null +++ b/SFML2/ReadMe.txt @@ -0,0 +1,14 @@ +-------------- Clean: Release in SFML2 (compiler: GNU GCC Compiler)--------------- + +Cleaned "SFML2 - Release" + +-------------- Build: Release in SFML2 (compiler: GNU GCC Compiler)--------------- + +mingw32-g++.exe -std=c++11 -Wall -O2 -std=c++11 -Wall -ID:\CodeBlocks\SFML-2.1\include -c D:\Projects\C++\jadegrfx\SFML2\main01.cpp -o obj\Release\main01.o +mingw32-g++.exe -LD:\CodeBlocks\SFML-2.1\lib -o bin\Release\SFML2.exe obj\Release\main01.o -s D:\CodeBlocks\SFML-2.1\lib\libsfml-network.a D:\CodeBlocks\SFML-2.1\lib\libsfml-audio.a D:\CodeBlocks\SFML-2.1\lib\libsfml-graphics.a D:\CodeBlocks\SFML-2.1\lib\libsfml-window.a D:\CodeBlocks\SFML-2.1\lib\libsfml-system.a D:\CodeBlocks\SFML-2.1\lib\libsfml-main.a -mwindows +Output size is 509.00 KB +Process terminated with status 0 (0 minutes, 5 seconds) +0 errors, 0 warnings (0 minutes, 5 seconds) + +I use UPX to compress it down to 141 KB +upx -9 SFML2.exe \ No newline at end of file diff --git a/SFML2/data/ahronbd.ttf b/SFML2/data/ahronbd.ttf new file mode 100644 index 0000000..a0bd191 Binary files /dev/null and b/SFML2/data/ahronbd.ttf differ diff --git a/SFML2/main01.cpp b/SFML2/main01.cpp new file mode 100644 index 0000000..b6a8262 --- /dev/null +++ b/SFML2/main01.cpp @@ -0,0 +1,27 @@ +#include "sfml2.inc" + +MAIN + RenderWindow window(VideoMode(200, 200), "JADE SFML2!"); + CircleShape shape(100.f); + shape.setFillColor(Color::Green); + Font font; + IF (!font.loadFromFile("data/ahronbd.ttf")) THEN + RETURN EXIT_FAILURE; + ENDIF + Text text("JADE", font); + text.setColor(Color(0, 100, 0, 200)); + text.setPosition(68.f, 77.f); + WHILE (window.isOpen()) BEGIN + Event event; + WHILE (window.pollEvent(event)) BEGIN + IF (event.type == Event::Closed) THEN + window.close(); + ENDIF + WEND + window.clear(); + window.draw(shape); + window.draw(text); + window.display(); + WEND + RETURN EXIT_SUCCESS; +END diff --git a/SFML2/sfml2.inc b/SFML2/sfml2.inc new file mode 100644 index 0000000..77e28e0 --- /dev/null +++ b/SFML2/sfml2.inc @@ -0,0 +1,4 @@ +#include +#include "../jade.h" + +using namespace sf;