Skip to content

Commit 148d23d

Browse files
committed
Some draw testing
1 parent d31e0f8 commit 148d23d

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

SDL2_Project.cbp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<Target title="Release">
1919
<Option output="bin/Release/SDL2_Project" prefix_auto="1" extension_auto="1" />
2020
<Option object_output="obj/Release/" />
21-
<Option type="1" />
21+
<Option type="0" />
2222
<Option compiler="gcc" />
2323
<Compiler>
2424
<Add option="-O2" />

SDL2_Project.depend

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# depslib dependency file v1.0
2-
1631804502 source:d:\codeblocks\projects\sdl2_project\main.cpp
2+
8519680
3+
4+
1631813965 source:d:\codeblocks\projects\sdl2_project\main.cpp
5+
<stdio.h>
6+
<string>
7+
<SDL.h>
8+
<conio.h>
9+
10+
1631799572 ent of cdf3683 (Added some basic keyboard input)
311
<stdio.h>
412
<string>
513
<SDL.h>
14+
<conio.h>
615

716
1628610834 d:\codeblocks\sdl2\i686-w64-mingw32\include\sdl2\sdl.h
817
"SDL_main.h"

SDL2_Project.layout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
22
<CodeBlocks_layout_file>
33
<FileVersion major="1" minor="0" />
4-
<ActiveTarget name="Debug" />
4+
<ActiveTarget name="Release" />
55
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
66
<Cursor>
7-
<Cursor1 position="31" topLine="0" />
7+
<Cursor1 position="1410" topLine="74" />
88
</Cursor>
99
</File>
1010
</CodeBlocks_layout_file>

bin/Debug/alamakota.bmp

114 Bytes
Binary file not shown.

bin/Release/alamakota.bmp

114 Bytes
Binary file not shown.

main.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdio.h>
22
#include <string>
33
#include <SDL.h>
4+
#include <conio.h>
45

56
#define WIDTH 800
67
#define HEIGHT 600
@@ -59,18 +60,24 @@ bool loadMedia() {
5960
}
6061

6162
int main(int argc, char **argv) {
62-
if(!init())
63+
if(!init()) {
64+
getch();
6365
return -1;
66+
}
6467

6568
if(!loadMedia()) {
6669
close();
70+
getch();
6771
return -2;
6872
}
6973

7074
SDL_Event e;
7175

76+
SDL_Surface *temp = SDL_CreateRGBSurface(0, 40, 40, 32, 0, 0, 0, 0);
77+
7278
bool quit = false;
7379
while(!quit) {
80+
7481
while(SDL_PollEvent(&e) != 0) {
7582
if(e.type == SDL_QUIT)
7683
quit = true;
@@ -91,6 +98,14 @@ int main(int argc, char **argv) {
9198
quit = true;
9299

93100
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 80 + colorShift, 180 - colorShift, 130 + colorShift));
101+
SDL_FillRect(temp, NULL, SDL_MapRGB(temp->format, 40 + colorShift, 80 + colorShift, 120 - colorShift));
102+
103+
if(temp) {
104+
SDL_Rect rec;
105+
rec.x = 40;
106+
rec.y = 40;
107+
SDL_BlitSurface(temp, NULL, screen, &rec);
108+
}
94109

95110
SDL_UpdateWindowSurface(window);
96111
}

0 commit comments

Comments
 (0)