Re: [Superbackgammon-developer] canvas vs. gamecanvas
Status: Planning
Brought to you by:
ugur_tutar
|
From: Abc T. <ora...@ya...> - 2008-12-11 22:18:08
|
3. gönderişim arıza var galiba listede
çalarcım ya gerçekten bu canvas olayı zurnanın son deliği
1 - en mantıklısı adamlar bunu özellikle oyun yapanlar için çıkarmış birsuru ek özelliği var ve ilerde işimize yarayacağına inanıyorum millet canvastan kurtulduğuna dua ederken biz niye eskiye dönup uğraşalım jdk 1.6 varken 1.4 e göç etmek gibi bişi
2- canvasta yapamak gercekten stabil değil
The GameCanvas class is a subclass of javax.microedition.lcdui.Canvas, but differs in two ways: graphics buffering and the ability to query key states. These features of the GameCanvas class offer you enhanced control to deal with events like keystrokes and screen repainting.
As I mentioned earlier, you'll get smoother animation if you create graphics objects behind the scenes, in a buffer, then update and repaint the screen simply by invoking paint(getGraphics()) and flushGraphics(). If your graphics are simple, you may not notice much difference if you call repaint() and serviceRepaints() instead, but in games with complex graphics, using the GameCanvas methods will make an appreciable difference.
The GameCanvas class makes game programming much easier. You can extend the Canvas class directly to develop your game if you want, but if you do you'll need to implement the Canvas.keyPressed() method, which is called whenever the user presses a button. Errors can arise if the call occurs when multiple threads are doing different things and the code is not properly synchronized. By contrast, if you use GameCanvas you can get the keystroke information whenever you want it, from the getKeyStates() method – and in a more useful form: The keyCode passed to Canvas.keyPressed() gives you information about only a single key, but GameCanvas.getKeyStates() tells you when multiple keys are being pressed simultaneously.
The GameCanvas class simplifies game programming in another way. Instead of spreading the logic across multiple methods running on separate threads, as Canvas does, GameCanvas lets you combine all the game functionality in a single loop, under the control of a single thread. Code Sample 2 is a rewrite of Code Sample 1 that uses GameCanvas, and encloses the game's logic in a single loop:
3- bütün bunlar olmasa dahi okadar kod yazıldı ve hepsi sıfırdan yapmak vakit kaybı.
velhasılkelam bence gamecanvasa dokunmayalım yoksa ben uğraşmam grafikle fln beni başka bi parçaya verin siz yeniden yazarsınız icab edeni benden canvasla devam etmemi beklemeyin.
herkese iyi bayramlar
|