« first day (2511 days earlier)      last day (2508 days later) » 
07:00 - 15:0015:00 - 23:00

7:53 AM
Morning
 
8:31 AM
Hey
 
 
1 hour later…
9:44 AM
@ShaunWild hey oh
 
sup homie
 
sup?
 
🏠
(^ it's a homie)
 
@doppelgreener stoooppp
 
10:30 AM
Help
 
user92578
I saw that
 
"Why doesn't it work" I read
hehe
 
Fine
Just a moment
 
user92578
you can edit messages - see?
 
Up arrow
To edit last message
 
10:31 AM
@Override
    public void sendHighScore(int highScore)
    {
        prova=true;
        Log.i("AAAAAAAAAAAAAAAAAAA","AAAAAAAAAAA");
    }
 
"AAAAAAAAAAAAAAAAAAA" You are now banned from GameDevelopment SE
 
The first is in the activity, the second in the game
@ShaunWild I always write "AAAAAAAAAAAAA" because in this way I can see the log better XD
 
I always write profanities
 
...
However, the second method isn't called
 
user92578
What second method? I can see one method
 
10:34 AM
menu.addListener(new ClickListener()
        {
            @Override
            public void clicked(InputEvent event, float x, float y)
            {
                sendHighScore.sendHighScore(preferences.getInteger("High score", asseXPercorso));
                Gdx.app.exit();
            }
        });
I didn't send it, sorry
 
user92578
So what doesn't get called? The sendHighScore?
 
yes
now I know why this didn't work: gamedev.stackexchange.com/questions/142560/…
 
user92578
But the clicked does?
 
yes
 
user92578
what is sendHighScore?
 
10:36 AM
Gonna guess its something to do with (preferences.getInteger("High score", asseXPercorso)
 
user92578
the object
 
sendHighScore is an interface
 
Your UI system looks incredibly over complicated
 
And the mainactivity implements it
 
Why don't you just use one listener for every button
And check which button is being clicked in the listener
cut your code in half
 
user92578
10:38 AM
yeah but how is it assigned?
 
public MyGdxGame(SendHighScore send)
    {
        sendHighScore = send;
    }
 
user92578
as someone with their codebase filled with if (button->GetName() == "SomeButton"), I like this "lambda" system of input events
 
user92578
@Curio And how is MyGdxGame constructed?
 
public class AndroidLauncher extends AndroidApplication
{
	@Override
    public void onCreate(Bundle bundle)
	{
		super.onCreate(bundle);
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        MyGdxGame game = new MyGdxGame((MainActivity)getIntent().getSerializableExtra("MainActivity"));
        initialize(game, config);
    }
}
 
Also use lambdas @Curio
 
10:40 AM
@ShaunWild because I have a lot of stages: button are displayed in different moments
 
user92578
is MainActivity a class of yours?
 
menu.addListener((e, x, y)->{ //code... });
 
Yes, it's the menu class
Where there is PLAY button
 
user92578
So I don't really know how Java's casting works
 
user92578
But my guess is that this is the cause of the issue: (MainActivity)getIntent().getSerializableExtra("MainActivity")
 
10:42 AM
There are a lot of answers that say using this method, probably the problem is that
 
user92578
At least in C++, upcasting doesn't change virtual function behaviour
 
@Curio I am the master of Java, just explain your problem to me...
 
user92578
His virtual method doesn't get called
 
Is there an exception thrown?
 
Now I try to send a static variable without Serializable. I only want to do a test, @ShaunWild don't eat me
No
 
user92578
10:44 AM
You could confirm my beliefs by implementing the default `sendHighScore` method and adding a `Log.i("DEFAULT CALLED");` inside there
I believe you would see "DEFAULT CALLED" in your log
 
What does getSerializableExtra return?
 
A mainactivity object
 
Why do you cast it then
 
because getIntent().getSerializableExtra("MainActivity") returns Serializable
 
So you lied to me
 
user92578
10:46 AM
So it doesn't return a mainactivity then.
 
I'll askk again
What ddoes getSerializableExtra return
 
Oh sorry I thought with the cast
Yes, getSerializableExtra returns serializable
 
user92578
could you quickly try what I suggested?
 
I think you shuold check your log output for exceptions first...
 
@Tyyppi_77 now I'll remove the getSerializable
 
user92578
10:49 AM
not what I suggested but okay
 
I lost something. what do you suggest?
 
user92578
5 mins ago, by Tyyppi_77
You could confirm my beliefs by implementing the default `sendHighScore` method and adding a `Log.i("DEFAULT CALLED");` inside there
I believe you would see "DEFAULT CALLED" in your log
 
default sendHighScore?
 
user92578
in the interface
 
ah ok
but
I can't implement a method in the interface
because it's an interface
 
user92578
10:57 AM
well turn it into a class then
 
user92578
sorry, I'm so used to C++, which doesn't have interfaces, they are just classes where you don't provide default implementations
 
interfaces are places in which you can only declare some methods without writing what is in them
 
user92578
yeah I know what interfaces are.
 
fine
Oh, with static variable it works, the problem was the serializable
 
user92578
yeah that seems to confirm what I was saying too
 
user92578
11:01 AM
virtual method implementations are tied to instances, not types
 
Serializable is evil
 
user92578
no
 
Sometimes I mean
 
user92578
 
user92578
What do you think that code outputs?
 
11:05 AM
is it C++?
 
user92578
It's pseudo-code, like I said
 
Does : means "extends"?
 
user92578
yeah
 
user92578
or implements
 
but
Derived d = (Derived)b; can a superclass is casted to a subclass? I don't think so
 
user92578
11:09 AM
That's what you were doing.
 
aah
It should be Base b = new Derived ();
 
user92578
yes, in that case the code would work as you expected
 
user92578
because overriden methods are attached to instances, not types
 
@Curio you can cast subclass to a class or interface it implements, but you can't cast downwards
at least in java
 
11:25 AM
@Tyyppi_77 does C++ let you cast downwards? :D
 
user92578
C++ lets you cast anywhere
 
oh boy
> If C gives you enough rope to hang yourself, then C++ gives you enough rope to bind and gag your neighborhood, rig the sails on a small ship, and still have enough rope to hang yourself from the yardarm
i am reminded of this. ^ :D
 
user92578
Well, I'd say that in casting, C is worse since most things kinda require you to pass around void pointers, which you then cast to what you actually needed
 
oh dear
 
@doppelgreener what language doesn't let you do that?
I mean sure, most languages will crash on runtime instead of doing undefined behaviour
 
11:41 AM
@KevinvanderVelden I consider that a subset of "can't do that" hahaha
 
You can, you just have to be not wrong
 
yeah exactly
 
Which is the same as in C++, though C++ does make it harder to verify you're going to do the correct thing
(though not impossible)
 
Ah, gotcha
 
(and when I say harder I do mean a lot harder, unless you use RTTI)
But on the other hand, in languages like C# you can try to cast (almost) anything to an System.Object and then cast back down to something unrelated, in C++ each inheritance tree is separate
 
12:02 PM
Are questions removed from the review queue if they are edited?
(Not while being reviewed.)
(From the close review queue...)
 
12:15 PM
@Tyyppi_77 but why doesn't the game crash when I try to cast Serializable to MainActivity?
Nah, I was wrong, this happens only with superclasses
I didn't understand where's the problem with interfaces.
   Interface interface= new Class();
    Class class = (Class) interface;
    interface.method();
 
user92578
that's fine
 
The method is called both in interface.method(); and class.method();
 
user92578
yes, because you instantiated a Class
 
user92578
12:30 PM
that's exactly how it's supposed to work, current type doesn't matter, only the instanced type matters
 
Yes, but why didn't Serializable object casted to MainActivity call the method?
 
user92578
Because there's no instantiated MainActivity
 
user92578
There's just a Serializable that looks like a MainActivity
 
Serializable serializable = new MainActivity(); So it isn't like this
 
user92578
no.
 
12:33 PM
All right
what do you mean for "looks like"?
 
user92578
Interface i = new Class();
 
user92578
here a Class object "looks like" an Interface
 
user92578
as in the current variable has the type of Interface
 
but
        Interface interface = new Class();
        Class class = (Class) interface;
        interface.method();
        class.method();  In this case they work at the same way
 
user92578
sigh
 
user92578
12:41 PM
yes
 
user92578
because you create a Class
 
Do you mean this? Class class = (Class) interface;
 
user92578
Interface interface = new Class();
 
user92578
here you make a new instance of Class
 
yes
 
user92578
12:44 PM
which means that it doesn't matter which type the object is casted into, virtual methods will always be invoked from Class, because the object is a Class
 
user92578
it might look like an Interface
 
user92578
but it is a Class
 
You said: Because there's no instantiated MainActivity
There's just a Serializable that looks like a MainActivity. So when is there an instantiated Class?
In this case Class class = (Class) interface;?
 
user92578
Interface interface = new Class();
 
user92578
Here. Instantiation essentially means using new
 
12:47 PM
But in that case you said that the object looks like another
Are they the same thing?
 
user92578
it's casted as an Interface
 
user92578
they are a totally different thing, which is what I'm trying to teach you here, since it's a very important difference
 
user92578
especially when it comes to handling these interface methods
 
1)Because there's no instantiated MainActivity
2)There's just a Serializable that looks like a MainActivity. Can you write an example for each ? We are making a bit of noise
 
user92578
MainActivity getMainActivity() {
	Serializable someObject = new Serializable();
	return (MainActivity)someObject;
}

// Your code:
MainActivity m = getMainActivity();
 
user92578
12:51 PM
This covers both cases.
No MainActivity is created anywhere
 
user92578
There is just a Serializable that looks like a MainActivity
 
Class class = (Class) interface; ah so it was this
I meant this
 
@Curio Person person = (Person)curio <- is this person someone else than you?
It's just another reference
 
But the person is always Curio
 
Person person = (Person)kevin
 
12:53 PM
But if I write that I can't access to Curio's methods
 
Correct, because the only thing you know about person is that it is of class Person
You can then at a later point in the program say "Hey I'm smart, I know this is a Curio, I can cast it to Curio and use Curio methods"
 
all right
 
If you're correct and you did Person person = (Person)curio earlier in the program everything is fine, if you're wrong and it was actually Person person = (Person)kevin then things break
 
user92578
damn you and your understandable examples :D
 
12:56 PM
but isn't kevin always a person?
 
Sometimes a different tract is needed cause you're stuck going in circles =p
@Curio sure, but a person isn't always a kevin
So if you have a kevin you can call person methods, but if you have a person you can't call kevin methods
 
All right
@KevinvanderVelden why is the second wrong?
 
@Curio because, say, Person provides method for pointing at things, kevin and curio can both do that. But curio can read italian, and kevin can't, so trying to ask a person to read italian you can't guarantee that it will work. You first need to tell the computer it's okay I know what I'm doing by casting back to a Curio
If however it was accidentally a kevin for some reason then you're trying to ask me to read italian and I'm just gonna look at you weird cause I don't know italian
 
But both Curio and Kevin extend Person
 
user92578
yes but Kevin is not a Curio
 
1:03 PM
In the two example do you always take the same Person object?
I hope yes
 
There's no Person objects, there's only a Kevin object and a Curio object
Person person = (Person)curio doesn't create a new object, it creates another reference to an existing
You're still you, we didn't clone you
 
So you mean Person person = (Person)curio;
person = (Person)kevin;
 
We just got your number and wrote it down if we need to ask you something
 
in the second example person is always curio
 
You're thinking to literally, they're both 2 possible first lines
 
1:08 PM
I mean, I make "become" Curio a person. So that person is curio. Then I try to make become Kevin a Curio but this isn't possible because that person is curio
Do you mean this?
 
---Good
Curio curio = new Curio();
Person person = (Person)curio;
Curio curioRef2 = (Curio)person;


---Bad
Kevin kevin = new Kevin()
Person person = (Person)kevin;
Curio curioRef2 = (Curio)person;
 
Perfect
 
Person pesron = new Curio();
 
So we have to have the same reference and instance to have "full powers" on that object
 
No, we just need a reference of the correct type
 
1:15 PM
Like Curio curio = new Curio();?
the reference is of the same kind of the instance
 
Curio curioRef2 = (Curio)person; is fine
 
why not Curio curio = new Curio(); too? They are the same
The person is a curio
 
Yes, they're both fine
 
It depends on the situation
 
all right
 
1:17 PM
But generally both are fine
 
in which situations are they different?
 
If there is specific behaviour you need to call from Curio then you call Curio curio = new Curio, if there is not then Person is fine
Say, Curio has a new method that is not present in person
 
But if I do Curio curioRef2 = (Curio)person; can I access to all Curio's method?
I guess so
because the person is a Curio
 
Yes
 
so what's the difference?
 
1:20 PM
There isn't one, it just depends
Let's say you have:

`Person person;`

you can do both of these

`person = new Kevin();

//or

person = new Curio();`

And then you can call `person.talk();` which will call the underlying person's talk method.
 
yes
 
If you do Curio curio = new Curio();

You can do curio.talk();, which is the same, but you cannot do Curio curio = new Kevin();
 
ah yes
 
It depends if your field will ever need to be one of the sub classes
 
So
 
1:23 PM
A good example is a building game, you can have a "Tool" class, that could be a ruler, hammer, drill etc, tool = new Drill(); tool = new Ruler()... etc ... That way you can then call tool.use(); and whichever tool is present will be used, this way you don't have to have a seperate field for each tool that the player may use.
Then if there is a corner case, you may do

if(tool instanceof Ruler){
  Ruler ruler = (Ruler) tool;
  ruler.use();
  int distance = ruler.getMeasurement();

  //...
}
 
Fine
 
Rude
 
I didn't finish man ;)
If I don't say "Thank you very much my heros" means that there is another thing to ask
 
Entity fakeCurio = doppelgreener.clone(Curio);
realCurio.destroy();
realCurio = fakeCurio;
societies.doppelganger.agenda.advance();
 
nooooo
 
1:31 PM
`omg no
shaun.kidnap(doppelganger);
;)
 
oh nO
 
Meh, you have more
 
just a moment
Returning to Serializable
Serializable serializable = new MainActivity();
MainActivity mainActivity = (MainActivity) serializable;
mainActivity.callownmethod();
 
Person child = new Person(shaun, doppelganger);
did we just have a child?
 
This happens when I casted serializable to mainActivity
It didn't crashes, so the cast was possible (furthermore because we don't have interfaces objects)
but why wasn't the method called? If i wrote MainActivity mainActivity = this; and then mainactivity.callownmethod(); the method was called
No just a moment
This isn't the right situation.
I think that this is an absurd
 
1:41 PM
lol
 
Serializable serializable = new MainActivity();
MainActivity mainActivity = (MainActivity) serializable;
Interface interface = mainActivity;
interface.callownmethod();
 
Does MainActivity implement interface?
 
The interface can call that method because mainActivity overrides it
yes it does
 
Interface interface = new MainActivity();
interface.callownmethod(); // ... ?
 
1:43 PM
but that method isn't called
 
Well it should be
 
You're going to need to show some code
 
MainActivity mainActivity = new MainAcitivity();
mainAcitivity.callownmethod();

should work as well
 
That case works in fact
But not with interface
 
1:46 PM
Is Inteface.callownmethod() a concrete method?
 
no, you have to override it
 
there should be no problem then
 
In that question the method is called...but there is another problem, it seems that the activity is destroyed without calling onDestroy and onCreate
Today I can say that the activity isn't destroyed but the method isn't called
Now I try again to implement Serializable
If it works, I'm blind
Ok, I'm blind
 
Person person = new Curio();
person.isBlind(); //evaluates to true
 
Curio overrides isBlind() to true
I would have had to put more Log.i("AAAAAAAAAAAAAA","AAAAAAAAAAAAAA");
 
1:59 PM
hahahaha
 
In fact this time I put 8 logs...
Thank you very much for your explanations
 
dont mention it :)
 
why?
 
@Curio "don't mention it" is a thing people say in response to "thank you", it's along the lines of "it's no problem", "you're welcome", "no worries", etc
 
hahahah I thought that the meaning was: "don't quote the people"
 
2:05 PM
"don't tell anyone, i don't want this to come up in the court trial"
 
Hahahaha
SHSH YOU'RE GOING TO BLOW OUR COVER
 
whoops [edits]
 
I want to procedurally generate physics based creatures
With limbs and joints that vary based on genes
 
I have a great news
 
Do you
 
2:18 PM
No, I'm wrong. I was going to say that I'm not blind...
 
No sorry, you are still blind
 
I know :(
 
hahahaha
 
I love watching a GDC talk where they start out with some random word, like "Whatever".
 
2:22 PM
nice game XD
 
2:34 PM
I wanna make my creatures like this
So they have a "skeleton", that contains limbs and joints
And then they have their "skin"
And various other body parts grow on skin
 
Mmm...pizza!
 
Get outta heerreee
 
XD
 
DH.
FML I can't find a paper or anything academic decent to refer to low pass filter
There are bazilions pages of low pass filter, how do to it on a circuit or algortihm, but not even a single fucking reference
 
If signal > low pass; no;
Might wanna edit that @DH.
(the 3rd word)
 
DH.
2:50 PM
I'm not directing that word to anyone, can't see a problem with it
 
It will get flagged and you'll get a timeout regardless...
 
07:00 - 15:0015:00 - 23:00

« first day (2511 days earlier)      last day (2508 days later) »