|
3 registered members (AndrewAMD, juanex, Grant),
1,018
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
WinHelpers - A Plugin for very much
#352504
01/04/11 00:26
01/04/11 00:26
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
OP
Expert
|
OP
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
Hey Guys! I've created a plugin for gamestudio! Maybe you think, not another plugin... But i think my plugin gives you many possibilities to create some code. Some features of my plugin: - Lists
- Queues
- Stacks
- FTP
- HTTP
- Registry
- INI-Files
- Threading
- Color conversion
- Bitmap functions
- File functions
- Binary file functions
- Folder functions
- Logs
So if you need only one of those functions, please test this plugin. You can download it here: DOWNLOAD! And now some examples, because i did't wrote a documentation yet... List functions:
int iList = list_create();
list_add(iList,you); //Add you to the list
list_add(iList,me); //Add me to the list
list_remove(iList,you); //Remove you from list
int iLen = list_length(iList);
int i;
for(i = 0; i < iLen; i++)
{
ENTITY* ent = list_getitem(iList,i);
ent.x += 5;
}
You can store every pointer or value in a list. Registry:
registry_open(REG_HKEY_LOCAL_MACHINE);
registry_writestring("SOFTWARE\\WinHelper","PlayerName","Felix"));
registry_writevar("SOFTWARE\\WinHelper","PlayerHeight",1.780);
registry_writeint("SOFTWARE\\WinHelper","PlayerAge",17);
registry_writedouble("SOFTWARE\\WinHelper","PlayerWeight",83.2);
STRING* str_buffer = str_create("#1024");
registry_readstring(str_buffer,"SOFTWARE\\WinHelper","PlayerAge");
error(str_buffer);
The same with INI-Files
ini_init();
ini_writestring("data.ini","PlayerInfo","Name","Felix");
ini_writeint("data.ini","PlayerInfo","Age",17);
ini_writevar("data.ini","PlayerInfo","Height",1.780);
ini_writedouble("data.ini,"PlayerInfo","Weight",83.2);
ini_readstring(str_buffer,"data.ini","PlayerInfo","Name");
error(str_buffer);
An example of HTTP:
net_http_open();
STRING* result = net_http_post("http://www.google.de","",""));
error(result);
New Example with threading functions: var value = 0;
function cnt_up(void* data)
{
while(1)
{
value++;
thread_wait(1); //Never use the normal wait here!!!!
}
}
//To call it:
int thread1 = thread_create(cnt_up,NULL); //Create the thread with no params
wait(-2);
thread_kill(thread1); //Kill the thread
You have to kill every running thread at the end of your game, because you'll get a crash if not Hope you get my coding style. Please requests and bugs in this thread... Felix
Last edited by Richi007; 01/04/11 12:43. Reason: New example
|
|
|
Re: WinHelpers - A Plugin for very much
[Re: MasterQ32]
#352511
01/04/11 01:40
01/04/11 01:40
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Nice  One question: If i can store different type objects within the list, i can store mixed right? Lets say 2 entities and some vars. In delphi its possible to check for the object type of a pointer. Is something similar possible in Lite-C? Like
if(Pointer Is Entity)//delphi
I created a list object too, and currently iam storing a second parameter to indicate its type. Greets Rackscha
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: WinHelpers - A Plugin for very much
[Re: Rackscha]
#352538
01/04/11 11:00
01/04/11 11:00
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
You can use the handle function to determine the type of an object. However, this function only knows engine objects (surprise, surprise), but if I see this right, this is what you wanted. Btw, do I see this right? You do synchronous networking on the mainthread? If so: Thats fucking evil! DON'T! DNS has a 30 second timeout while TCP has a 75(!) second timeout, not to mention the latency which you also need to keep in mind! Thats way to long for an realtime application!
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: WinHelpers - A Plugin for very much
[Re: MasterQ32]
#352559
01/04/11 13:21
01/04/11 13:21
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
But there is a way to do non blocking networking, why the overhead of spawning another thread for this and then fucking up the engine because you are dealing with internal engine structures that are explicitly not thread safe?
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: WinHelpers - A Plugin for very much
[Re: WretchedSid]
#352562
01/04/11 13:52
01/04/11 13:52
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
@Sid: No sadly. Iam dealing with own structures for a GUI system^^"
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
|