[Q] Drawing Shapes/Spirals and Filling - Java for Android App Development

Hi everyone,
I'm looking for some general advice regarding drawing shapes, lines intersecting those shapes, and filling the space in between.
A little background, I'm creating an app for my son where patterns of geometric shapes are shown. When they are interacted with it would be nice to be able to change colour / animate in some way.
I have created the basic framework for the app - activities, layout, menus and the like. I now need to think about actual functionality.
Looking online I have read some resources on canvases and OpenGL. Both look as though there would be a considerable learning curve, so I'm reaching out for some advice ahead of that.
Many thanks,
Peter :laugh:

Canvas is really pretty easy - just give it a try.
For example you could implement classes for each Object Type (Rectangle, Circle) and save the data (colour, x/y-position,...) in it. Then code a draw(Canvas onto) for that classes.
Kind Regards

Thanks, I'll give it a go with that

petedunc88 said:
Thanks, I'll give it a go with that
Click to expand...
Click to collapse
Yeah, you won't need OpenGL for that.
You could also have a look at 2D graphics engines. They simplify things a lot.

Related

[GAME] DiamondTris - Tetris with support for VGA, stylus & wheel sensor

Updated: 2009-01-03, 21:05 (GMT+1)
Me and Swoop2 is creating a Tetris game for us HTC Touch Diamond users out there in need for a great one! Why I wanted to create a new Tetris game for the HTC Touch Diamond was because all of the Tetris games out there got some flaws (imo); not supporting VGA resolution, visually looking bad, running slow etc.. The closest thing I got was TeKnowMagic Tetris, but I wasn't satisfied either way. There's simply no Tetris game out there filling my requirements.
DiamondTris so far:
VGA resolution
Moving pieces - with the wheel sensor or via the on-screen buttons
Rotation of pieces - with the enter button or via the on-screen buttons
Line completion and destruction
Statistics: score, hi-score, level, lines done/remaining
Difficulties: easy, medium, hard (different speeds)
What needs to be done:
Some minior GUI tweaks
Sound effects
Settings (sounds, controls)
You'll need .NET Framework 3.5, which you'll find here
Changelog:
DiamondTris_20090103.cab:
Installs on device or internal storage
Creates a shortcut in Programs\Games
Pause function implemented
DiamondTris_20090102.cab:
New, better looking on-screen buttons
Added some statistics
Disabled piece rotation by tilting the device (needs further tweaking)
Application icon added
+1
sounds like a fairly simple and easy project... if only i had listened in class...
Why don't you get some pledges to encourage a developer
I would pay around £3 for a tetris game designed for our device
Not loads, but if enough people were too pledge their support...
hays said:
Why don't you get some pledges to encourage a developer
I would pay around £3 for a tetris game designed for our device
Not loads, but if enough people were too pledge their support...
Click to expand...
Click to collapse
good idea.
i'll let hays pay £3 for a Tetris game
(and i suppose i could chuck a few quid in as well )
Of course I'm in for some donations if this game is created
I started a very basic Tetris app for my touch diamond a while ago - just as a play around as my first Windows Mobile application. It uses the wheel for moving the current piece left and right and I was going to have a go at using the accelerometer to turn the piece clockwise/anticlockwise (i.e. a flick to the left or right).
I've never used OpenGL or anything so it was just done using a timer and the graphics object off the OnDraw event. I got as far as creating the grid, drawing the pieces, moving them around and knowing when lines were completed, etc. Still had a lot to do but it was a proof of concept more than anything else.
I'm just a normal application developer and develop form based applications and back end stuff. If I can get to where I am with my effort in the time I have, then someone who knows how to write games properly could easily do something really good.
Swoop2 said:
I started a very basic Tetris app for my touch diamond a while ago - just as a play around as my first Windows Mobile application. It uses the wheel for moving the current piece left and right and I was going to have a go at using the accelerometer to turn the piece clockwise/anticlockwise (i.e. a flick to the left or right).
I've never used OpenGL or anything so it was just done using a timer and the graphics object off the OnDraw event. I got as far as creating the grid, drawing the pieces, moving them around and knowing when lines were completed, etc. Still had a lot to do but it was a proof of concept more than anything else.
I'm just a normal application developer and develop form based applications and back end stuff. If I can get to where I am with my effort in the time I have, then someone who knows how to write games properly could easily do something really good.
Click to expand...
Click to collapse
Ah, that sounds great! Got any plans on continuation of your work? Onscreen buttons instead of accelerometer sounds even better imo, and is easier to do I think..?
Care to share your source? I can have a look at it myself and see if I can get into Mobil application programming too... or at least someone else here can continue on your base work.
I do plan on finishing it at some point - though I'm not 100% sure when! I don't mind sharing the code anyway, so once I'm back home I'll try and remember to put it on here.
Swoop2 said:
I do plan on finishing it at some point - though I'm not 100% sure when! I don't mind sharing the code anyway, so once I'm back home I'll try and remember to put it on here.
Click to expand...
Click to collapse
Sounds cool. Looks like I might get a good weekend after all! Do... not... forget... the... add... the source code!
Here's the source code. It is VERY much a work in progress. I started it as a windows application and ported it over to WinMob6. Here's a list of things that I know I still needed to do:
1. Optimise the graphics to get rid of the irritating flicker.
2. Add the piece rotation.
3. Add the score and level display, etc.
4. Decide on the size of the grid (considered leaving it customisable).
5. Add score saving and option saving, etc.
6. Add some backing music.
They're the things I can remember off the top of my head anyway. Lemme know if you have any ideas or questions, etc.
Swoop2 said:
Here's the source code. It is VERY much a work in progress. I started it as a windows application and ported it over to WinMob6. Here's a list of things that I know I still needed to do:
1. Optimise the graphics to get rid of the irritating flicker.
2. Add the piece rotation.
3. Add the score and level display, etc.
4. Decide on the size of the grid (considered leaving it customisable).
5. Add score saving and option saving, etc.
6. Add some backing music.
They're the things I can remember off the top of my head anyway. Lemme know if you have any ideas or questions, etc.
Click to expand...
Click to collapse
Sweet! I'm at home now, downloading all the requried applications to put up a proper environment here... big packages, so it'll take a while until I'm set.
I'll see if I can manage to do anything, and in case - I'll get back to you
Hi there again Swoop2!
Just tweaked the grid some, added some stats + onscreen buttons (stretched until later ;P) and changed some minor stuff. Here's my latest source. Thanks for sharing!
There's still bunch of stuff to tweak and add. Adding rotation to the game would make it fairly playable. The screen flickering is quite annoying, but perhaps we'll manage to get it working right in the future
Also adding a screenshot of how it looks with the current source.
EDIT: removed the source code, since there's a newer one out there.
Hi Sibbor
That's looking pretty good mate - I like it! I already have some ideas on how to fix the flicker - for the majority of the time anyway. Rendering the image as a bitmap in the background and then just drawing that should hopefully work like a double buffer or something. Also, only invalidating the relevant part of the screen instead of all of it should make a difference too. It worked for my other application anyway.
I'll try and have a play with it this week and send you an update
Swoop2 said:
Hi Sibbor
That's looking pretty good mate - I like it! I already have some ideas on how to fix the flicker - for the majority of the time anyway. Rendering the image as a bitmap in the background and then just drawing that should hopefully work like a double buffer or something. Also, only invalidating the relevant part of the screen instead of all of it should make a difference too. It worked for my other application anyway.
I'll try and have a play with it this week and send you an update
Click to expand...
Click to collapse
Sounds great! Made a few more changes but haven't got the latest source available here at work. I'll see if I can get time to upload it later. Otherwise it doesn't matter too much.
I reacted at the code where the grid updates, but have too less experience with WM6 and .NET to actually optimize this to a grade where we'll have no flicker at all. So with other words: I'm looking forward to your anti-flicker code !
I should finally have some time to look at this at the weekend so if you have an updated version can you post it on here?
Swoop2 said:
I should finally have some time to look at this at the weekend so if you have an updated version can you post it on here?
Click to expand...
Click to collapse
Hi again mate! Good to hear. Sadly I haven't been able to get too much done since last time, but I'll attach the current source now.
Thought about the rotation and how to create it. Had an idea where you could destroy the current piece when rotating, and creating a new - rotated - piece at the given location. You got any ideas about it otherwise?
I've been looking for a decent Tetris game for Diamond/TP myself.
Question: are you planning on implementing the scrollwheel to move the pieces? I think that would be a nice touch.
Good luck on this. I'll donate to the cause when you guys have something.
hefman said:
I've been looking for a decent Tetris game for Diamond/TP myself.
Question: are you planning on implementing the scrollwheel to move the pieces? I think that would be a nice touch.
Good luck on this. I'll donate to the cause when you guys have something.
Click to expand...
Click to collapse
The requested function is already supported We'll make sure to setup donations when we're ready
this is definately a worth while project, i wasted my time for about 3 hours looking for a nice tetris game 4-5 days ago and came up with very nasty looking basic tetris clones.
which all sucked, id donate £5-7 just for saving me the time!!
thanks
CDMA Tetris
I am so all about Tetris.
I also spent some time looking for some decent versions of Tetris but they all flopped.
I cannot wait till you guys complete this.

[Q] Good Android layout creator

Hey, i created an Android card game and i got the coding part nailed down, but the layout part i'm still trying to improve, the current layout seems unprofessional (and the layout creator that comes with the SDK kinda sucks), is there some way to make a great looking layout for my app? Any tricks for the Layout Creator of the SDK or any other tools?
My app is this: https://play.google.com/store/apps/details?id=com.rtt3ch.suecaonline
DarknessWarrior said:
Hey, i created an Android card game and i got the coding part nailed down, but the layout part i'm still trying to improve, the current layout seems unprofessional (and the layout creator that comes with the SDK kinda sucks), is there some way to make a great looking layout for my app? Any tricks for the Layout Creator of the SDK or any other tools?
My app is this: https://play.google.com/store/apps/details?id=com.rtt3ch.suecaonline
Click to expand...
Click to collapse
There are no good wyswig layout editor IMHO, for example, the eclipse graphical editor should be used more like a way to get a quick sneak-peak at what the xml code you're writing will look like than a way to actually generate the UI.
I can recommend some resources that really helped me improve the UI of my app :
Read the Design Guidelines thoroughly, once you're done reading, read them again^^ : http://developer.android.com/design/index.html
watch some Android Design in Action videos, gives a lot of inspiration, and there might be an episode specifically about your app's purpose (it's a weekly show held by Google engineers Roman Nurik, Adam Kosh & Nick Butcher, working on the Android Team, and they often do redesigns of existing apps or treat a specific type of app and the design it should have) : http://www.youtube.com/watch?v=2....
Take a look at the great open source custom views & libraries showcased on : http://androidviews.net
Use the Android Assets Studio to generate custom icons, 9patchs, framed screenshots etc... : http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
Use the Action Bar Style Generator to create a custom action bar theme that suits your branding/color palette : http://jgilfelt.github.io/android-actionbarstylegenerator/
Use the Holo Colors generator to get all the Holo-compliant variants of a defined color (i.e : for button states - pressed/selected) : http://android-holo-colors.com/
Watch some Dev.Bytes videos, they are short and straight to the point, and always about implementing some custom animations and effects to jazz-up your app (again, held by Chet Haase & Nick Butcher, engineers at Google) : http://www.youtube.com/watch?v=XNF...
Take a look at Cyril Mottier's blog : http://cyrilmottier.com/
Nadav Fima's blog : http://nadavfima.com/
Join the Android Design community on Google+, ask for advice & show your designs/mock-ups to get feedback : https://plus.google.com/communities/113499773637471211070
Hope that gets you going, good luck
Android layout is the bane of my existence. Especially when you're trying to get things to work across 10 inch, 7 inch tablets and phone screens.
A lot of the time things just don't work like you'd expect them to. Practice a lot, google a lot and you'll build up your own bag of tricks to handle things, like using empty frame layout to pad things and when to (and when NOT to) use layout weights and layout margins.
Don't trust the software preview in the IDE, or even the simulator. Always test on actual devices and try to test on as many devices as you can.
Wish I could be of more help, but android's layout is a *****.

[Q] Screen View - Java ADT Eclipse

Hello, I am developing my very first app using the latest Android bundle (SDK + Eclipse included). I also installed LibGDx since it will be a game. Upon following some tutorials online it dawned on me, how the hell can I SEE what I'm doing? Meaning I have no room/screen view. So when I render an object onto the screen I just have to wing it when it comes to where it should start on the screen. This is obviously not a good way to make games, its kinda tedious. Precise placement of objects as in "Angry Birds" will be very hard. I'm well aware of emulation but that only shows things after the fact. There has to be a way to do it, maybe a plugin or something? Being able to drag/drop and interact with objects on this screen w/out code would also help a lot. Much thanks!
Eclipse shows the layouts at runtime. You don't have to run it on the emulator each time to manage layouts. Double click on the layout file and it will open in a side view. At the bottom, there will be 2 options, viz Layout.xml and Graphical Layout. Choose Graphical Layout.
EatHeat said:
Eclipse shows the layouts at runtime. You don't have to run it on the emulator each time to manage layouts. Double click on the layout file and it will open in a side view. At the bottom, there will be 2 options, viz Layout.xml and Graphical Layout. Choose Graphical Layout.
Click to expand...
Click to collapse
Thanks for replying, but I should've mentioned that I'm aware of this. This view only shows things I drag and drop onto from the same window. It doesn't show anything rendered in the code from other classes. So anything important like the main characters aren't there. Is there perhaps some way to make them show up in here?
Android3000 said:
Thanks for replying, but I should've mentioned that I'm aware of this. This view only shows things I drag and drop onto from the same window. It doesn't show anything rendered in the code from other classes. So anything important like the main characters aren't there. Is there perhaps some way to make them show up in here?
Click to expand...
Click to collapse
Layouts managed by code isn't showed. Only the xml layouts are show up.
EatHeat said:
Layouts managed by code isn't showed. Only the xml layouts are show up.
Click to expand...
Click to collapse
This is what bothers me. How in the world am I suppose to develop complex levels and what not without being able to see placement of things live? I can't imagine trying to make angry birds or something like that by only having coordinates and no visuals. So there isn't any add-on or plugin that can provide such capabilities?
There isn't any official visual level editor by LibGDX.
But maybe you find an Editor that saves your level in xml or sth. and you can parse that xml in ur LibGDX-App. I wrote my own Level-Editor specially for my LibGDX-Game and it wasn't so hard to code.
Regards
Android3000 said:
This is what bothers me. How in the world am I suppose to develop complex levels and what not without being able to see placement of things live? I can't imagine trying to make angry birds or something like that by only having coordinates and no visuals. So there isn't any add-on or plugin that can provide such capabilities?
Click to expand...
Click to collapse
Not that I know of. You can just create the whole layout in xml to get it correct first. Then use those coordinates in your code accordingly.
Apparently various types of 3rd party apps do exist for this task . Thanks for the help guys.
just try another game engine

[Q] Advice regarding optimizing app performance since it consists of lots of views.

Hey guys, I'm an amateur at android development and this is my first app. I'm trying to make an app which you could basically think of like a book. It will consist of verses from a certain scripture one verse per screen, the screen will have the verse in it's original language "sanskrit", and these three things: 1 it's meaning in english, 2. it's meaning in hindi, and 3. the word meaning of each of the sanskrit words in hindi and english. I want these three things inside a tabhost.
Now the scripture has like 500 verses divided into 18 chapters. Each verse is like 10 words long. So there will be like 500 different views (if that's the right word for it... what I mean is 500 "screens" if that makes any sense) What I've done till now is, I made a sliding drawer that would take you to one of the 18 chapters. Now choosing one of the chapters will take you to a fragment, in which there will be a viewflipper, and it will consist of the verses in that chapter and a title page for that chapter which will consist of links to each of the verses. (I've done everything upto here there's just one sample chapter and 2 sample verses and it works fine) Also in the actionbar there will be a dropdown menu kind of thing clicking on which will give a list of verse numbers, and you can navigate to any verse from there. (I haven't done that yet)
So the thing is, 500 verses, 500 "views" (if i'm using that correctly) I don't know if that will make the device slow or what. I wanted to know am I using the right tools for it? Like the sliding drawer, fragment, tabhost, viewflipper? And the way I've structured the app, what do you feel about that? Will doing it differently could make it faster? I haven't had any problem yet with 1 chapter and 2 verses, I'm going to try adding a bunch of sample chapter and verses and see how it affects the performance. Still I just wanted to know ahead of time if I'm making any huge mistake in using one of the tools that I'm using.
I'd really really really appreciate if someone would take his/her time and give some valuable advice. Thanks in advance.
EDIT: So initially I was planning to have minSdkVersion = "11" and targetSdkVersion = "21", but if that would be impossible due to the large number of verses, I might reconsider that. And I'm using Eclipse to code, and AVD (Android Virtual device) manager to test the app.
EDIT: Also, using maybe sqlite to get the verses (I've just heard a bit about it never used it), would that help?
I'm just replying because I would like to know the same thing...
It shouldn't make your app slow if you're managing View's lifecycle properly. Basically you need to make sure that you're reusing views instead of creating new ones, same thing for Fragments (take a look at android.support.v4.app.FragmentStatePagerAdapter).
surlac said:
It shouldn't make your app slow if you're managing View's lifecycle properly. Basically you need to make sure that you're reusing views instead of creating new ones, same thing for Fragments (take a look at android.support.v4.app.FragmentStatePagerAdapter).
Click to expand...
Click to collapse
Okay so you mean when one navigates to a view it should not create a new view but it should reuse the existing ones? I actually made the sliding drawer (which navigates to the chapters) from a tutorial titled "android sliding menu using navigation drawer" (can't post links since me a newbie here ), I hope they managed View's lifecycle properly. And I'm using ViewFlipper to navigate between verses in individual chapters. So I hope that would be okay.
And I haven't used Sqlite but I vaguely know what it does. Will using that to extract the verses from a database then displaying them be of any help? Would it make the app any faster?
Thanks a lot for your help man, really appreciate it. :good::good:
kumar935 said:
So I hope that would be okay.
Click to expand...
Click to collapse
Just give it a try, man. You will never know till you have it tried. Implement, test, improve. Don't be a victim of premature optimization . Good luck!

[Library] BobEngine - Easy to use 2D game engine for Android

Hello, XDA!
I have created my own 2D game engine that utilizes OpenGL and sports many features to help make programming 2D games for Android as quick and simple as possible. I created this engine for use in my own projects but then I thought why no make it open-source? I think other people could benefit from this and input from other developers could help fine tune this thing so it's as good as it can be.
So I gave my engine the name "BobEngine" after my online alias and uploaded the first public release called "BobEngine 1.0 Thingama" to GitHub. That was months ago and now I've finished working on the next update: BobEngine 2.0 Shishka.
I've got a post on my website detailing what's new in update: http://www.bobbyloujo.com/2015/01/bobengine-20-shishka-update.html
BobEngine uses a similar structure to GameMaker games so if you've ever used that you may be interested in BobEngine. BobEngine uses a specialized BobView to display the content of Rooms. Rooms are collections of GameObjects which each have a graphic and attributes such as x and y positions, width, height, angle, frame, etc... Rooms and GameObjects also have step, newpress, and released events built in. The step event happens each frame, the newpress event happens when a new pointer is touched on the screen, and the released event happens when a pointer is lifted from the screen.
There are many other tools included with BobEngine and the best way to start learning how to use them is have a look at the examples that are included! In the GitHub repository you'll find an Android Studio project called "BobEngine". This project contains the "bobEngine" library module that you'll need to include in your own projects if you want to use BobEngine. Also in the BobEngine project are modules for each of the included examples. Currently there are examples that demonstrate the structure of a BobEngine game, how to use input from the touch screen, and how to manipulate the camera. I'll be creating more examples in the future to show off all the things you can do with this engine!
All the methods and data members in BobEngine are internally documented and the examples include a lot of internal documentation to help you out as well.
I'll keep updating the library with new things as I think of them. If there is anything you think should be added go ahead and post about it in this thread.
Benjamin Blaszczak
a.k.a. Bobby Lou Jo
@Bobbyloujo on Twitter
Edit: Forgot the GitHub link: https://github.com/Bobbyloujo/BobEngine
@Bobbyloujo
Thanks man will try this today and welcome 2 xda :highfive:
Thanks sir...pls give us some game template made from your lib
Great job man. It looks great.
I will try as soon as possible
Sylvain
Thanks man. Will surely try it out. good work.
Awesome, just what I've been looking for. Thanks!
nice work, and thanks for putting your time and effort into it.
Could this be used to recreate "biomenace" for android?
Thanks everyone!
@berlyshells Anything you want to see in particular? I could probably throw together a Flappy Bird clone real quick or something...
@verbuyst It certainly looks doable if you put the time and effort into it.
Bobbyloujo said:
..
Click to expand...
Click to collapse
im not really looking for anything in particular..probably any game source with comments (of the functions/what for is this code etc..) inside the code would be nice haha i just requesting but its you're choice sir im sorry im just a newbie
TIA
A new example has been added to the repository per @berlyshells request. This example is called Jumpy Bug and it is a Flappy Bird clone. It demonstrates what a full game programmed with BobEngine looks like.
Bobbyloujo said:
....
Click to expand...
Click to collapse
thank you very much sir..you are indeed a good hearted person..this is what i really love on xda
While working on my most recent project I made a few changes to BobEngine. The changes have been uploaded to GitHub.
Changes:
The extra functionality provided by BobActivity has been moved to a new class - BobHelper. A BobHelper can be used by any activity. When using a BobHelper, be sure to call its onResume() method from your activity's onResume() method. BobActivity still functions the same way it did before. BobHelper is useful for when you want to use some other kind of activity has your application's main activity but still want the extra functions from BobActivity. For example, if you want to use BaseGameActivity from the BaseGameUtils library for Google Play services.
SplashActivity has been totally changed because, frankly, it sucked before It is now an abstract class. Create your own activity for showing splash screens and extend SplashActivity. Implement the setup() and end() methods. In the setup() method, call addSplash(R.layout.your_splash_layout, time_in_ms) to add a splash screen to show as defined by an xml layout. You can add up to 10 layouts. Add them in the order you want them to show. The end() method is called after the last splash screen has been shown. In the end() method, start an intent for your main activity and then call finish() to close the splash screen activity.
Other small changes.
How many games have made using library? Looks cool)
Thanks..I tried AndEngine and it failed to import on my Android Studio.
Marshal3 said:
How many games have made using library? Looks cool)
Click to expand...
Click to collapse
Uhm... about three. There's Plane Popper, Crazy Taxi Driver, and I just finished Bounce the Beach Ball. Other than that, I've made a few examples that you can find in the repository - including a Flappy Bird clone. Also, I've been working on a platformer.
basil2style said:
Thanks..I tried AndEngine and it failed to import on my Android Studio.
Click to expand...
Click to collapse
Let me know if you need any help with BobEngine!
Hello again, XDA!
I've updated BobEngine again. This update brings the following major additions:
Gamepad support! You can now get input from any standard gamepad using BobEngine. A new example has been added to the Android Studio project that shows and explains how to use this new gamepad support. The example is called controllerexample.
Multiple quads per GameObject. Up until now, a GameObject consisted of a single textured quad (well, two triangles that form a quad). Sometimes it is useful to have many quads grouped together. If you use this, note that all the quads for each GameObject must have the same graphic. This is a very niche feature that I added for a particular purpose but didn't end up using myself. If you'd like an example of what can be done with this, let me know and I'll make one.
Some other miscellaneous stuff has been changed as well. It's been so long since I posted an update that I forget everything I changed! One useful change I made was to the camera features. Rooms now have their own camera values, meaning if you change the camera in one room, then switch to another and change the camera there, then switch back to the first room the camera will be where you left it in the first room.
BobEngine can of course still be found here on GitHub: https://github.com/Bobbyloujo/BobEngine
Here's a video showing off gamepad support: https://youtu.be/vRdaaaJnqGk
As always, if you have any questions feel free to ask. Also, if you've made anything with BobEngine I would love to see it! Whether it's something big or something small I'd love to see how others have used my engine
If you haven't already, please follow me on Twitter. My handle is @Bobbyloujo and I post updates about the games and things I'm working on there pretty frequently. Right now I'm working on something pretty big!
Another new update today!
Changes:
* TextDisplay object added! TextDisplay is a GameObject that can be used to output text! Text can be centered, aligned left or right. A new example has been added to show how this new object can be used.
* A new 'visible' attribute has been added to GameObjects. Setting gameObject.visible to false will cause the object to be hidden so it isn't drawn.
* The getAngle() function in Room.java was broken. It has been fixed so now getAngle() and getAngleBetween() both work properly.
* The getRatioX() and getRatioY() functions sometimes would not work properly on some devices. This has been fixed.
* When using multiple quads per GameObject, the performance has been increased. This was done by collecting vertex data from the quads in a way that does not require the concatenation of many arrays.
As always, the repository can be found here: https://github.com/Bobbyloujo/BobEngine
It'll really help me out if you follow me on Twitter: https://twitter.com/Bobbyloujo
And like my Facebook page: https://www.facebook.com/BobbyLouJo
If you have any questions or would like to report a bug, please leave a message in this thread or PM me on XDA, Twitter, or Facebook.
Have a great week!!
Version 3.0 Bobsled
It's been a while, but in the time since my last update I've added a lot of new things to BobEngine. Since it's such a big update, I'm giving it a new version name: v3.0 Bobsled. Here goes:
RoomCache - In BobView.java you will find a new static class called RoomCache. As the name implies, RoomCache is used for storing and retrieving instances of Rooms. The nice thing about RoomCache is that you can call getRoom(Class roomType) with any class type that inherits Room and the function will return an instance of that room type, even if you haven't manually added a Room of that type to the cache. The function getRoom(...) will search the cache for an instance of roomType and return it if one is found OR it will create a new instance of roomType using reflection and return that. You'll also notice that there is a getRoom(Class roomType, Object... args) function. If you have created a room type that takes parameters other than (BobView view) like a default Room does, you can use this method to pass the required arguments to initialize a new instance of that room type if need be. The cache holds a specified max number of Rooms. When the cache is full and a new Room is added, the oldest Room is removed. You can make your own RoomCaches, but each BobView has it's own cache with an initial size of 3. To access it from your BobView, just call getRoomCache().
Along with RoomCache, BobView has received two new goToRoom overrides: goToRoom(Class roomType) and goToRoom(Class roomType, Object... args) for switching to rooms retrieved from the RoomCache.
Input events (newpress, released) are now handled on the main thread (same thread as step event). Handling game logic on the separate input thread was causing a lot strange glitches in my games when values were being changed when I was not expecting them to be changed. Now, input will be handled on the same thread just before the step event.
For even more convenience and even quicker game development, a new constructor has been added to GameObject: GameObject(Room room). This will automatically assign an instance ID number AND add the object to the room. What typically looked like this before:
Code:
GameObject object = new GameObject(room.nextInstance(), room);
room.addObject(object);
Now looks like this:
Code:
GameObject object = new GameObject(room);
So simple! The old constructor is still there and behaves the same way for those who want it and for backwards compatibility.
Setting GameObject.visible to false will now hide all Quads belonging to that GameObject. This will not change the Quad.visible field for any Quad. Also, similarly to GameObject, Quads are now added to the GameObject when initialized.
Animations can now be played once and looped for a limited number of times. animationFinished() will return true when an animation has finished playing.
Animation class - a new class has been added to GameObject.java. This class can be used to predefine animations with a start frame, end frame, fps, and loop times.
Previously, I was using 3 coordinates for each vertex. I learned it's possible to use only 2 in OpenGL. Since the 3rd vertex is not needed, I changed the code to use only 2 vertices. I'm not sure if this actually caused any performance improvement.
Graphic.Parameters class - A new class in Graphic.java allows you to predefine Graphic parameters to use with GameObject.setGraphic(Graphic.Parameters params). Useful for when you want to switch between graphics on a GameObject often.
A new method in the Graphic class called setDimensions(int width, int height) allows you to set the height and width of the DPI level image you want to use for setGraphic(Graphic g, int x, int y...). Previously, you would have to use setPreciseGraphic(...) if you had different sized images for different DPI levels that have multiple graphics on them.
Set the color intensity of all GameObjects on a specific layer using Room.setLayerColor(int layer, float r, float g, float b, float a).
Graphics management (this is a big one):
The Room, Graphic, and GraphicsHelper classes have been updated to improve and simplify management of graphics for large games. A new GraphicsHelper.cleanUp() method makes it easy to manage graphics. You can choose points in your game to call cleanUp(). When called, Graphics that have not been used recently will be unloaded and removed from the GraphicsHelper. Graphics have a new public field called 'persistent' which when set to true will cause the graphic to remain loaded when cleanUp() is called. All non-persistent Graphics will survive through a set number of cleanUp() calls before they are removed. If a Graphic is removed but then a GameObject tries to use it again, it will automatically be re-added to the GraphicsHelper and reloaded.
You can also manually call:
Graphic.load() to load a graphic after is has been added to the GraphicsHelper.
Graphic.unload() to unload a graphic
Graphic.remove() OR GraphicsHelper.removeGraphic(Graphic g) to unload and remove a Graphic from the GraphicsHelper.
OKAY, I think that's just about everything. I actually had to look through the changes in the GitHub commit to remember all the things I've changed xD There are a few other small changes but I didn't think they were important enough to list. Now I want to ask you guys something:
Is there any interest in a full-blown tutorial series for BobEngine?
I could start with the basics, then explain more advanced features like graphics management. I could also take requests for certain tutorials. I could even cover general game development topics and how to implement them with BobEngine. Doing this would be a lot of work so before I dive in I really want to gauge the level of interest in BobEngine. So far, it's been difficult to tell how many people are interested because I haven't gotten an overwhelming amount of replies here but every once in a while I get a PM or email asking for help. So if you're using BobEngine raise your hand!
And of course: if you've made anything with BobEngine I would love to see it! I've seen a few things and it makes me happy to see you guys using getting some use out of my engine.
Thanks for your time! If you have any questions, just ask. You find any issues with BobEngine, post them here or on GitHub and will fix them. Also don't forget to let me know if you're using BobEngine!
Once again, the repo can be found here: https://github.com/Bobbyloujo/BobEngine
Thanks again,
Ben a.k.a. Bobby Lou Jo
Twitter: https://twitter.com/Bobbyloujo
Facebook: https://www.facebook.com/BobbyLouJo
you are great and i should more from you
I am a new man in the electronic area, and you have developed your own staff, you set a good example for me.
Jackiefire said:
I am a new man in the electronic area, and you have developed your own staff, you set a good example for me.
Click to expand...
Click to collapse
Thanks! Your support means a lot.

Categories

Resources