keksson_1 done
This commit is contained in:
parent
636409281a
commit
3ac8a6653f
BIN
testSDL/Lesson1/Hello
Executable file
BIN
testSDL/Lesson1/Hello
Executable file
Binary file not shown.
@ -2,6 +2,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0 )
|
if (SDL_Init(SDL_INIT_EVERYTHING) != 0 )
|
||||||
@ -21,5 +22,26 @@ int main()
|
|||||||
cout << "Renderer error\n";
|
cout << "Renderer error\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
SDL_Surface* pic = SDL_LoadBMP("./hello.bmp");
|
||||||
|
if (pic == nullptr)
|
||||||
|
{
|
||||||
|
cout << "pic load error\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, pic);
|
||||||
|
SDL_FreeSurface(pic);
|
||||||
|
if (texture == nullptr)
|
||||||
|
{
|
||||||
|
cout << "texture create error\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
SDL_RenderClear(renderer);
|
||||||
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
|
SDL_RenderPresent(renderer);
|
||||||
|
SDL_Delay(3000);
|
||||||
|
SDL_DestroyRenderer(renderer);
|
||||||
|
SDL_DestroyTexture(texture);
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
SDL_Quit;
|
||||||
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user