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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_EXAMPLES_DIR "."
#define __UNUSED__
#endif
#include <Eet.h>
#include <Ecore.h>
#include <Ecore_Con.h>
#include <Ecore_Evas.h>
#include <Ecore_File.h>
#include <Edje.h>
#include <stdio.h>
#include <ctype.h>
#include <lua.h>
#include <luajit.h>
#include <lualib.h>
#include <lauxlib.h>
typedef struct _script script; // Define this here, so LuaSL_threads.h can use it.
typedef struct _gameGlobals gameGlobals; // Define this here, so LuaSL_threads.h can use it.
#include "LuaSL_threads.h"
#define WIDTH (1024)
#define HEIGHT (768)
#define PC(...) EINA_LOG_DOM_CRIT(game->logDom, __VA_ARGS__)
#define PE(...) EINA_LOG_DOM_ERR(game->logDom, __VA_ARGS__)
#define PW(...) EINA_LOG_DOM_WARN(game->logDom, __VA_ARGS__)
#define PD(...) EINA_LOG_DOM_DBG(game->logDom, __VA_ARGS__)
#define PI(...) EINA_LOG_DOM_INFO(game->logDom, __VA_ARGS__)
#define PCm(...) EINA_LOG_DOM_CRIT(game.logDom, __VA_ARGS__)
#define PEm(...) EINA_LOG_DOM_ERR(game.logDom, __VA_ARGS__)
#define PWm(...) EINA_LOG_DOM_WARN(game.logDom, __VA_ARGS__)
#define PDm(...) EINA_LOG_DOM_DBG(game.logDom, __VA_ARGS__)
#define PIm(...) EINA_LOG_DOM_INFO(game.logDom, __VA_ARGS__)
#define D() PD("DEBUG")
// "01:03:52 01-01-1973\n\0"
#define DATE_TIME_LEN 21
#define TABLE_WIDTH 7
#define TABLE_HEIGHT 42
#ifndef FALSE
// NEVER change this
typedef enum
{
FALSE = 0,
TRUE = 1
} boolean;
#endif
struct _gameGlobals
{
Ecore_Evas *ee; // Our window.
Evas *canvas; // The canvas for drawing directly onto.
Evas_Object *bg; // Our background edje, also the game specific stuff.
Evas_Object *edje; // The edje of the background.
Ecore_Con_Server *server;
Eina_Hash *scripts, *names;
int logDom;
const char *address;
int port;
boolean ui; // Wether we actually start up the UI.
};
struct _script
{
Eina_Clist node;
gameGlobals *game;
char SID[PATH_MAX];
char fileName[PATH_MAX];
lua_State *L;
struct timeval startTime;
float compileTime, timerTime;
int bugs, warnings;
boolean running;
int status;
int args;
Eina_Clist messages;
Ecore_Con_Client *client;
Ecore_Timer *timer;
};
typedef struct
{
Eina_Clist node;
script *script;
const char message[PATH_MAX];
} scriptMessage;
void loggingStartup(gameGlobals *game);
char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut);
void scriptSendBack(void * data);
void sendBack(gameGlobals *game, Ecore_Con_Client *client, const char *SID, const char *message, ...);
void sendForth(gameGlobals *game, const char *SID, const char *message, ...);
float timeDiff(struct timeval *now, struct timeval *then);
#include "LuaSL_LSL_tree.h"
|