Thanks a lot Mike,
this kind of event oriented game programming will be something new for me, and I am looking forward to it.
The thinBASIC functions and module links are very poweful combo! I am sure it will start new era of thinBASIC games
Petr
Hi folks,
I think I have the syntax settled and it is ready to be published. TBEM - Event manager module for thinBasic. It will help you set up events for a game. Well, it could be used for other uses too, but I was thinking more game related, when I was developing it. Included with the module is a little help file that describes the syntax right now. I will wirte some samples tonight to relieve the power of this little module. I'm pretty excited about it as I think it is really a helper when you develop games. Ok, enough bragging. Like I said, samples will follow soon, but the ones who want to play with it allready, download it now.
Update October 18th, 2008: Version 1.10 uploaded. Bugfixes plus new zone commands
Here is just a little console sample:
[code=thinbasic]
uses "TBEM"
uses "Console"
dim event1, event2 as long
dim y,q,z as long
dim stime,dtime,etime as dword
q = 0
z = 0
y = 0
%evg_system = 1
%evg_user = 2
%evt_game = 1
%evt_gui = 2
%evt_next = 3
function FinishIt()
console_writeline(y+") Finish")
q = 99
function = 0
end function
function getTime()
y += 1
console_writeline(y + ") TimeDiff="+dtime)
function = 0
end function
event1 = TBEM_AddEvent("getTime",%evt_gui,getTickcount,%evg_system,%TRUE)
event2 = TBEM_AddEvent("FinishIt",%evt_game,getTickcount+300,%evg_system,%TRUE)
stime = gettickcount
while q = 0
etime = gettickcount
dtime = etime - stime
TBEM_AddTrigger ( %evt_gui)
TBEM_AddTrigger ( %evt_game)
TBEM_run(%evg_system)
wend
console_writeline("TriggerCount="+TBEM_GetTriggerCount+" EventCount="+TBEM_GetEventCount)
console_writeline("Press any key...")
Console_waitkey
[/code]
Thanks a lot Mike,
this kind of event oriented game programming will be something new for me, and I am looking forward to it.
The thinBASIC functions and module links are very poweful combo! I am sure it will start new era of thinBASIC games
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Ok Eros, I uploaded a new version and added your requested command.
Hi Eros,
I think this module deserves separate forum section, else this post will get lost in sea of new messages, and that would be a pity.
Thanks,
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Already done ;D
http://community.thinbasic.com/index.php?board=154.0
I'm just now moving posts in there.
Michael is moderator.
Ciao
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Updated the module because auf a serious pointer bug. Please download it from the first post.
Thanks Mike for the update!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Hi,
please download the latest release. There was some nasty timing probs when you used several self repeating events.
Thanks to Eros for testing.
Hi dear Michael :-)
.. question about your "TBEM"... Can you explain to me what is the content of the 'event manager module'? Do you need it for "Games"? ... your example is only useful for the console?...or may be a good thing for window gui too? perhaps it's rubbish I told, but I am only curious to understand what is TBEM ;-))
best regards, hope your scripts are running well with the new thinBasic version,
greetings with a lot of sunshine from centre of germany, lionheart
you can't always get what you want, but if you try sometimes you might find, you get what you need
Hi lionheart,
you can use TBEM for everything that needs to be done repeatly/automatically. There are 2 main parts of the event module, events and triggers. First you have to tell the modul which event functions exists on which trigger they can react. Triggers are fired by your code, when ever you need them. TBEM then looks if some events needs to be processed and will call the specific functions.
I had mostly games in my mind but maybe it is good for windows apps too. But don't confuse TBEM-events with windows events. Two different things. And they are not console only. It was just a quick sample I came up with.
I will will try to come up with more samples so it will be easier to understand.
Thanks, yes it is sunny here too. But enjoy it as they predict that it will be the last warm days in the year.
Bookmarks