gKit2 light
Loading...
Searching...
No Matches
window.h
Go to the documentation of this file.
1
2#ifndef _WINDOW_H
3#define _WINDOW_H
4
5#include <string>
6#include <vector>
7
8#include <SDL2/SDL.h>
9
10
13
16
17typedef SDL_Window *Window;
18
20void window_msaa( const int samples );
22void window_srgb( const bool flag );
23
25Window create_window( const int width, const int height, const int major= 3, const int minor= 2 );
27void release_window( Window w );
28
29typedef SDL_GLContext Context;
30
32Context create_context( Window window );
34void release_context( Context context );
35
37int window_width( );
39int window_height( );
41int window_msaa( );
43bool window_srgb( );
44
46int key_state( const SDL_Keycode key );
48void clear_key_state( const SDL_Keycode key );
49
51SDL_KeyboardEvent key_event( );
53void clear_key_event( );
54
56SDL_MouseButtonEvent button_event( );
58void clear_button_event( );
59
61SDL_MouseWheelEvent wheel_event( );
63void clear_wheel_event( );
64
66SDL_TextInputEvent text_event( );
68void clear_text_event( );
69
71float global_time( );
73float delta_time( );
74
76int run( Window window, int (*draw)( void ) );
77
78int last_event_count( );
79
81int events( Window window );
82
84const char *smart_path( const char* filename );
85
87const char *drop_event( );
89void clear_drop_event( );
91const std::vector<std::string>& drop_events( );
93void clear_drop_events( );
94
96#endif
const char * smart_path(const char *filename)
renvoie le chemin(path) vers le fichier 'filename' apres l'avoir cherche dans un repertoire standard....
Definition window.cpp:448
bool window_srgb()
renvoie le mode srgb de la fenetre de l'application.
Definition window.cpp:43
SDL_MouseButtonEvent button_event()
renvoie le dernier evenement. etat des boutons de la souris.
Definition window.cpp:113
Context create_context(Window window)
cree et configure un contexte opengl.
Definition window.cpp:358
void clear_button_event()
desactive l'evenement.
Definition window.cpp:117
void clear_drop_events()
desactive drag/drop.
Definition window.cpp:106
int events(Window window)
fonction interne de gestion d'evenements.
Definition window.cpp:181
const std::vector< std::string > & drop_events()
drag/drop. recupere tous les fichiers.
Definition window.cpp:88
int window_height()
renvoie la hauteur de la fenetre de l'application.
Definition window.cpp:27
SDL_TextInputEvent text_event()
renvoie le dernier evenement. saisie de texte.
Definition window.cpp:78
void release_window(Window w)
destruction de la fenetre.
Definition window.cpp:328
int run(Window window, int(*draw)(void))
fonction principale. gestion des evenements et appel de la fonction draw de l'application.
Definition window.cpp:158
void clear_key_event()
desactive l'evenement.
Definition window.cpp:71
SDL_KeyboardEvent key_event()
renvoie le dernier evenement. touche speciales.
Definition window.cpp:67
void clear_key_state(const SDL_Keycode key)
desactive une touche du clavier.
Definition window.cpp:59
const char * drop_event()
drag/drop, renvoie le dernier fichier.
Definition window.cpp:93
void clear_drop_event()
desactive drag/drop.
Definition window.cpp:101
void clear_text_event()
desactive l'evenement.
Definition window.cpp:82
Window create_window(const int width, const int height, const int major=3, const int minor=2)
creation d'une fenetre pour l'application.
Definition window.cpp:262
void release_context(Context context)
detruit le contexte openGL.
Definition window.cpp:439
void clear_wheel_event()
desactive l'evenement.
Definition window.cpp:127
int key_state(const SDL_Keycode key)
renvoie l'etat d'une touche du clavier. cf la doc SDL2 pour les codes.
Definition window.cpp:53
int window_msaa()
renvoie le nombre de samples MSAA.
Definition window.cpp:33
SDL_MouseWheelEvent wheel_event()
renvoie le dernier evenement. etat de la molette de la souris / glisser sur le pad.
Definition window.cpp:123
int window_width()
renvoie la largeur de la fenetre de l'application.
Definition window.cpp:23
float delta_time()
renvoie le temps ecoule depuis la derniere frame, en millisecondes.
Definition window.cpp:148
float global_time()
renvoie le temps ecoule depuis le lancement de l'application, en millisecondes.
Definition window.cpp:139