mirror of
https://github.com/Relintai/programming_tutorials.git
synced 2025-04-21 21:51:22 +02:00
Cleaned up the new main, also removed texture_editor from the compile scripts.
This commit is contained in:
parent
adfb3fdd2d
commit
c3fb047808
@ -23,9 +23,7 @@ g++ -Wall -g $(sdl2-config --cflags) -c image.cpp -o obj/image.o
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c texture.cpp -o obj/texture.o
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c sprite.cpp -o obj/sprite.o
|
||||
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c texture_editor.cpp -o obj/texture_editor.o
|
||||
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c main.cpp -o obj/main.o
|
||||
|
||||
g++ -o bin/program obj/math.o obj/rect2.o obj/color.o obj/string.o obj/renderer.o obj/image.o obj/texture.o obj/sprite.o obj/texture_editor.o obj/main.o $(sdl2-config --libs)
|
||||
g++ -o bin/program obj/math.o obj/rect2.o obj/color.o obj/string.o obj/renderer.o obj/image.o obj/texture.o obj/sprite.o obj/main.o $(sdl2-config --libs)
|
||||
|
||||
|
@ -23,9 +23,7 @@ g++ -Wall -g $(sdl2-config --cflags) -c image.cpp -o obj/image.o
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c texture.cpp -o obj/texture.o
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c sprite.cpp -o obj/sprite.o
|
||||
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c texture_editor.cpp -o obj/texture_editor.o
|
||||
|
||||
g++ -Wall -g $(sdl2-config --cflags) -c main.cpp -o obj/main.o
|
||||
|
||||
g++ -o bin/program obj/math.o obj/rect2.o obj/color.o obj/string.o obj/renderer.o obj/image.o obj/texture.o obj/sprite.o obj/texture_editor.o obj/main.o $(sdl2-config --libs)
|
||||
g++ -o bin/program obj/math.o obj/rect2.o obj/color.o obj/string.o obj/renderer.o obj/image.o obj/texture.o obj/sprite.o obj/main.o $(sdl2-config --libs)
|
||||
|
||||
|
@ -11,22 +11,6 @@ int main(int argv, char **args) {
|
||||
|
||||
Image i("ti.bmp");
|
||||
|
||||
i.lock();
|
||||
i.set_pixel(i.get_height() - 1, i.get_width() - 1, Color(0, 0, 255, 255));
|
||||
i.unlock();
|
||||
|
||||
/* old
|
||||
SDL_Texture *t = SDL_CreateTextureFromSurface(r.get_renderer(), i.get_surface());
|
||||
r.set_draw_color(0, 0, 0, 255);
|
||||
r.clear();
|
||||
SDL_Rect rs;
|
||||
rs.x = 0;
|
||||
rs.y = 0;
|
||||
rs.w = i.get_width();
|
||||
rs.h = i.get_height();
|
||||
SDL_RenderCopy(r.get_renderer(), t, &rs, &rs);
|
||||
*/
|
||||
|
||||
r.set_draw_color(0, 0, 0, 255);
|
||||
r.clear();
|
||||
|
||||
@ -36,40 +20,10 @@ int main(int argv, char **args) {
|
||||
s.set_x(30);
|
||||
s.set_y(30);
|
||||
|
||||
//r.draw_texture(t, Rect2(0, 0, t.get_width(), t.get_height()));
|
||||
|
||||
r.draw_sprite(s);
|
||||
|
||||
r.present();
|
||||
|
||||
int rgb[] = {
|
||||
203, 203, 203, // Gray
|
||||
254, 254, 31, // Yellow
|
||||
0, 255, 255, // Cyan
|
||||
0, 254, 30, // Green
|
||||
255, 16, 253, // Magenta
|
||||
253, 3, 2, // Red
|
||||
18, 14, 252, // Blue
|
||||
0, 0, 0 // Black
|
||||
};
|
||||
|
||||
Rect2 colorBar;
|
||||
colorBar.x = 0;
|
||||
colorBar.y = 0;
|
||||
colorBar.w = 90;
|
||||
colorBar.h = 480;
|
||||
|
||||
// Render a new color bar every 0.5 seconds
|
||||
for (int i = 0; i != sizeof rgb / sizeof *rgb; i += 3, colorBar.x += 90) {
|
||||
r.set_draw_color(rgb[i], rgb[i + 1], rgb[i + 2], 255);
|
||||
r.draw_rect(colorBar);
|
||||
r.present();
|
||||
|
||||
SDL_Delay(500);
|
||||
}
|
||||
|
||||
//old
|
||||
//SDL_DestroyTexture(t);
|
||||
SDL_Delay(500);
|
||||
|
||||
t.free();
|
||||
i.free();
|
||||
|
BIN
06_sdl_input/ti.bmp
Normal file
BIN
06_sdl_input/ti.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 792 KiB |
Loading…
Reference in New Issue
Block a user