commit
e5f4c0d906
BIN
SDL2/pong/obj/Release/pong.o
Normal file
BIN
SDL2/pong/obj/Release/pong.o
Normal file
Binary file not shown.
59
SDL2/pong/pong.cbp
Normal file
59
SDL2/pong/pong.cbp
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="pong" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/pong" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/pong" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add directory="D:/CodeBlocks/SDL2-2.0.1/i686-w64-mingw32/include" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="mingw32" />
|
||||
<Add library="SDL2_net" />
|
||||
<Add library="SDL2_ttf" />
|
||||
<Add library="SDL2_mixer" />
|
||||
<Add library="SDL2_image" />
|
||||
<Add library="SDL2main" />
|
||||
<Add library="SDL2.dll" />
|
||||
<Add library="SDL2" />
|
||||
<Add library="user32" />
|
||||
<Add library="gdi32" />
|
||||
<Add library="winmm" />
|
||||
<Add library="dxguid" />
|
||||
<Add directory="D:/CodeBlocks/SDL2-2.0.1/i686-w64-mingw32/lib" />
|
||||
</Linker>
|
||||
<Unit filename="pong.cpp" />
|
||||
<Unit filename="sdl2.inc" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
@ -1,6 +1,5 @@
|
||||
#include "../../jade.h"
|
||||
#include "../sdl2.inc"
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
MAIN
|
||||
|
14
SDL2/pong/pong.layout
Normal file
14
SDL2/pong/pong.layout
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<ActiveTarget name="Release" />
|
||||
<File name="sdl2.inc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="pong.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="47" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
33
SDL2/pong/sdl2.inc
Normal file
33
SDL2/pong/sdl2.inc
Normal file
@ -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 <SDL.h>
|
||||
#include <SDL_image.h>
|
||||
#include <SDL_mixer.h>
|
||||
#include <SDL_ttf.h>
|
||||
#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
|
57
SDL2/pong/simplewindow.cpp
Normal file
57
SDL2/pong/simplewindow.cpp
Normal file
@ -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
|
@ -1,7 +1,7 @@
|
||||
#include <SDL.h>
|
||||
#include <SDL_image.h>
|
||||
#include <SDL_mixer.h>
|
||||
#include <SDL_ttf.h>
|
||||
#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;
|
||||
|
14
SFML2/ReadMe.txt
Normal file
14
SFML2/ReadMe.txt
Normal file
@ -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
|
BIN
SFML2/data/ahronbd.ttf
Normal file
BIN
SFML2/data/ahronbd.ttf
Normal file
Binary file not shown.
27
SFML2/main01.cpp
Normal file
27
SFML2/main01.cpp
Normal file
@ -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
|
4
SFML2/sfml2.inc
Normal file
4
SFML2/sfml2.inc
Normal file
@ -0,0 +1,4 @@
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "../jade.h"
|
||||
|
||||
using namespace sf;
|
Loading…
Reference in New Issue
Block a user