Skip to content

Commit

Permalink
Code
Browse files Browse the repository at this point in the history
  • Loading branch information
antim0118 committed May 9, 2024
1 parent e83136f commit 92ec129
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
12 changes: 1 addition & 11 deletions bunnyMarkSDL2/include/LTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,22 @@ LTexture::~LTexture()
bool LTexture::loadFromFile(SDL_Renderer *renderer, const char* filename)
{
free();

// unsigned char *image = stbi_load(filename, &mWidth, &mHeight, NULL, STBI_rgb_alpha);
// if (image == NULL){
// printf("Loading image failed: %s\n", stbi_failure_reason());
// return false;
// }

//SDL_Surface *surface = SDL_CreateRGBSurfaceFrom((void *)image, mWidth, mHeight, 32, 4 * mWidth, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
SDL_Surface *surface = IMG_Load(filename);
if (surface == NULL) {
printf("Creating surface failed: %s\n", SDL_GetError());
//stbi_image_free(image);
return false;
}

mTexture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_FreeSurface(surface);
//stbi_image_free(image);
return true;
}

bool LTexture::loadFromRenderedText(SDL_Renderer *renderer, const char* textureText, TTF_Font* font, SDL_Color textColor){
free();

//TTF_RenderUTF8_Solid -- КРАШИТ ИГРУ НА ПИХЕ!
SDL_Surface* textSurface = TTF_RenderUTF8_Blended(font, textureText, textColor);//TTF_RenderText_Solid(font, textureText, textColor);
SDL_Surface* textSurface = TTF_RenderUTF8_Blended(font, textureText, textColor);
if(textSurface == NULL)
{
printf("Unable to render text surface! SDL_ttf Error: %s\n", TTF_GetError());
Expand Down
7 changes: 1 addition & 6 deletions bunnyMarkSDL2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ bool init()
return false;
}

gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED);// | SDL_RENDERER_PRESENTVSYNC);
gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");

//gScreenSurface = SDL_GetWindowSurface( gWindow );

return true;
}
Expand All @@ -110,8 +108,6 @@ bool loadAssets()
return false;
}

//texTitle.loadFromRenderedText(gRenderer, "ПИСЬКИ!", gFont, {255,255,255});

return true;
}

Expand Down Expand Up @@ -185,7 +181,6 @@ int main(int argc, char *argv[]) {

case SDL_JOYBUTTONDOWN:
if (e.jbutton.which == 0) {
printf("----------KEY-----:%i\n", e.jbutton.button);
if (e.jbutton.button == PSP_KEY_START)
quit = true;
else if(e.jbutton.button == PSP_KEY_CROSS)
Expand Down

0 comments on commit 92ec129

Please sign in to comment.