Главная » Просмотр файлов » Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008

Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (779888), страница 27

Файл №779888 Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (Symbian Books) 27 страницаWiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (779888) страница 272018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 27)

The example above can easily be extended to pre-loada list of bitmaps and call the handler for each image (in order to updatea progress bar) and then make a final callback when the whole batchoperation is complete.Once the ICL has delivered a CFbsBitmap, it can be used like anyother MBM: copied to the screen, scaled, rotated, used as a mask, or evensupplied as a texture to OpenGL ES.3.9.3 Techniques for Using Tiles and Animation FramesTiles and animation frames can be implemented using multi-image formats such as MBM or GIF. But it’s also possible to store multiple tiles in asingle image and copy a section of decoded image using the BitBlt()overload which takes a source rectangle. Figure 3.17 shows how the gametiles can be stored in a flat bitmap and assembled into a game screen,and the code fragment below illustrates how the bitmap in Figure 3.17could be used to copy part of a bitmap to the graphics context.

It blits tiletileNumberToDraw to the destination graphics context.// set a rectangle for the top-left quadrant of the source bitmapconst TInt KTileWidthInPixels = 16;const TInt KTileHeightInPixels = 16;const TInt KNumTilesPerRow = 4;TInt x = (tileNumberToDraw % KNumTilesPerRow) * KTileWidthInPixels;TInt y = (tileNumberToDraw / KNumTilesPerRow) * KTileHeightInPixels;TRect sourcRect(TPoint(x,y),TSize(KTileWidthInPixels, KTileHeightInPixels));TPoint pos(100,100); // destinationgc.BitBlt(pos, bitmap, sourcRect);56Game Tiles7412228122212345678Figure 3.17 Using tiles to draw a game screenSCALING FOR VARIABLE SCREEN SIZES AND RESOLUTIONS1053.10 Scaling for Variable Screen Sizes and ResolutionsDeveloping a scalable application is a difficult task since it requiressome thought about layout geometries and performance variances ofa set of devices.

Another problem is that a different screen size addsanother permutation to test. For certain games, a different screen sizecan completely change the dynamics, for instance, if a sideways scrollingshooter designed for a QVGA screen attempts to be dynamic and makeuse of the extra width of an E90 communicator, then the amount ofscenery rendered would increase, allowing the user to see much furtherahead in the game, perhaps causing a frame rate drop in the game.There are many ways of designing games which are scalable, forexample:• plan the layout so it can make use of the extra space• use technologies such as FlashLite and OpenGL ES, which are veryattractive when targeting multiple devices, since not only will the 3Drendering be optimized in hardware, but OpenGL ES by its nature canbe scaled to any size7• render images to a fixed sized bitmap and scale the bitmap to fill thescreen.Both UIQ 3 and S60 3rd Edition have introduced methods for scalinggraphics and making the handling of changes to the screen orientationeasier.3.10.1 Standard Screen ResolutionsIt’s worth noting that a large pixel resolution may not correspond toa larger physical screen size, it may simply represent a screen withfiner pixels.

Or, conversely, when comparing two handsets, screens thathave different physical screen dimensions may still have the same pixelresolution.S60 3rd Edition and UIQ 3 have both defined a standard set of screenresolutions supported (and tested) by the respective UI platform (thoughsome specific devices such as the letterbox screen E90 deviate from theplatform).S60 3rd Edition supports two orientations – landscape and portrait –and a number of resolutions: 176 × 208 (legacy resolution, used in S602nd Edition), 240 × 320 (QVGA), and 352 × 416 (double resolution). Inlandscape mode, the soft keys might be located on any side of the display.7However, OpenGL ES textures may start to degrade in quality if scaled too large.106GRAPHICS ON SYMBIAN OSUIQ has a more complex matrix of screen configurations based on thepresence of absence of touch support, screen orientation and whether theflip (if supported) is open or closed.

These are shown in Table 3.4.Table 3.4 UIQ 3 styles and specificationsConfigurationScreenresolutionInteractionstyleTouchscreenOrientationSoftkeystyle240 × 320Soft keysNoPortraitSoftkeystyle touch240 × 320Soft keysYesPortraitPen stylelandscape320 × 240Menu barYesLandscapePen style240 × 320Menu barYesPortraitSoftkeystyle small240 × 256Soft keysNoPortrait,small3.10.2 SVG-TBitmap formats such as MBMs are suitable for photographic images andsimple icons, but tend to look jaggy when scaled either up or down. Highcontrast edges, in particular, deteriorate when scaled down.

Vector-basedgraphics such as Flash and SVG can be scaled and rotated without lossof quality. The geometric shapes and fills which make up the graphicsare recalculated and then rasterized as needed. Vector-based renderingalso deals effectively with the problem of screen rotation on a non-squarepixel display.The benefits of SVG over MBMs can be seen clearly in Figure 3.18,where the single shape definition has been drawn with anti-aliasing atseveral sizes without deteriorating quality.S60 has supported SVG icons since S60 2.8 and UIQ introduced SVGicon for applications in UIQ 3.1.

In S60, SVG icons are created by usingthe Carbide.c++ IDE, which produces MIF files (an S60-specific wayof wrapping up SVG icons). Further information can be found in theCarbide.c++ help files.8Within an S60 application, SVG icons can be loaded using the AknIconUtils utility which returns a CFbsBitmap of the rendered SVG,which can be used with the usual graphics context functions. Calling8More information about the Carbide.c++ IDE can be found at www.forum.nokia.com/carbide.SCALING FOR VARIABLE SCREEN SIZES AND RESOLUTIONSFigure 3.18107The Roids application icon as previewed in the SVG editor InkscapeAknIconUtils::SetSize() on the bitmap causes SVG icons to berendered at the new size.93.10.3 Dealing with Screen Orientation ChangesScreen orientation is usually discussed and specified in terms of landscapeand portrait.

When a system orientation change occurs, a lot of processinghappens. All applications are notified of the new orientation, and eachapplication may try to recalculate its view and scale icons and controls.After a layout switch occurs, the cursor keys may behave differently, forexample, a switch to landscape would result in the up cursor key nowgenerating a right cursor key event.3.10.4 Explicitly Setting the OrientationA game will usually be designed explicitly for landscape or portrait.

Somehandsets may have hardware designs optimized for playing games inlandscape mode. Luckily a game doesn’t have to adapt to the currentorientation, it can explicitly set its mode – forcing an orientation changeeach time the game is brought to the foreground. The code required toset the orientation explicitly on S60 3rd Edition and UIQ 3 is as follows.9More information about using SVG-T on S60 can be found in the document titled S60Platform: Scalable Screen-Drawing How-To which is best accessed by searching on themain Forum Nokia website at www.forum.nokia.com. If you’re confident of your typing,you can navigate directly to the document at www.forum.nokia.com/info/sw.nokia.com/id/8bb62d7d-fc95-4ceb-8796-a1fb0452d8dd/S60 Platform Scalable Screen-DrawingHow-To v1 0 en.pdf.html.108GRAPHICS ON SYMBIAN OSSetting the Orientation in S60 3rd EditionWhen AppUi()->SetOrientationL() is called explicitly, it overrides any orientation presently in use by the rest of the phone.void CMyS60App::RotateMe(){// Changing from portrait to landscape or vice versa.iIsPortrait = !iIsPortrait;// Change the screen orientation.if (iIsPortrait){AppUi()->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);}else{AppUi()->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);}}Setting the Orientation in UIQ 3UIQ 3 works differently to S60 3rd Edition when dealing with orientation.UIQ is much more view oriented, and an application can define aseparate view resource for each screen mode listed in section 3.10.1.The following code shows how the orientation can be explicitly set bythe application.

This in turn selects the most appropriate view defined inthe application resource file. Further information is available in the UIQSDK documentation and from the UIQ Developer Community.10void CMyUiqApp::SwapPortLand(){TQikUiConfig config = CQUiConfigClient::Static().CurrentConfig();TQikViewMode viewMode;if(config == KQikPenStyleTouchLandscape){if( iWantFullScreen )viewMode.SetFullscreen();elseviewMode.SetNormal();CQUiConfigClient::Static().SetCurrentConfigL(KQikSoftkeyStyleTouchPortrait);}else if(config == KQikSoftkeyStyleTouchPortrait){10There is a good discussion about how to detect changes of UI configuration at developer.uiq.com/forum/kbclick.jspa?categoryID=16&externalID=101&searchID=143583 (orsearch for ‘How can I detect changes of UI configuration?’) from the main site (developer.uiq.com).SCALING FOR VARIABLE SCREEN SIZES AND RESOLUTIONS109viewMode.SetFullscreen();CQUiConfigClient::Static().SetCurrentConfigL(KQikPenStyleTouchLandscape);}iBaseView->SetMyViewMode(viewMode);}}3.10.5 Detecting a Layout ChangeCertain types of game may need to adjust to screen size and portrait/landscape changes.

The change comes as a notification messagewhich individual controls or views can handle.Detecting a Layout Change on S60 3rd EditionApplications can respond to changes in screen size and layout by overriding the CCoeControl::HandleResourceChange() method anddetecting the KEikDynamicLayoutVariantSwitch message.The code below shows how a full screen control with a DSA drawingengine may deal with a screen rotation. The extent of the control is resetto fill the screen in the new orientation.void CMyScalableDrawingControl::HandleResourceChange(TInt aType){CCoeControl::HandleResourceChange(aType);if(aType == KEikDynamicLayoutVariantSwitch){iMyScalableEngine->Rescale();SetExtentToWholeScreen();}}Detecting a Layout Change on UIQ 3Again UIQ deals with layout changes as screen configuration changesrather than a simple landscape/portrait flag.

Характеристики

Тип файла
PDF-файл
Размер
2,71 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6455
Авторов
на СтудИзбе
305
Средний доход
с одного платного файла
Обучение Подробнее