src/supertux/console.cpp File Reference

#include "supertux/console.hpp"
#include <math.h>
#include <iostream>
#include "physfs/ifile_stream.hpp"
#include "scripting/squirrel_util.hpp"
#include "supertux/gameconfig.hpp"
#include "supertux/globals.hpp"
#include "video/drawing_context.hpp"

Go to the source code of this file.

Functions

void sq_insert_commands (std::list< std::string > &cmds, HSQUIRRELVM vm, std::string table_prefix, std::string search_prefix)
void sq_insert_command (std::list< std::string > &cmds, HSQUIRRELVM vm, std::string table_prefix, std::string search_prefix)
 Acts upon key,value on top of stack: Appends key (plus type-dependent suffix) to cmds if table_prefix+key starts with search_prefix; Calls sq_insert_commands if search_prefix starts with table_prefix+key (and value is a table/class/instance);.
void sq_insert_commands (std::list< std::string > &cmds, HSQUIRRELVM vm, std::string table_prefix, std::string search_prefix)
 calls sq_insert_command for all entries of table/class on top of stack

Variables

static const float FADE_SPEED = 1
 speed (pixels/s) the console closes


Function Documentation

void @372::sq_insert_command ( std::list< std::string > &  cmds,
HSQUIRRELVM  vm,
std::string  table_prefix,
std::string  search_prefix 
) [static]

Acts upon key,value on top of stack: Appends key (plus type-dependent suffix) to cmds if table_prefix+key starts with search_prefix; Calls sq_insert_commands if search_prefix starts with table_prefix+key (and value is a table/class/instance);.

Definition at line 228 of file console.cpp.

References sq_insert_commands().

Referenced by sq_insert_commands().

00229 {
00230   const SQChar* key_chars;
00231   if (SQ_FAILED(sq_getstring(vm, -2, &key_chars))) return;
00232   std::string key_string = table_prefix + key_chars;
00233 
00234   switch (sq_gettype(vm, -1)) {
00235     case OT_INSTANCE:
00236       key_string+=".";
00237       if (search_prefix.substr(0, key_string.length()) == key_string) {
00238         sq_getclass(vm, -1);
00239         sq_insert_commands(cmds, vm, key_string, search_prefix);
00240         sq_pop(vm, 1);
00241       }
00242       break;
00243     case OT_TABLE:
00244     case OT_CLASS:
00245       key_string+=".";
00246       if (search_prefix.substr(0, key_string.length()) == key_string) {
00247         sq_insert_commands(cmds, vm, key_string, search_prefix);
00248       }
00249       break;
00250     case OT_CLOSURE:
00251     case OT_NATIVECLOSURE:
00252       key_string+="()";
00253       break;
00254     default:
00255       break;
00256   }
00257 
00258   if (key_string.substr(0, search_prefix.length()) == search_prefix) {
00259     cmds.push_back(key_string);
00260   }
00261 
00262 }

void @372::sq_insert_commands ( std::list< std::string > &  cmds,
HSQUIRRELVM  vm,
std::string  table_prefix,
std::string  search_prefix 
) [static]

calls sq_insert_command for all entries of table/class on top of stack

Definition at line 268 of file console.cpp.

References sq_insert_command().

00269 {
00270   sq_pushnull(vm); // push iterator
00271   while (SQ_SUCCEEDED(sq_next(vm,-2))) {
00272     sq_insert_command(cmds, vm, table_prefix, search_prefix);
00273     sq_pop(vm, 2); // pop key, val
00274   }
00275   sq_pop(vm, 1); // pop iterator
00276 }

void @372::sq_insert_commands ( std::list< std::string > &  cmds,
HSQUIRRELVM  vm,
std::string  table_prefix,
std::string  search_prefix 
) [static]

Referenced by Console::autocomplete(), and sq_insert_command().


Variable Documentation

const float FADE_SPEED = 1 [static]

speed (pixels/s) the console closes

Definition at line 29 of file console.cpp.

Referenced by Console::update().


Generated on Mon Jun 9 03:38:26 2014 for SuperTux by  doxygen 1.5.1