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:
13
SDL2_ttf/build/SDL2_ttf.pc
Normal file
13
SDL2_ttf/build/SDL2_ttf.pc
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
prefix=/usr/local
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: SDL2_ttf
|
||||||
|
Description: ttf library for Simple DirectMedia Layer with FreeType 2 support
|
||||||
|
Version: 2.24.0
|
||||||
|
Requires: sdl2 >= 2.0.10
|
||||||
|
Libs: -L${libdir} -lSDL2_ttf
|
||||||
|
Cflags: -I${includedir}/SDL2
|
||||||
|
Requires.private: freetype2
|
||||||
|
Libs.private:
|
||||||
BIN
assets/exit_text.png
Normal file
BIN
assets/exit_text.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/host_text.png
Normal file
BIN
assets/host_text.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
1
export.sh
Executable file
1
export.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
|
||||||
2343
include/SDL_ttf.h
Normal file
2343
include/SDL_ttf.h
Normal file
File diff suppressed because it is too large
Load Diff
22
main.c
22
main.c
@@ -6,6 +6,7 @@
|
|||||||
#include <mydebug.h>
|
#include <mydebug.h>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_image.h>
|
#include <SDL2/SDL_image.h>
|
||||||
|
#include <SDL_ttf.h>
|
||||||
|
|
||||||
SDL_Window* window;
|
SDL_Window* window;
|
||||||
SDL_Renderer* renderer;
|
SDL_Renderer* renderer;
|
||||||
@@ -18,10 +19,12 @@ int running;
|
|||||||
int selected_index = START_GAME;
|
int selected_index = START_GAME;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
window = SDL_CreateWindow("Shit Game",\
|
TTF_Init();
|
||||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, DEF_WINDOW_WIDTH,
|
window = SDL_CreateWindow("Shufflers", SDL_WINDOWPOS_UNDEFINED,
|
||||||
DEF_WINDOW_HEIGHT, 0);
|
SDL_WINDOWPOS_UNDEFINED, DEF_WINDOW_WIDTH,DEF_WINDOW_HEIGHT, 0);
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||||
IMG_Init(IMG_INIT_PNG);
|
IMG_Init(IMG_INIT_PNG);
|
||||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||||
@@ -29,20 +32,29 @@ DEF_WINDOW_HEIGHT, 0);
|
|||||||
SDL_CaptureMouse(SDL_TRUE);
|
SDL_CaptureMouse(SDL_TRUE);
|
||||||
|
|
||||||
SDL_Texture* background = IMG_LoadTexture(renderer, "assets/mainscreen.png");
|
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* start_img = IMG_LoadTexture(renderer, "assets/mainscreen_start.png");
|
||||||
SDL_Texture* exit_img = IMG_LoadTexture(renderer, "assets/mainscreen_exit.png");
|
SDL_Texture* exit_img = IMG_LoadTexture(renderer, "assets/mainscreen_exit.png");
|
||||||
SDL_Texture* selection_img = start_img;
|
SDL_Texture* selection_img = start_img;
|
||||||
|
//keep this tho
|
||||||
if (!background || !start_img || !exit_img ) {
|
if (!background || !start_img || !exit_img ) {
|
||||||
printf("IMG_LoadTexture error: %s\n", IMG_GetError());
|
printf("IMG_LoadTexture error: %s\n", IMG_GetError());
|
||||||
}
|
}
|
||||||
int ret = 0;
|
|
||||||
ret = SDL_SetTextureColorMod(start_img, 255, 0, 0);
|
ret = SDL_SetTextureColorMod(start_img, 255, 0, 0);
|
||||||
ret |= SDL_SetTextureColorMod(exit_img, 255, 0, 0);
|
ret |= SDL_SetTextureColorMod(exit_img, 255, 0, 0);
|
||||||
|
|
||||||
if(ret){
|
if(ret){
|
||||||
puts("SetTextureColorMod error");
|
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;
|
running = 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user