From 7447bb52b2ac79a83bd3bc36fb521d248246076b Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Mon, 4 Nov 2019 20:03:58 -0500 Subject: [PATCH] initial commit --- blah | Bin 0 -> 13336 bytes main.cpp | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100755 blah create mode 100644 main.cpp diff --git a/blah b/blah new file mode 100755 index 0000000000000000000000000000000000000000..feb0d84174964a81ecdf2674ff0f4d56f260131d GIT binary patch literal 13336 zcmeHOeQZZ0ZR>vkY znU%9USQ#Lt@RNB7QawlXx-d=DF63-LOW;>$)qy&z%rivq&|#=SPt-!BSl@V(MOLRz zI(3#PV-g2Y58KM-a~9|(JtOFlXvaZ8Ne@}nnpD6!d#3cmQiu#KAg^@o572Rb^ zBjL@pHA^Fb%1Ahx?5*srtF5f9aVKK#WxU^LA7xjqZs#?TA0^h3=%;{kOBr^#7HTV^3kE2NYcNLNUVG&#|VrOX){9F+`r;Ffmu;XHL*+FR&NQ@_y zA5(A=V4u=Z&~Fs zcNIPbRZLYoyJJx`q50#QsxtMVt?JrfXE>n+;|&piA`wh5wYjZD4Fux?Zfj|X#G=7A z|K>fzGJ~=YU^2 zwx}IlThx$09AO>UVAc~4N3{@?qNH$Lw?7Zg?`<-UU3S>*bp` z#km*fEJ}04_?rZP5amUZ0XMd7kpVZp->M9_ael8e;8+JG*?`l#2+I@$4jss*Rs%jQ zi^BWffP(|FX_EmrPPAPHT)cw0PLBbncMcZx8t@re>x}goaO3>6&w$@zkXQOYwkrdr zmA6Su*^|~vN2Y?emHxNvCv>5)6?a0>Sj9rPI?H9qA>W0Cnc*==6?2itTa-+U zRe#c)dT*nW`cUaVH`?0Pd@6kiW-{f}aha1-I1i5e=RI_)QxaP*S7H@sS4= z%Sq+Eo7(KGwW(yySsdRb$aQDN-e4VfLFgL!4w$3xJ>)awxdl+>@$`vGO3q+$`EO3Hh^I(^DJTJQ5H zC%sqMvFbQuBOAdHd(zJ5(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1QSLGS>EHx&+HQZbxI1oB|BD2OO0Xb20MF{DXVAv7v`a{`H&+U1W1Fi1-8F!~6+ z&;42`(#aS%#3PMz9b=A08ZWKkCi8=yz%6=&ln6}XK}yV>*xs%AHv`q;I_;ty#5D!u zJI+f<2vTalK?~FrEmA-pA=n#@{f0b z7*yl$4tGEsVj7wU1Y@(@5Sqo@@XU5&tl0mX@Vf?H1=;r?eXmozFs&D<9+WkvuKT}~LzyO=Q02>VX@@TJ4kBXG6BkMwEXtd#2Iv`*GJ-3H~6 zZiFAMQAwZHCuc+uT8$7E=CbvW{1zz3H81hBj&X^FbCu9Hw_m^vzdO;Vq)+P|S?E(g zseW_+cMJV`VUX7C>xDk8^HCpdnf0Fm4E-v)o89L~3qjhy01=+d_df-wQJ>aX!&DI# z8WP3E5q%cQa`eS|Y*=h8kQp*z=6__;r+EHRq5mch4nv}P3HmW)jP=vL&SA09L;D*f zZ|?ukgg)Ir`kqS*{XtR`)ZG4Gn)E6Do#NtY{E-=R{l`rDw65Ie&^4}-qM+vbPXmsk zSvS#oQv4r)S>DXQ54ui+KCM&jUr_(Apo{*e`e{Ar`hxlwKo`d@>C?KG{*Pf8jYFdG zP3@;~Z~)4T_0#(JdO26iJ}){q{``=gOD6s7I$F{-irs(Gzi!f}_0^!zr*`Vr#_K2k zCS=eS^`E|Hha_Es>d`s9uark>gU)0BtBfGzNnZpRXG>8Q6VVxvr@DE8xcHXnnQ0^_ ra1+bz(6eLIKP%~6pP0vRI4p%9^@rv~d_D`+zkZRff7N8%T>pOnY}cgV literal 0 HcmV?d00001 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..e19498c --- /dev/null +++ b/main.cpp @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main( int argc, const char* argv[] ) +{ + SDL_Window * win; + SDL_Surface *image; + Uint32 rmask, gmask, bmask, amask; + const char name[] = "BLAH"; + if (SDL_Init(SDL_INIT_EVERYTHING) != 0) + { + SDL_Log("Unable to initialize SDL: %s", SDL_GetError()); + return 1; + } + + win = SDL_CreateWindow(name, 0, 0, 500, 300, SDL_WINDOW_RESIZABLE); + if (win == NULL) { + // In the case that the window could not be made... + printf("Could not create window: %s\n", SDL_GetError()); + return 1; + } + + image = SDL_GetWindowSurface(win); + printf("Pixel Width: %d, Pixel Heigth: %d\n", image->w, image->h); + // image = SDL_ConvertSurfaceFormat(image, SDL_PIXELFORMAT_RGB444, 0); + //Update the surface + Uint32 *pixels = (Uint32 *)image->pixels; + SDL_UpdateWindowSurface( win ); + + bool run = true; + while (run) { + clock_t start_t, end_t; + SDL_Event event; + while (SDL_PollEvent(&event)) { + /* handle your event here */ + if(event.type == SDL_MOUSEBUTTONDOWN) + { + if(event.button.button == SDL_BUTTON_MIDDLE) // scroll up + { + run = false; + } + else if(event.button.button == SDL_BUTTON_LEFT) // scroll up + { + //Update the surface + SDL_LockSurface(image); + for (size_t i = 0; i < (500*300); i++) { + pixels[i] += 0xFF; + } + SDL_UnlockSurface(image); + start_t = clock(); + SDL_UpdateWindowSurface(win); + end_t = clock(); + printf("Time to draw a frame %f \n", ((double)(end_t - start_t)/(double)(CLOCKS_PER_SEC))); + } + } + else if (event.type == SDL_QUIT) + { + run = false; + } + + } + /* do some other stuff here -- draw your app, etc. */ + } + SDL_FreeSurface(image); + SDL_DestroyWindow(win); + return 0; +} +//g++ main.cpp -o blah `sdl2-config --cflags --libs`