summaryrefslogtreecommitdiff
path: root/sdl2.c
blob: bbabd51173feb201a79dddc517b927b278d98018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67


/* mention the SDL2 documentation at http://wiki.libsdl.org/APIByCategory */

/* WARNING this seems to be not working on Wayland! */


#include <SDL2/SDL.h>
#include <stdbool.h>

#include "net.h"
#include "data.h"


void gui_run(void) {

	bool quit = false;
	SDL_Event event;
	SDL_Window* window;

	// init SDL2 and create window
	SDL_Init(SDL_INIT_VIDEO);
	window = SDL_CreateWindow("LimoX",
	    SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480,
	    0
	);

	// handle failed window creation
	if (window == NULL) {
		fprintf(stderr, "Failed to create SDL2 window!\n");
		return;
	} else {
		while (!quit) {
			SDL_WaitEvent(&event);
			switch (event.type)
			{
				case SDL_QUIT:
					quit = true;
					break;
			}
		}
		SDL_DestroyWindow(window);
	}

	SDL_Quit();

}

void gui_connected(char* jid, char* password) {

}

void gui_disconnected(void) {

}

void gui_add_roster_item_widget(roster_item_t* item) {

}

void gui_add_chat_widget(chat_t* chat) {

}

void gui_add_message_widget(message_t* message, chat_t* chat) {

}