Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 2 Need Guide

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Apr 2016 17:44 Edited at: 22nd Apr 2016 19:09
HI.

Currenlt I want convert my made games from VB to C++. also I seen Lee video at below link:

https://youtu.be/hMwkvCQ0910

but Don't know some thing in VC++.

for example in VB we can create new .agc file (e.g Functions.agc) and load it with #include "Functions.agc".
in VC++ I create a Functions.h and load it with #include "Functions.h command and created some function in it.

In summary, in VB I can create new agc file and add DO---Loop in it and with exit command can leave current loop and back to main loop. but I don't know how can add loop in my Functios.h and exit from it. exit command don't work in C++. also I test break and return command for exit the loop, but won't work.

From those who can help me thank you.


EDIT: also agk::SetSpriteColorAlpha(SplashSpr,10); won't work. why?

EDIT: also I used Visual Studio 2010
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 23rd Apr 2016 13:16
any idea?
Lucas Tiridath
AGK Developer
15
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 24th Apr 2016 22:21
I'm assuming you mean you're trying to move from AppGameKit BASIC rather than from VB, right?

Quote: "in VC++ I create a Functions.h and load it with #include "Functions.h command and created some function in it."

Yes, you can do this, but it's a good idea to keep your function definitions and declarations in separate files. By convention, *.h files contains only declarations, and an accompanying *.c/*.cpp file would contain the definition. Defining your functions in headers will work so long as you only include them once, but if you include them more than once, you'll get linker errors complaining about multiple instances of the same thing.

Quote: "in VBAGK BASIC I can create new agc file and add DO---Loop in it and with exit command can leave current loop and back to main loop"

I'm assuming what you mean is the idea of having multiple main loops, right? As in, multiple loops that end with Sync(). Unfortunately this isn't possible in Tier 2, because Tier 2 has to cater to platforms that don't let you write your own main loop. Instead, it gives you three callback functions (Begin(), Loop(), and End()). You need to put your code inside these. If you need multiple main loops, the best approach is probably to implement some kind of state machine, in which each state has its own update method, which is the equivalent of what you would put inside your do loop.

If you just mean what is the C++ equivolent of a do...loop structure though, it's just while (true) { ... }. From within that, break should work fine.

Quote: "also agk::SetSpriteColorAlpha(SplashSpr,10); won't work. why?"

Doesn't work in what way? I've never had a problem with setting the sprite alpha in Tier 2.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Apr 2016 10:49
Thanks Lucas Tiridath for your eplanation.

I think understand what should i do.

but if possible please tell me what is below code and when I should use it.

[/code]
void app::End (void)
{

}
[code lang=cpp]

Thanks.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 25th Apr 2016 13:14
Quote: "void app::End (void)"

Lee explained that in his Twitch vid (did you watch it?). You can put tidy-up code there to run when exiting your app.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 25th Apr 2016 13:28
The coffee is lovely dark and deep,and I have code to write before I sleep.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Apr 2016 13:43
@CJB

Quote: "Lee explained that in his Twitch vid (did you watch it?). You can put tidy-up code there to run when exiting your app."

Yes I seen it but I can not I find the English language orally.
I convert some part of my code to C++ and work very well but can't understand oral English.

@Stab in the Dark

Thanks for guide.


Login to post a reply

Server time is: 2024-04-19 01:47:24
Your offset time is: 2024-04-19 01:47:24