Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Kain5056

Member Since 22 Dec 2012
Offline Last Active Mar 15 2015 06:12 PM

Posts I've Made

In Topic: Help understanding Component-Entity systems.

22 February 2015 - 08:42 AM

One more question, about your first example:

struct Entity
{
  int Id;
  std::vector<TComponent*> Components;
};

Doesn't that vector cause problems with inheritance? If I try to run a function from a component that inherits from the base component class/struct, won't it only run the base component's function instead of the inheriting component's?


In Topic: Help understanding Component-Entity systems.

21 February 2015 - 08:39 AM

Thank you very much for your answer. It's a good starting point for me to start learning the more complicated aspects of programming. In the next days I will look at your journal posts and experiment. :-)

 

One question, though: I want to get an explanation on what exactly is going on in these parts:

TComponent(TEntityId entityOwner) : EntityOwner(entityOwner) {}

TPosition(float x, float y, TEntityId entityOwner) : TComponent(entityOwner), X(x), Y(y) {}

What exactly should I google? The reference on structures does not cover this part. :-/

 

Based on your second example, I made this little test which I will experiment with in the next days:

typedef int entity;

struct component
{
    component( entity id ) : ID( id ) {}
    entity ID;
};

struct message : component
{
    std::string Word;
    message( std::string word , entity id ) : component( id ) , Word( word ) { std::cout << Word << std::endl; }
};

int main( int argc , char * argv[] )
{
    entity e = 123;
    entity e2 = 456;
    message( "Hello! :-D I'm entity 1!" , e );
    message( "...And I'm entity 2! Goodbye! :-)" , e2 );

    std::cin.ignore();
    return 0;
}

I know there won't be actual components like "message", it's just my way of testing the implementation with a "Hello world" type of test program. :-)


In Topic: Simple parsing.

20 February 2015 - 01:01 PM

Thank you very much SmkViper, this is exactly what I wanted. :-) As Krypt0n also suggested, I will eventually look into existing parsers, but for the time being I'd like to play a bit with this subject myself, at least for the small test programs.

 

Thanks again. :-)


In Topic: Hello World App won't run in emulator

30 July 2014 - 05:30 PM

OK, I googled it (didn't know exactly what to google at the time) and found the solution.

I downgraded the API Level to 17 just to be sure (Android version 4.2.2) and it works like a charm, both in the emulator and on my physical phone. :-)

Thanks for the help. :-)

 

A question though: Do I even need the API Level 20 stuff? Or is it safe to just uninstall them and just work with Level 17? Because the whole thing takes a billion trillion (rough estimate) Gigabytes on my HDD and it's a bit annoying since it's almost full... :-/


In Topic: Hello World App won't run in emulator

30 July 2014 - 03:00 PM

Okay, here is what the LogCat gives me:

07-30 20:56:19.420: E/AndroidRuntime(871): FATAL EXCEPTION: main
07-30 20:56:19.420: E/AndroidRuntime(871): Process: com.example.testgame, PID: 871
07-30 20:56:19.420: E/AndroidRuntime(871): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testgame/com.example.testgame.MainActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.ActivityThread.access$800(ActivityThread.java:138)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.os.Handler.dispatchMessage(Handler.java:102)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.os.Looper.loop(Looper.java:136)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.ActivityThread.main(ActivityThread.java:5026)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at java.lang.reflect.Method.invokeNative(Native Method)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at java.lang.reflect.Method.invoke(Method.java:515)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at dalvik.system.NativeStart.main(Native Method)
07-30 20:56:19.420: E/AndroidRuntime(871): Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.Activity.setContentView(Activity.java:1930)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at com.example.testgame.MainActivity.onCreate(MainActivity.java:15)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.Activity.performCreate(Activity.java:5242)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-30 20:56:19.420: E/AndroidRuntime(871): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
07-30 20:56:19.420: E/AndroidRuntime(871): 	... 11 more

PARTNERS