Are you trying to do reference-counting, Tav? I'm curious as to why you'd want to look at the count of objects you've instantiated/created.
We're making what's pretty much a poker game and keeping track of the dealer using an int (which ever player's counter equals 0 is the dealer, 1 is little blind and 2 is big blind). At the moment it's hard coded for 4 players (At the start of the first round it's like p1 - 0, p2 - 1, p3 - 2, p3 - 4 and then at the start of the second round it's p1 - 1, p2 - 2, p3 - 3, p4 - 0...). I was wondering if there was some inbuilt in way to account for x players so it'd be like if (px = playerCount()) {dealerCount = 0}
edit: There is probably a more efficient way to account for something like this, but this was the first thing I could think of so I'm running with it till someone yells at me for doing it wrong. Not much time for this project so it's functionality over elegance!
Tav on
0
Options
admanbunionize your workplaceSeattle, WARegistered Userregular
How are you planning on storing the variable number of players? You must be keeping them in some data structure that you can get length out of.
How are you planning on storing the variable number of players? You must be keeping them in some data structure that you can get length out of.
I was hoping for some magical method I didn't know about where I could just be all "int players = ((getNumberOfInstances(computerAgent) + getNumberOfInstances(playerAgent));" but apparently this doesn't exist.
0
Options
admanbunionize your workplaceSeattle, WARegistered Userregular
Right... but how are you storing the players? I imagine when you had a fixed number you had something like
Player p1 = Player.new();
...
Player p4 = Player.new();
but with a variable number you can't do that anymore.
Isn't getTransferData returning a String object, since that's the flavor?
Wouldn't you need a flavor for Control objects if you were trying to cast it straight to one?
It is actually pulling the control properly somehow. I literally cannot explain it, however. It's just that when I drag and drop it from the table into the scene it is creating a new control each time rather than using the control that already exist.
Isn't getTransferData returning a String object, since that's the flavor?
Wouldn't you need a flavor for Control objects if you were trying to cast it straight to one?
It is actually pulling the control properly somehow. I literally cannot explain it, however. It's just that when I drag and drop it from the table into the scene it is creating a new control each time rather than using the control that already exist.
That doesn't sound proper to me. :rotate:
It might have some bizarre connection with how Control has a string constructor, does Java do implicit conversion?
i.e. If you have a string of "TextField" or such, does your cast somehow get transformed into Control("TextField")? I know C++ can do that.
That's what I was thinking too, infidel. I cannot find any supporting documentation for java though. And I'm suspecting the way urahonky stores the events for processing by functions other than the one that captured the event, it's creating some sort of nasty mangling.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Right now we have a WYSIWYGScene set as a singleton. Why? Because we had assumed there will ALWAYS ONLY be one scene at one point in time. Well now that we've got Tabbed Panes that won't be possible to assume. So now I'm stuck. We have 30 calls to "WYSIWYGScene.getInstance()". How will I be able to keep track of the "main" scene (ie the one that contains the window)? Create a Class that keeps track of it? Create an ArrayList in our Design Class that contains the scenes? I really don't want to break our program but it doesn't look like I can use a lot of the code that we have written already for Scenes (Which are inside the TabbedPanes) that aren't WYSIWYGScenes (which is our main program's scene).
You will have to rewrite it, you don't want to try and patch singleton design principles to a non-singleton system. Trust me. I know you'll try anyways but that was your warning.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
You will have to rewrite it, you don't want to try and patch singleton design principles to a non-singleton system. Trust me. I know you'll try anyways but that was your warning.
Yeah that is what I'm thinking what I'm going to do. I just need to run it by the other developer because it'll break what he's working on too.
Doing some Android stuff, really neat so far. Lots of APIs built in, made a pretty interesting program that deals with GPS, MapViews, and a DB. Also some Canvas drawing. Very nice stuff. The GPS stuff is a bit more confusing then I think it should be, but overall pretty good.
I made an APP that just logs where I go, (Should only log every 20mins, but its more like every second. The API isn't doing what I thought it would do) and plots the last N on the map. Eventually I'll have an export, and I'll export it to a PostGres +GIS DB and make some other visualizations for it. I think it'd be interesting to see what my steps have looked like for say the past year. I wanted it working intime for PAX East, but no go.
The debugging on your own phone is pretty bad ass.
Having the choice to continue to work with arbitrary databases and query code, or go work on a Java/Oracle stack big app, I choose sticking with the medical database fun times. Even if the pure coding side is meh.
Posts
I'm guessing you'd probably have to use ODBC?
Nintendo ID: Incindium
PSN: IncindiumX
And then control.setIntegrated(true)
it will set it as integrated.
But when I do:
And set it as integrated it doesn't stay integrated. Which means I can drag and drop it 100 times into the scene without a problem.
Wouldn't you need a flavor for Control objects if you were trying to cast it straight to one?
So (Control) on a string cast will cause it to not work at all. Strings aren't controls.
Hahah.
@Tav
There isn't, you can get memory used and the like but not a specific amount of objects unless you keep track of it manually.
Your own classes only? Yeah, just static count that you increment manually works.
We're making what's pretty much a poker game and keeping track of the dealer using an int (which ever player's counter equals 0 is the dealer, 1 is little blind and 2 is big blind). At the moment it's hard coded for 4 players (At the start of the first round it's like p1 - 0, p2 - 1, p3 - 2, p3 - 4 and then at the start of the second round it's p1 - 1, p2 - 2, p3 - 3, p4 - 0...). I was wondering if there was some inbuilt in way to account for x players so it'd be like if (px = playerCount()) {dealerCount = 0}
edit: There is probably a more efficient way to account for something like this, but this was the first thing I could think of so I'm running with it till someone yells at me for doing it wrong. Not much time for this project so it's functionality over elegance!
I was hoping for some magical method I didn't know about where I could just be all "int players = ((getNumberOfInstances(computerAgent) + getNumberOfInstances(playerAgent));" but apparently this doesn't exist.
but with a variable number you can't do that anymore.
ah feck, you're right there. Screw it, hard coding it is :bz
It is actually pulling the control properly somehow. I literally cannot explain it, however. It's just that when I drag and drop it from the table into the scene it is creating a new control each time rather than using the control that already exist.
That doesn't sound proper to me. :rotate:
It might have some bizarre connection with how Control has a string constructor, does Java do implicit conversion?
i.e. If you have a string of "TextField" or such, does your cast somehow get transformed into Control("TextField")? I know C++ can do that.
and that will return the control. Who knew!
Right now we have a WYSIWYGScene set as a singleton. Why? Because we had assumed there will ALWAYS ONLY be one scene at one point in time. Well now that we've got Tabbed Panes that won't be possible to assume. So now I'm stuck. We have 30 calls to "WYSIWYGScene.getInstance()". How will I be able to keep track of the "main" scene (ie the one that contains the window)? Create a Class that keeps track of it? Create an ArrayList in our Design Class that contains the scenes? I really don't want to break our program but it doesn't look like I can use a lot of the code that we have written already for Scenes (Which are inside the TabbedPanes) that aren't WYSIWYGScenes (which is our main program's scene).
Yeah that is what I'm thinking what I'm going to do. I just need to run it by the other developer because it'll break what he's working on too.
I made an APP that just logs where I go, (Should only log every 20mins, but its more like every second. The API isn't doing what I thought it would do) and plots the last N on the map. Eventually I'll have an export, and I'll export it to a PostGres +GIS DB and make some other visualizations for it. I think it'd be interesting to see what my steps have looked like for say the past year. I wanted it working intime for PAX East, but no go.
The debugging on your own phone is pretty bad ass.
When I debug it and highlight over getControlLayer() it has a value in it. But layer doesn't get the value. And ends up being null.
Yeah I keep getting a NPE. But now it looks like if I run getControlLayer().getClass() before I get to that spot I get a NPE. What the hell Netbeans??
Holy crap!