you need to install ttf, kinda pissed but alright, and theres a .sh file so you can actually run the .so files
This commit is contained in:
26
main.c
26
main.c
@@ -6,6 +6,7 @@
|
||||
#include <mydebug.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
SDL_Window* window;
|
||||
SDL_Renderer* renderer;
|
||||
@@ -18,10 +19,12 @@ int running;
|
||||
int selected_index = START_GAME;
|
||||
|
||||
int main(void) {
|
||||
int ret = 0;
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
window = SDL_CreateWindow("Shit Game",\
|
||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, DEF_WINDOW_WIDTH,
|
||||
DEF_WINDOW_HEIGHT, 0);
|
||||
TTF_Init();
|
||||
window = SDL_CreateWindow("Shufflers", SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED, DEF_WINDOW_WIDTH,DEF_WINDOW_HEIGHT, 0);
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
IMG_Init(IMG_INIT_PNG);
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
@@ -29,21 +32,30 @@ DEF_WINDOW_HEIGHT, 0);
|
||||
SDL_CaptureMouse(SDL_TRUE);
|
||||
|
||||
SDL_Texture* background = IMG_LoadTexture(renderer, "assets/mainscreen.png");
|
||||
//remove from here
|
||||
SDL_Texture* start_img = IMG_LoadTexture(renderer, "assets/mainscreen_start.png");
|
||||
SDL_Texture* exit_img = IMG_LoadTexture(renderer, "assets/mainscreen_exit.png");
|
||||
SDL_Texture* selection_img = start_img;
|
||||
|
||||
if (!background || !start_img || !exit_img) {
|
||||
//keep this tho
|
||||
if (!background || !start_img || !exit_img ) {
|
||||
printf("IMG_LoadTexture error: %s\n", IMG_GetError());
|
||||
}
|
||||
int ret = 0;
|
||||
|
||||
ret = SDL_SetTextureColorMod(start_img, 255, 0, 0);
|
||||
ret |= SDL_SetTextureColorMod(exit_img, 255, 0, 0);
|
||||
|
||||
if(ret){
|
||||
puts("SetTextureColorMod error");
|
||||
}
|
||||
|
||||
//end remove
|
||||
|
||||
TTF_Font* sans = TTF_OpenFont("Sans.ttf", 24);
|
||||
SDL_Color white = {255, 255, 255, 0};
|
||||
SDL_Surface* start_surface = TTF_RenderText_Solid(sans, "START", white);
|
||||
SDL_Texture* start_text = SDL_CreateTextureFromSurface(renderer,
|
||||
start_surface);
|
||||
|
||||
|
||||
running = 1;
|
||||
|
||||
while (running)
|
||||
|
||||
Reference in New Issue
Block a user