19 #ifndef VSGL2_H_INCLUDED
20 #define VSGL2_H_INCLUDED
43 #include <SDL2/SDL_net.h>
44 #include <SDL2/SDL_image.h>
45 #include <SDL2/SDL_mixer.h>
46 #include <SDL2/SDL_ttf.h>
61 Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
93 void set_window(
int w,
int h,
string title,
int fullscreen = 0);
199 void draw_image(
string image,
int x,
int y,
int w,
int h, uint8_t alpha = 255);
267 string read_text(
string font,
int dim,
int x,
int y,
Color c, uint8_t max_length = 0);
328 void draw_text(
string font,
int dim,
string text,
int x,
int y,
Color c);
340 int text_width(
string font,
int dim,
string text);
352 int text_height(
string font,
int dim,
string text);
371 void delay(
int milliseconds);
393 using namespace vsgl2;
394 using namespace vsgl2::general;
395 using namespace vsgl2::video;
396 using namespace vsgl2::audio;
397 using namespace vsgl2::io;
398 using namespace vsgl2::ttf_fonts;
399 using namespace vsgl2::utils;
400 #endif //VSGL2_H_INCLUDED
void delay(int milliseconds)
Use this function to stop the execution for a given amount of milliseconds.
Definition: vsgl2.cpp:546
unsigned int ms_time()
Use this function to get the time from SDL initialization in milliseconds.
Definition: vsgl2.cpp:551
void draw_line(int x1, int y1, int x2, int y2, const Color &c)
Use to draw a line.
Definition: vsgl2.cpp:247
void update()
Use this function to update the screen after drawing on it Typically called at the end of the main lo...
Definition: vsgl2.cpp:179
int get_mouse_wheel_y()
Use to get the mouse wheel vertical value,.
Definition: vsgl2.cpp:412
void play_sound(string sound)
Use to play a sound (WAVE, MOD, MIDI, OGG, MP3, FLAC, and any file that you use a command to play wit...
Definition: vsgl2.cpp:318
bool mouse_left_button_pressed()
Use to check if the mouse left button is pressed.
Definition: vsgl2.cpp:417
void draw_point(int x, int y, const Color &c)
Use to draw a point at x,y coordinates.
Definition: vsgl2.cpp:206
void draw_text(string font, int dim, string text, int x, int y, Color c)
Use this function to display a text on the screen with the desired font and dimension.
Definition: vsgl2.cpp:454
string read_text(string font, int dim, int x, int y, Color c, uint8_t max_length)
Use to read text from the user, the return key stops the input.
Definition: vsgl2.cpp:340
void pause_music()
Use to pause the music that is currently playing.
Definition: vsgl2.cpp:305
int get_mouse_x()
Use to get the mouse x coordinate.
Definition: vsgl2.cpp:397
void play_music(string file)
Use to play a music in a loop (WAVE, MOD, MIDI, OGG, MP3, FLAC, and any file that you use a command t...
Definition: vsgl2.cpp:288
void draw_filled_rect(int x, int y, int w, int h, const Color &c)
Use to draw a filled rectangle, use instead draw_rect to draw an empty rectangle with colored borders...
Definition: vsgl2.cpp:231
const int FULLSCREEN
Definition: vsgl2.h:73
void set_background_color(const Color &bg)
Use this function to change the background color.
Definition: vsgl2.cpp:144
Color()
Definition: vsgl2.h:60
void wait_for_button_pressed()
Use this function to wait for any button to be pressed.
Definition: vsgl2.cpp:524
void undone()
Use this function to reset the isDone glabal variable to its initial state (false) This can be useful...
Definition: vsgl2.cpp:174
int get_mouse_y()
Use to get the mouse y coordinate.
Definition: vsgl2.cpp:402
int take_screenshot(string filename)
Use this function to take a screenshot of the window.
Definition: vsgl2.cpp:556
void init()
Use this function to initiate the library, must be called first.
Definition: vsgl2.cpp:52
SDL_Color c
Definition: vsgl2.h:59
Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: vsgl2.h:61
bool mouse_right_button_pressed()
Use to check if the mouse right button is pressed.
Definition: vsgl2.cpp:422
void draw_image(string image, int x, int y, int w, int h, uint8_t alpha)
Use to draw an image (BMP, PNG, JPG)
Definition: vsgl2.cpp:257
int get_window_height()
Use this function to get the height of the current window.
Definition: vsgl2.cpp:159
void stop_music()
Use to stop the music that is currently playing.
Definition: vsgl2.cpp:312
int text_height(string font, int dim, string text)
Use this function to retrieve the height of a string, given the font, the dimension and the text...
Definition: vsgl2.cpp:503
void draw_rect(int x, int y, int w, int h, const Color &c)
Use to draw a rectangle (only the border), use instead draw_filled_rect to draw a rectangle filled wi...
Definition: vsgl2.cpp:215
int get_mouse_wheel_x()
Use to get the mouse wheel horizontal value,.
Definition: vsgl2.cpp:407
int get_window_width()
Use this function to get the width of the current window.
Definition: vsgl2.cpp:154
Mix_Music * music
Definition: vsgl2.cpp:47
bool is_pressed(int key)
Use to check if a button is pressed.
Definition: vsgl2.cpp:334
void set_window(int w, int h, string title, int fullscreen)
Use this function to create a window with the specified dimensions and a title, optionally in full sc...
Definition: vsgl2.cpp:113
bool done()
Use this function to check when to stop the main loop.
Definition: vsgl2.cpp:168
void close()
Close and free all the resources, must be called last.
Definition: vsgl2.cpp:86
int text_width(string font, int dim, string text)
Use this function to retrieve the width of a string, given the font, the dimension and the text...
Definition: vsgl2.cpp:487