Sponsored Content
Operating Systems Linux Android Basic Android platform information. Post 302851171 by Neo on Saturday 7th of September 2013 08:45:49 AM
Old 09-07-2013
Fantastic!

I look forward to your tutorial on this for everyone.

Who knows, maybe you will inspire others here to become Android programmers and they will create a nice app...

Don't let anyone discourage you, please.

Go for your dreams... never stop learning ... enjoy the fact you are motivated to do it
 

5 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Basic information please.

Good day all. I was glad to find this site. I am not new to computing as I have been in the field sense 1986 but my experience has almost all been with Windows systems. I garbed a book and managed to get a UNIX box running FreeBSD for my mail server and I'm serving 3 web sites off of two Win-98... (2 Replies)
Discussion started by: Sleeper =RG=
2 Replies

2. Android

Android is Linux (and Java)

In case you did not know, Android 2.1, Éclair, runs on the 2.6.29 Linux kernel. However, the user space it is built atop Dalvik, a Google-designed custom JVM (Java virtual machine). This is pretty interesting, when you think about it. The core of Android is the linux kernel, and the standard... (5 Replies)
Discussion started by: Neo
5 Replies

3. Android

Android Scripting Environment: Shell Scripting and Android

I just upgraded to Android 2.2 from 2.1. The GPS issue that was troublesome in 2.1 seems to have been fixed. Some of web browsing seems faster, but it could just be my connection is better today ;) Flash works in some browsers but not very good and it is too slow for Flash apps designed for... (0 Replies)
Discussion started by: Neo
0 Replies

4. Android

Basic commands for android!!

Hi, I have a n android phone and just rooted it. I access it using 'terminal Emulator'. I performed many basic linux-like commands in the terminal like rm,ls,df,reboot etc and they are working fine. But many of them are not like man <something>, clear,du etc. Can any of you please help to... (20 Replies)
Discussion started by: shekhar_4_u
20 Replies

5. Android

Security in Android apps

Hi, I am Conrad I was wondering, if anybody would be able to hack accounts on Android apps. I mean for example we are logged on ebay or Facebook app, and we simply quit to home screen, without logging out, and also disconnect from network and again turn on network. -To the point, Is it... (0 Replies)
Discussion started by: kondziorek
0 Replies
SDL::Tutorial::Images(3)				User Contributed Perl Documentation				  SDL::Tutorial::Images(3)

NAME
SDL::Tutorial::Images SYNOPSIS
# to read this tutorial $ perldoc SDL::Tutorial::Images # to create a demo animation program based on this tutorial $ perl -MSDL::Tutorial::Images=sdl_images.pl -e 1 ANIMATING IMAGES
Since you're already familiar with the concepts behind animation, it's time to learn how to work with images. As usual, the important point is that computer animation is just simulating motion by painting several slightly different frames to the screen every second. There are two ways to vary an image on screen. One is to change its coordinates so it's at a slightly different position. This is very easy to do; it's just like animating a rectangle. The other way is to change the image itself so it's slightly different. This is a little more difficult, as you'll need to draw the alternate image beforehand somehow. Loading Images As usual, start with an SDL::App object representing the image window. Then preload the image file. This is easy; just pass the "name" parameter to the SDL::Surface constructor: use SDL::Surface; my $frame = SDL::Surface->new( -name => 'frame1.png' ); Note: you'll need to have compiled SDL Perl (and probably SDL) to support JPEG and PNG files for this to work. That's it; now you have an SDL::Surface object containing the image. You can use the "height()", "width()", and "bpp()" methods to retrieve its height, width, and bits per pixel, if you need them. Displaying Images Drawing an image onto the screen requires blitting it from one surface to another. (Remember, "blitting" means copying bits in memory.) The "blit()" method of SDL::Surface objects comes in handy. Its arguments are a little odd, though. Assuming $app is the SDL::App object, as usual: use SDL::Rect; my $frame_rect = SDL::Rect->new( -height => $frame->height(), -width => $frame->width(), -x => 0, -y => 0, ); my $dest_rect = SDL::Rect->new( -height => $frame->height(), -width => $frame->width(), -x => 0, -y => 0, ); $frame->blit( $frame_rect, $app, $dest_rect ); $app->update( $dest_rect ); Here we have two SDL::Rect objects which represent rectangular regions of a Surface. $frame_rect represents the entire area of $frame, while $dest_rect represents the area of the main window in which to blit the frame. This may be clearer with more descriptive variable names: $source_surface->blit( $area_of_source_to_blit, $destination_surface, $destination_area ); As usual, call "update()" on $app to see the change. Requiring the source and destination Rect objects may seem tedious in this simple example, but it's highly useful for copying only part of surface to part of another. For example, animating this image is a matter of changing the "x" and "y" coordinates of $dest_rect: for my $x ( 1 .. 100 ) { $dest_rect->x( $x ); $frame->blit( $frame_rect, $app, $dest_rect ); $app->update( $dest_rect ); } Of course, you'll have to redraw all or part of the screen to avoid artifacts, as discussed in the previous tutorial. Multi-Image Animation That covers moving a single image around the screen. What if you want something more? For example, what if you want to animate a stick figure walking? You'll need several frames, just as in a flip-book. Each frame should be slightly different than the one before it. It's probably handy to encapsulate all of this in a "Walker" class: package Walker; use SDL::Surface; sub new { my ($class, @images) = @_; my $self = [ map { SDL::Surface->new( -name => $_ ) } @images ]; bless $self, $class; } sub next_frame { my $self = shift; my $frame = shift @$self; push @$self, $frame; return $frame; } To use this class, instantiate an object: my $walker = Walker->new( 'frame1.png', 'frame2.png', 'frame3.png' ); Then call "next_frame()" within the loop: for my $x ( 1 .. 100 ) { my $frame = $walker->next_frame(); $dest_rect->x( $x ); $frame->blit( $frame_rect, $app, $dest_rect ); $app->update( $dest_rect ); } Again, the rest of the frame drawing is missing from this example so as not to distract from this technique. You'll probably want to abstract the undrawing and redrawing into a separate subroutine so you don't have to worry about it every time. It'd be easy to make "next_frame()" much smarter, selecting an image appropriate to the direction of travel, using a bored animation when the character is no longer moving, or adding other characteristics to the character. As you can see, the hard part of this technique is generating the images beforehand. That can add up to a tremendous amount of art and that's one reason for the popularity of 3D models... but that's another tutorial much further down the road. More importantly, it's time to discuss how to make these animations run more smoothly. More on that next time. SEE ALSO
SDL::Tutorial basic SDL tutorial SDL::Tutorial::Animation non-image animation AUTHOR
chromatic, <chromatic@wgz.org> Written for and maintained by the Perl SDL project, <http://sdl.perl.org/>. BUGS
No known bugs. COPYRIGHT
Copyright (c) 2004, chromatic. All rights reserved. This module is distributed under the same terms as Perl itself, in the hope that it is useful but certainly under no guarantee. perl v5.12.1 2010-07-05 SDL::Tutorial::Images(3)
All times are GMT -4. The time now is 10:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy