Augusto Sellhorn

Ranch Hand
+ Follow
since May 24, 2007
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Augusto Sellhorn

Rob Spoor wrote:Although your code still has a few bugs* it's very informative indeed. I didn't know it existed before reading this thread.

- The building of the tree map can be probably be done inside the first SwingWorker, either in its doInBackground method (when not required to run on the EDT) or in its done method (when required to run on the EDT).
- You don't check the results of fileChooser.showOpenDialog(this). If the user canceled you will see "Not a directory!" on your console.
- There is a double cast to List on line 14/15 of your first code snippet.

Thanks for the feedback, I fixed the double cast I think that was a copy/paste error but removed it avoid confusion.

The file dialog is handled kind of weird but keeps the code simple I just wanted to write " List files = findFiles(fileChooser.getSelectedFile());" to make it look simpler. Inside findFiles (which I wasn't planning on showing in the post but had to because it has the loop) handles it and the UI doesn't do any real work (doesn't build the treemap)

There's no SwingWorker in the code, that's kind of the point of it. Yes you could do a SwingWorker and do the 2 tasks, but I like this style better, it reads simpler and in this case the treemap is a JPanel, imagine it does UI stuff before recursively building the map, it's executing first on the EDT which is what I want.

EDT work
Thread work (find files)
EDT Work update status etc
Thread work (build treemap structure)
EDT Work update state
12 years ago
I updated my blog with a post about SecondaryLoop, I wonder how many Java/UI developers are aware of it;

I remember wanting for a while to have a way to call long running tasks from my Java program without block the UI, just like the file chooser does. I'm not sure if there was a way to do this before this feature, but it sure wants to make me go back to old code and remove SwingWorkers all over the place!
12 years ago
A lot of focus on HTML5 when it comes to the web is focused on the low level (often 2d) graphic capabilities of the canvas component. I'm kind of wondering what else HTML5 brings to the table that is relevant to game programming in particular.

For example, HTML5 has the audio element, although I'm not sure what advantages it has over older methods of playing sounds.

I don't seen anything in HTML5 for things like basic geometry primitives, hit detection, animation (timers, easy in/out, etc) or support for gaming controllers (gamepads).

So some of these things are probably provided by js libraries/frameworks, but i'm wondering what other HTML5 components are there that are essential or more relevant to game programming, beyond basic drawing capabilities.

BTW - on hit detection, I was playing with some canvas stuff and the isPointInPath function to be puzzling. It works on a point hitting the current path, seems a bit useless. If you wanted to leverage it for graphical objects you create, you'd have to recreate the path (and not draw) on say a mouse click hit detection. Maybe I'm missing the point of this function ...
I've been using the Netbeans Javascript editor lately btw, doesn't seem too bad ... although I'm not sure about the rules it follows for auto completion. Sometimes the canvas' context functions don't want to show up depending on where I defined the variables :-(
Thanks for that response James, that clarifies a lot.

BTW, can you mix graphics drawing with Canvas2D and WebGL? For example, if I have a menu system that draws in a Canvas2D over a 3D WebGL background (actual game engine)?

If I'm not mistaken, when people talk about the HTML5 canvas component we're talking more of a 2D rendering area right. Something analogous to say Java2D?

Now I see there's a push for WebGL; which seems like a separate thing, a way to have OpenGL semantics on the browser (rendering on the canvas component?).

So what's the relationship of WebGL to HTML5, or more specifically the canvas component? Is it just an extension or an integral part of canvas? One thing that is evident is that it's not fully supported in most browsers, so it doesn't seem that useful currently for cross browser game development (I'm not aware of a mobile implementation either).

The target date is July 28 for official release.
12 years ago

John Todd wrote:I'm happy Java is moving but nothing caught my eyes in Java 7. invokedynamic is cool any way.
I hope Java 8 will bring much more exciting and important features to the table.
Maybe it is time to announce Scala programming language as the second official language on the JVM.

I'm not sure what making a language the "second official language" would really accomplish.

Anyways, I think the planned changes for 8 are pretty significant changes; you've got lambda expressions, literal expressions for collections and modularization via Jigsaw.

That's a good set of features that will take some time to digest ...
12 years ago
Just wanted to share my blog post on 7 features I think are cool in Java 7;

"7 new cool features in Java 7"

But I was wondering if I had to pick one which it would be, and what everybody would chose.

I think for me it would have to be the multiple exception handling interface. I know it's not the most exciting thing, but I've been guilty of one of the things I criticize in my blog post which is using catch (Exception e) when I'm bothered by catching 5 different exceptions because I'm doing some reflection work.

So what's your favorite Java 7 feature?
12 years ago
Actually that's good info. It sounds like for GL views they have something similar to Swing's layered panes. Will have to try it out.

For a 2D view, what I'm thinking is maybe I can pass the Canvas object to the onDraw method of a GUI control. I'm just getting started on Android so sorry, haven't tried out a bunch of these things, just trying to move from the Swing world :-)
13 years ago

Dave MacLean wrote:If you're using an HTTP connection to download the images, there's a way to enable caching within it, so you might achieve what you want that way. Every time you start your app, it would go fetch the images, which may not be exactly what you want. But while your app is running, a new fetch should just find the image in the HTTP cache and avoid another fetch over the network.

Otherwise, you should be able to create an image folder on the SD card to store your downloaded files. Save them off in a format that doesn't require conversion next time you read it back in. Also, if you put an empty file with the filename ".nomedia" in the directory with your image files, Gallery will ignore them. Technically the media scanner will ignore them so Gallery never finds out about them.

- dave

So every app has to manually cache it ... would be nice if there was a way to load it via an http service from the browser so you can reuse that cache.

Hadn't thought about this one, I tend to think for most apps you want to have the images in the apk file.
13 years ago
Let me ask it another way, do you know if there's a way to draw a UI control in a view's onDraw method? Say in my 2D game scene I want to draw and animate buttons in the middle of the scene? Or is this done with some type of overlay mechanism?

13 years ago
Is it possible to use Android GUI controls (buttons, labels, text fields, etc) on top of game graphics? For example; let's say I have an OpenGL drawn scene and want to popup a quit confirmation dialog? (the graphics a really on the box in that case)

What about rendering controls in the actual OpenGL or 2D graphics scene, for example a free floating button or text field in the middle of the screen.

The reason I'm asking is that in the desktop world, gaming engines usually have their own Game UI control libraries. Now, in Java2D/Swing it was possible to do some of this because the Swing controls are lightweight. I'm not sure if the Android controls are lightweight or not, so wondering if you guys know a bit about this (I realize the book is not about gaming, but hopefully you get what I mean).

13 years ago
I'm wondering if the book has any hints on higher level content engines like wordpress, since I'm usually not messing around with HTML or CSS for my blogs. I know wordpress is fully customisable and you can hack around their HTML templates and CSS for styling, but I'm wondering if this is addressed a bit in the book.
I was googling around to find a good gallery of R graphs and found this one;

I really like the 2004 election map one, located here (with source code and data);

The 3D graphs are pretty impressive too, so this looks like a good resource since they link to code just to see how they are done. If anybody has any other useful links to these type of galleries (specially with source) please feel free to link.
13 years ago