The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions | Variables
sdl2.cpp File Reference

Tool to test SDL 2 functions. More...

#include "tools/sdl2/sdl2.hpp"
#include "sdl/texture.hpp"
#include "sdl/window.hpp"
#include "tools/sdl2/window.hpp"
#include "text.hpp"
#include <SDL.h>
#include <iostream>
#include <deque>
#include <boost/range/adaptor/reversed.hpp>
Include dependency graph for sdl2.cpp:

Go to the source code of this file.

Classes

struct  texit
 This exception when throw should terminate the application. More...
 
struct  tsdl
 
struct  ttext_input
 

Functions

static void draw_text (sdl::twindow &window, const std::string &string, const int x, const int y)
 
static void draw_command_line (sdl::twindow &window, const std::string &command)
 
static void draw_command_history (sdl::twindow &window, const std::deque< std::string > &history)
 
static bool execute_command (std::string &command_line)
 
std::string get_token (const std::string &string, std::string::const_iterator &begin, const char separator)
 Gets a token from a string. More...
 
int main ()
 

Variables

std::vector< sdl::twindow * > windows
 Contains the windows created by the user. More...
 

Detailed Description

Tool to test SDL 2 functions.

Definition in file sdl2.cpp.

Function Documentation

static void draw_command_history ( sdl::twindow window,
const std::deque< std::string > &  history 
)
static

Definition at line 93 of file sdl2.cpp.

References draw_text().

Referenced by main().

static void draw_command_line ( sdl::twindow window,
const std::string command 
)
static

Definition at line 88 of file sdl2.cpp.

References draw_text().

Referenced by main().

static void draw_text ( sdl::twindow window,
const std::string string,
const int  x,
const int  y 
)
static

Definition at line 71 of file sdl2.cpp.

References font::ttext::render(), and font::ttext::set_text().

Referenced by draw_command_history(), and draw_command_line().

static bool execute_command ( std::string command_line)
static
std::string get_token ( const std::string string,
std::string::const_iterator &  begin,
const char  separator 
)

Gets a token from a string.

Tokens are separated by a single separator character.

Parameters
stringThe string to search for tokens.
[in,out]beginInput:
  • The beginning of the current token. The text until the next separator is matched. Output:
  • The position of the next token or the end of the string if the separator character was not found.
separatorThe character marking the separation between tokens.
Returns
The matched string. The match is either until the separator character, or if the character is not found until the end of the string.

Definition at line 121 of file sdl2.cpp.

References gui2::event::find().

Referenced by execute_command().

int main ( void  )

Variable Documentation

std::vector<sdl::twindow*> windows

Contains the windows created by the user.

Note
The pointers are leaked when the program terminates, leaving it to the OS to do the cleanup.

Definition at line 33 of file sdl2.cpp.