- 浏览: 128711 次
- 性别:
- 来自: 福州
最新评论
-
D_e_人:
兄弟,感觉很不错哦,给个源码学习学习啊。。。不胜感激!~
基于J2EE中小型企业销售系统[毕业设计] -
java-007:
哥们,问你个问题,就是我想把我生成的html格式报表嵌套在别的 ...
BIRT部署并利用API生成PDF -
RogerTu:
这种方式是变相修改BIRT自带的JDBC ODA Driver ...
BIRT 2.2.2 运行时使用已有的java.sql.Connection来生成报表 -
fy_kenny:
是个好文章,哈哈
BIRT Report Engine API -
RogerTu:
通过变相修改BIRT自带的JDBC ODA Driver实现, ...
BIRT 2.2.2 运行时使用已有的java.sql.Connection来生成报表
Report Engine API
- Background
- Installing the Engine
- Configuring JDBC Drivers
- API Overview
- EngineConfig
- ReportEngine
- IReportRunnable
- IReportDocument
- IEngineTask
- IDataExtractionTask
- IGetParameterDefinitionTask
- IRenderTask
- IRunTask
- IRunAndRenderTask
- Miscellaneous
- Emitter Configuration
- BIRT Wiki RE API Examples
Background
The BIRT Report Engine API (RE API) allows you to integrate the run-time part of BIRT into your application. This may mean integrating into a stand alone Java application, deploying as part of a servlet or embedding it within an RCP application. The engine supports the following operations:
- Discover the set of parameters defined for a report.
- Get the default values for parameters.
- Run a report to produce HTML/Paginated HTML, WORD, XLS, PS, or PDF output.
- Fetch an image or chart for a report.
- Export Report data to CSV
- Retrieve TOCs, Bookmarks, etc
The report engine supports extensions for custom report items, data access, and custom output formats. Extensions are discussed elsewhere. This section will focus on how your application integrates with the report engine.
Installing the Engine
The first step is to download, install, and configure the BIRT engine. The engine is more than just a simple JAR file; it also includes a set of extensions (plug-ins), and a set of data drivers.
- First download the Report Engine from the Eclipse download site.
- This file will be named birt-runtime-version.zip.
- Unzip this file into a directory, such as c:\birtruntime.
- When you set the Engine Home, which is explained later, use C:/birtruntime/birt-runtime-version/ReportEngine as the value.
- Add the jars in the ReportEngine/lib directory to your classpath/buildpath.
Note that if you are using the RE API within an RCP/Eclipse application these steps are not needed. Just add the RE API plugins to your application and call the needed functions.
The BIRT Viewer sample is also bundled with the Report Engine download. It is located under the WebViewerExample directory. If you decide to use this example, see Viewer Setup for an explanation. The Viewer uses the RE API to generate reports within the context of a servlet. It provides additional features, such as printing, TOCs, Page controls, etc. Before using the RE API, verify that the Viewer is not applicable to your application.
Engine Source
If you prefer to work directly with the BIRT source code, the Engine API is in the org.eclipse.birt.report.engine project
within Eclipse CVS Eclipse CVS. The source is also available from the BIRT site in one package (the BIRT Source Code Package), which can be downloaded from the download site.
Javadoc
This page provides an overview of the engine. To do actual development, consult the Engine Javadoc. These docs are available within BIRT Help.
Configuring JDBC Drivers
You must configure the engine to include any JDBC drivers that you need.
To do this, copy the driver jar file to the ReportEngineInstall/birt-runtime-version/ReportEngine/plugins/org.eclipse.birt.report.data.oda.jdbc_version/drivers Directory.
API Overview
The following are the key steps to use the API, identifying the classes and interfaces you use for each step.
- Create an instance of
EngineConfig
to set options for the report engine. - Set the Engine Home and start the Platform (Loads the plug-ins). If you are using the RE API in plugin format there is no need to set BIRT Home. If you are using the RE API from within a servlet, be sure to read about PlatformServletContext later on this page.
- Create an instance of the
ReportEngine
class. You can use this object to perform multiple tasks. - Open a report design using one of the
openReport( )
methods ofReportEngine
. - Obtain information about report parameters using
IGetParameterDefinitionTask
. This is only needed if you want to build a custom parameter page or collect parameter definition information. The IRunTask and the IRunAndRenderTask interfaces have methods for setting parameter values. - Run and render a report using
IRunAndRenderReportTask
orIRunTask
andIRenderTask
. - Repeat steps 4-6 for the next report.
- When done, call
shutdown( )
on your engine instance. If using the engine in a servlet shudown the engine when the servlet shuts down.
The following sections describe the primary Engine classes in detail. The Engine API includes a number of secondary helper classes referenced within each description. The diagram below, serves as an overview of the classes needed to accomplish a given task.
EngineConfig
Use the EngineConfig
class to set global options for the report engine as a whole. Use it to specify the location of engine plug-ins, the location of data drivers, and to add application-wide scriptable objects.
> EngineConfig config = new EngineConfig( ); config.setEngineHome( "put engine path here" );
The engine home should be set to installedlocation/birt-runtime-version/ReportEngine when deployed as a stand alone Java Application. See the wiki examples for Servlet and RCP deployment.
Other functions of interest within this class are:
setLogConfig(String directoryName, Level level)
This call sets the Log directory name and level (OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST and ALL)
Setting directoryName to null will log to stdout.
ReportEngine
The ReportEngine
class represents the BIRT Report Engine. There is a significant cost associated with creating an engine instance, due primarily to the cost of loading extensions. Therefore, each application should create just one ReportEngine
instance and use it to run multiple reports. This is important to remember when deploying the engine in a servlet as well.
The report engine is created through a factory supplied by the Platform. Before creating the engine, you should start the Platform, which will load the appropriate plug-ins. This is done by calling Platform.startup(config)
that takes an EngineConfig
object as argument. After using the engine, call Plaform.shutdown()( )
function to do clean up work, which includes unloading the extensions.
try{ final config = new EngineConfig( ); config.setEngineHome( "C:\birt-runtime-2_1_0\birt-runtime-2_1_0\ReportEngine" ); config.setLogConfig(c:/temp, Level.FINE); Platform.startup( config ); //If using RE API in Eclipse/RCP application this is not needed. IReportEngineFactory factory = (IReportEngineFactory) Platform .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY ); IReportEngine engine = factory.createReportEngine( config ); engine.changeLogLevel( Level.WARNING ); }catch( Exception ex){ ex.printStackTrace(); } // Run reports, etc. ... // destroy the engine. try { engine.destroy(); Platform.shutdown(); } catch ( EngineException e1 ) { // Ignore }
Other functions of interest within this class are:
engine.changeLogLevel(java.util.logging.Level.FINE);
Change engine log level (OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST and ALL)
IReportRunnable
BIRT report designs are stored as XML files. By default the extension is rptdesign.
To work with the report design in the engine, you must first load the report using one of the openDesign( )
methods in the ReportEngine
class.
The report design open methods return a IReportRunnable
instance that represents the engine's view of the report design.
IReportRunnable report = engine.openReportDesign( name );
Note that BIRT supplies many options for opening reports such as the filename or an input stream. Use the returned object to obtain parameter data or run the report.
The class provides methods for getting report properties such as the title, author and so on. It also provides methods for getting images embedded (stored) within the report design. If your application requires more information about the design, you can obtain a Design Engine report handle, then use the BIRT Design Engine API to traverse the report design.
IReportDocument
BIRT optionally can store reports in an intermediate format, after generation and before rendering. This document, with the default extension rptdocument, can be manipulated with the IReportDocument
interface. The Engine will create this document when the runTask
is used. The BIRT viewer uses this format to do pagination, TOCs, CSV extraction, bookmarks, etc. When finished with a IReportDocument, be sure to close it, with the close() method.
The Engine's openDocument
method returns a IReportDocument
that represents the intermediate report document.
The example below illustrates getting the TOC from the report document, after the runTask is used to generate the report.
IReportDocument ird = engine.openReportDocument("c:/work/test/TOCTest.rptdocument"); //get root node TOCNode td = ird.findTOC(null); List children = td.getChildren( ); //Loop through Top Level Children if ( children != null && children.size( ) > 0 ) { for ( int i = 0; i < children.size( ); i++ ) { TOCNode child = ( TOCNode ) children.get( i ); System.out.println( "Node ID " + child.getNodeID()); System.out.println( "Node Display String " + child.getDisplayString()); System.out.println( "Node Bookmark " + child.getBookmark()); } }
IEngineTask
BIRT reports support scripting. Operations that execute scripts require a scripting context. Report operations also require a locale. BIRT Engine tasks provide the framework for managing the scripting context, report locales and so on. In general, if an operation requires neither a script context nor a locale, it will appear as a method on the engine or the report design. However, if the operation does require these items, then a task class represents the operation.
For example, opening a design file or retrieving an image in the design file does not require setting up a scripting context. Other operations, such as retrieving default parameters, retrieving a dynamic selection list, and running and rendering a report, all support scripting, require a scripting context, and are represented as tasks.
Create tasks using the factory methods on the ReportEngine
class. The supported Tasks are shown below:
engine.createDataExtractionTask();
engine.createGetParameterDefinitionTask();
engine.createRenderTask();
engine.createRunTask();
engine.createRunAndRenderTask();
IDataExtractionTask
Use this task to extract data from a report document. The BIRT viewer uses this class to extract report data into CSV format. This class supports extracting data from the report document by specifying the result set and columns you would like to have extracted.
From the Viewer code
dataTask.selectResultSet( resultSetName ); dataTask.selectColumns( columnNames ); dataTask.setLocale( locale );
Below is an example that uses the Data Extraction Task to extract the first two columns of data.
//Open previously created report document IReportDocument iReportDocument = engine.openReportDocument("c:/work/test/TOCTest.rptdocument"); //Create Data Extraction Task IDataExtractionTask iDataExtract = engine.createDataExtractionTask(iReportDocument); //Get list of result sets ArrayList resultSetList = (ArrayList)iDataExtract.getResultSetList( ); //Choose first result set IResultSetItem resultItem = (IResultSetItem)resultSetList.get( 0 ); String dispName = resultItem.getResultSetName( ); iDataExtract.selectResultSet( dispName ); IExtractionResults iExtractResults = iDataExtract.extract(); IDataIterator iData = null; try{ if ( iExtractResults != null ) { iData = iExtractResults.nextResultIterator( ); //iterate through the results if ( iData != null ){ while ( iData.next( ) ) { Object objColumn1; Object objColumn2; try{ objColumn1 = iData.getValue(0); }catch(DataException e){ objColumn1 = new String(""); } try{ objColumn2 = iData.getValue(1); }catch(DataException e){ objColumn2 = new String(""); } System.out.println( objColumn1 + " , " + objColumn2 ); } iData.close(); } } }catch( Exception e){ e.printStackTrace(); } iDataExtract.close();
IGetParameterDefinitionTask
Use this task to obtain information about parameters. Parameter default values are expressions, and so a scripting context (represented by the task) is required. Parameter definitions provide access to the parameter definition information that the report designer entered at design time. If a parameter has custom XML or user-defined properties defined, then these are also available. Parameters can be organized into groups. Your application has the choice of retrieving the parameters organized by group (as they should be displayed to the user), or in ungrouped form (useful for creating a programmatic interface.)
The IParameterGroupDefn
and IScalarParameterDefn
interfaces provide information about parameter groups and individual parameters.
The following example opens a report design and iterates through the parameters and parameter groups. If a List Box parameter is found, which is not in a group, the selection values are retrieved.
//Open a report design IReportRunnable design = engine.openReportDesign("C:/work/test/parameters.rptdesign"); IGetParameterDefinitionTask task = engine.createGetParameterDefinitionTask( design ); Collection params = task.getParameterDefns( true ); Iterator iter = params.iterator( ); //Iterate over all parameters while ( iter.hasNext( ) ) { IParameterDefnBase param = (IParameterDefnBase) iter.next( ); //Group section found if ( param instanceof IParameterGroupDefn ) { //Get Group Name IParameterGroupDefn group = (IParameterGroupDefn) param; System.out.println( "Parameter Group: " + group.getName( ) ); //Get the parameters within a group Iterator i2 = group.getContents( ).iterator( ); while ( i2.hasNext( ) ) { IScalarParameterDefn scalar = (IScalarParameterDefn) i2.next( ); System.out.println(" " + scalar.getName()); } } else { //Parameters are not in a group IScalarParameterDefn scalar = (IScalarParameterDefn) param; System.out.println(param.getName()); //Parameter is a List Box if(scalar.getControlType() == IScalarParameterDefn.LIST_BOX) { Collection selectionList = task.getSelectionList( param.getName() ); //Selection contains data if ( selectionList != null ) { for ( Iterator sliter = selectionList.iterator( ); sliter.hasNext( ); ) { //Print out the selection choices IParameterSelectionChoice selectionItem = (IParameterSelectionChoice) sliter.next( ); String value = (String)selectionItem.getValue( ); String label = selectionItem.getLabel( ); System.out.println( label + "--" + value); } } } } } task.close();
Use the IGetParameterDefinitionTask
class to evaluate the default value for a parameter. The parameter default value is an expression, and the task provides the required execution context.
IScalarParameterDefn param = ...; IGetParameterDefinitionTask task = ...; Object value = task.getDefaultValue( param );
IRenderTask
Use this task to render a report document to a specific output (eg, HTML, PDF, ...). This task expects the document to exist, which means it has been generated with the RunTask engine task. This class renders the report, based on the supplied page range, page number or all if no page is specified.
The following example renders the first two pages of the "Pages" report document. You will notice that it renders the two pages as one page of HTML.
//Open a report document IReportDocument iReportDocument = engine.openReportDocument("c:/work/test/Pages.rptdocument"); //Create Render Task IRenderTask task = engine.createRenderTask(iReportDocument); //Set parent classloader report engine task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, RenderTaskExample.class.getClassLoader()); IRenderOption options = new RenderOption(); options.setOutputFormat("html"); options.setOutputFileName("output/resample/eventorder.html"); if( options.getOutputFormat().equalsIgnoreCase("html")){ HTMLRenderOption htmlOptions = new HTMLRenderOption( options); htmlOptions.setImageDirectory("output/image"); htmlOptions.setHtmlPagination(false); //set this if you want your image source url to be altered //If using the setBaseImageURL, make sure to set image handler to HTMLServerImageHandler htmlOptions.setBaseImageURL("http://myhost/prependme?image="); htmlOptions.setHtmlRtLFlag(false); htmlOptions.setEmbeddable(false); }else if( options.getOutputFormat().equalsIgnoreCase("pdf") ){ PDFRenderOption pdfOptions = new PDFRenderOption( options ); pdfOptions.setOption( IPDFRenderOption.FIT_TO_PAGE, new Boolean(true) ); pdfOptions.setOption( IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY, new Boolean(true) ); } //Use this method if you want to provide your own action handler options.setActionHandler(new MyActionHandler()); //file based images //options.setImageHandler(new HTMLCompleteImageHandler()) //Web based images. Allows setBaseImageURL to prepend to img src tag options.setImageHandler(new HTMLServerImageHandler()); IRenderTask task = engine.createRenderTask(document); task.setRenderOption(options); task.setPageRange("1-2"); task.render(); iReportDocument.close();
IRunTask
Use this task to run a report and generate a report document, which is saved to disk. The report document can then be used with the IRenderTask
to support features such as paging.
The following example simply creates a report document and saves it to disk.
//Open a report design IReportRunnable design = engine.openReportDesign("C:/work/test/MyOrders.rptdesign"); //Create task to run the report - use the task to execute the report and save to disk. IRunTask task = engine.createRunTask(design); //Set parent classloader for engine task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, RunTaskExample.class.getClassLoader()); //run the report and destroy the engine task.run("c:/work/test/MyOrders.rptdocument"); task.close();
IRunAndRenderTask
Use this task to run a report and output it to one of the supported output formats. This task does not create a report document. Create a new task for each report that you run.
Reports may take parameters. The IRunAndRenderReportTask
takes parameter values as a HashMap
or you can set them individually. The IRunAndRenderReportTask
provides the validateParameters( )
method to validate the parameter values before you run the report.
//Open the report design IReportRunnable design = engine.openReportDesign("Reports/TopNPercent.rptdesign"); //Create task to run and render the report, IRunAndRenderTask task = engine.createRunAndRenderTask(design); //Set parent classloader for engine task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, RunAndRenderTaskExample.class.getClassLoader()); //Set parameter values and validate task.setParameterValue("Top Percentage", (new Integer(3)));; task.setParameterValue("Top Count", (new Integer(5))); task.validateParameters(); //Setup rendering to HTML HTMLRenderOption options = new HTMLRenderOption(); options.setOutputFileName("output/resample/TopNPercent.html"); options.setOutputFormat("html"); //Setting this to true removes html and body tags options.setEmbeddable(false); task.setRenderOption(options); //run and render report task.run(); task.close();
Miscellaneous
Described below are some miscellaneous items that bear mentioning when using the BIRT Report Engine API
Adding Script Objects
BIRT's script engine supports adding Java objects at the API level. If you wish the Java object to be available to the Report, retrieve the application context at the EngineConfig or Task level and add the object to the Map. For example, adding a Java object to the task.
Add the following code to your task.
MyJavaObject jo = new MyJavaObject(); task.getAppContext().put("MyJavaScriptItem", jo);
Now within the the script editor, you can reference your Java Object as follows:
testMyJavaObject = MyJavaScriptItem.getMyMethod();
Rendering to an Output Stream
When rendering a report it may be desirable to output the report to an output stream, such as HttpServletResponse
. To do this modify your RenderOption instance to use setOutputStream
instead of setOutputFileName
. For example,
public void webReport( HttpServletResponse response ) { . . . //Set rendering options HTMLRenderOption options = new HTMLRenderOption(); options.setOutputStream(response); task.setRenderOption(options); //run the report task.run(); }
IPlatformContext - Web Based Plugin Loading
By default BIRT loads plug-ins located in the BIRT_HOME/plugins directory. The plug-ins loaded provide functionality for connecting to data sources, emitters (eg, PDF, WORD, XLS, HTML ...), and chart rendering. BIRT_HOME in the examples on this page is set using the setEngineHome method of the EngineConfig
class. BIRT loads these plug-ins using the Java File API.
This method is usually sufficient. If deployed to a web application, the developer can usually call ServletContext.getRealPath to retrieve the real path and set the BIRT_HOME accordingly. This can present a problem when deploying to a war file. Certain application servers will return null when getRealPath is called. This will result in the plug-ins not getting loaded.
The IPlatformContext interface describes the methods needed to load the resources required by the BIRT runtime. Within BIRT there are two implementations of this interface, PlatformFileContext() and PlatformServletContext(). The Platform Context is set using the setEngineContext method of the EngineConfig
class. If this method is not called it defaults to PlaformFileContext() and uses the Java File API to load the resources. The PlatformServletContext
class uses Resource based operations. So if you are deploying an application to the Web that uses the BIRT API and it is not contained in a war you can use the default and set your engine home to something similar to:
config.setEngineHome( servletContext.getRealPath("/WEB-INF"));
The BIRT Viewer application will load the plug-ins from /WEB-INF/Plugins directory. If you deploy your application in a war, setup your code like:
//this causes the plug-in loader to look in the current directory. config.setEngineHome(""); //Using the PlatformServletContext will cause the OSGi loader to look for the //plug-ins in the WEB-INF/Platform directory. If this directory //does not exist create it. //Next copy the plug-ins directory from the ReportEngine directory to //the WEB-INF/Platform/ directory. IPlatformContext context = new PlatformServletContext( sc ); config.setPlatformContext( context );
Embedding Report Output
If you need to embed your report output into an existing web page you can use the options.setEmbeddable(true);
method. This will remove the <HTML> and <BODY> tags in the generated report. For example,
public void embedReport( HttpServletResponse response ) { . . . //Set rendering options HTMLRenderOption options = new HTMLRenderOption(); options.setOutputStream(response); options.setEmbeddable(true); task.setRenderOption(options); //run the report task.run(); }
Emitter Configuration
An "emitter" is the component of the report engine that produces output. BIRT provides many emitters such as HTML, XLS and PDF. To configure emitter options you need to use the RenderOption class. In some of the examples above this was done, with code similar to the following:
IRenderOption options = new RenderOption(); options.setOutputFormat("html"); options.setOutputFileName("output/resample/eventorder.html");
BIRT also provides an extended RenderOption class for the PDF and HTML emitters (PDFRenderOption and HTMLRenderOption). The PDFRenderOption class provides methods for handling fonts and the HTMLRenderOption class provides methods for handling images, url encoding, and other html specific settings. You may need to configure the HTML emitter to manage images.
BIRT supports several image types:
- Images referenced using a URL
- Embedded images
- Images created to represent charts
- Images from BLOB types
Your application must have a policy for handling images in HTML. URL-based images are usually no problem. However, you'll need to handle the others. The IHTMLImageHandler
interface defines the policy. The BIRT Engine provides two default implementations:
HTMLCompleteImageHandler
: used to write images to disk when rendering a report to produce an HTML file on disk.HTMLServerImageHandler
: used to handle images for an engine running in an app server. This class is used by the BIRT example web viewer.
When you instantiate a EngineConfig
class the HTMLCompleteImageHandler
class is used by default. Images will be created in your temporary files location (ie C:\Documents and Settings\User\Local Settings\Temp). If this is not desired you can use the HTMLRenderOption
class to change this location.
HTMLRenderOption htmlOptions = new HTMLRenderOption( options); htmlOptions.setImageDirectory("output/image");
Setting the Image Directory instructs the RE API to store images, used within the report output, in that directory. If your emitter is setup with the standard HTMLCompleteImageHandler
, the output image src attribute will point to this directory using the File protocol. If your emitter is configured with the HTMLServerImageHandler
, you can specify an image base URL using the HTMLRenderOption
class. The engine will prepend all images with this URL in the src attribute of the report output.
HTMLRenderOption options = new HTMLRenderOption(); options.setOutputFileName("output/resample/TopNPercent.html"); options.setOutputFormat("html"); options.setImageDirectory("C:\apps\apache-tomcat-5.5.20\webapps\2.2\images"); options.setBaseImageURL("http://localhost:8080/2.2/images/"); options.setImageHandler(new HTMLServerImageHandler()); task.setRenderOption(options);
You can also create your own implementation of IHTMLImageHandler
if the above don't meet your needs.
If your code is going to be run in a servlet, please review the ReportEngineService.java code in CVS ReportEngineService.java The BIRT Viewer uses this class to configure the engine. The constructor for the ReportEngineService uses the HTMLServerImageHandler
class, which in turn reads Image locations from the web.xml file.
发表评论
-
给定字符的全排列输出算法[JAVA]
2009-03-02 01:51 1862/* @author wenmin.h */ p ... -
Java RMI 之 Introduction
2008-07-04 15:19 1612Java RMI 之 Introduction 注 ... -
BIRT 2.2.2 运行时使用已有的java.sql.Connection来生成报表
2008-06-10 16:49 3805注:本文实现的思路不是原创,思路原文来自: http:/ ... -
BIRT部署并利用API生成PDF
2008-06-05 14:24 9966注:本文转自 http://blog.csdn.net/xuj ... -
JasperReport用户手册
2008-05-23 14:26 6321这篇文章转自--疯狂的 ... -
xpath的部分语法
2008-02-27 09:50 1584xpath的部分语法: <?xml version=&q ... -
[转]JAVA的反射机制
2008-01-22 10:29 1209JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个 ... -
JDBC3支持获取自增字段的值
2007-12-07 12:54 1345java 代码 ... St ... -
JAVA中读取ORACLE的CLOB字段
2007-11-23 21:21 3913现在项目遇到CLOB字段的使用,在网上搜索一下,读取ORACL ...
相关推荐
拍打鸟引擎 Web开发人员的游戏引擎 演示版 取得引擎 git clone ...通过代码完成探索Engine API Engine. 例子 ./src/games/myGame/index.js import Engine from '../../clas
**Birt Report View 报表**是基于Java技术并集成于Eclipse开发环境的一款强大报表工具。它旨在为开发者提供一个高效、灵活的平台,用于设计、开发和展示复杂的数据报表,以满足企业对数据可视化的需求。Birt Report ...
**蓝色知更鸟API(Bluebird API)** 在JavaScript的世界里,Promise是处理异步操作的重要工具,而Bluebird库是Promise的一个强大实现。Bluebird以其高性能、丰富的API和全面的错误处理机制著称。本篇文章将深入探讨...
在FlappyBird的cocos2dx版本中,游戏场景、角色动画、碰撞检测等功能都通过cocos2dx的API实现。 2. 游戏对象:游戏中的Bird对象和管道(Pipes)对象是核心。Bird的移动和跳跃通过物理引擎模拟,而Pipes则动态生成,...
在这个名为“OpenCv制作的FlappyBird”的项目中,开发者利用OpenCV技术实现了一个经典游戏FlappyBird的版本。下面我们将详细探讨OpenCV在该项目中的应用以及相关知识点。 首先,我们要理解OpenCV的基本概念。OpenCV...
Thunderbird是一款由Mozilla开发的开源电子邮件客户端,它提供了丰富的功能,包括邮件管理、新闻组、聊天和RSS阅读等。在日常使用中,为了防止数据丢失或进行迁移,定期备份Thunderbird的邮件设置和数据是非常重要的...
ThunderBird是一款开源、免费的电子邮件客户端,由Mozilla基金会开发,其设计目标是提供一个安全、稳定且可定制的邮件管理工具。在ThunderBird中,有许多常用组件和扩展可以帮助用户提升邮件处理的效率和体验。以下...
《Flappy Bird游戏素材资源详解》 在游戏开发领域,Flappy Bird是一款极其经典且具有极高人气的小游戏,它的简洁设计和挑战性吸引了无数玩家。本资源包是针对这款热门游戏——Flappy Bird的素材资源集合,包含了...
《Flappy Bird游戏素材解析与应用》 Flappy Bird是一款风靡全球的休闲游戏,以其简单易上手的操作和极具挑战性的玩法深受玩家喜爱。在本文中,我们将深入探讨这款游戏中的一些关键素材,并通过提供的压缩包文件,...
这涉及到对图像处理库如Java的BufferedImage类和音频处理库如Java Sound API的运用。 总的来说,这个Flappy Bird的项目为我们提供了从零开始构建一个完整游戏的机会。从GUI设计到物理引擎的实现,再到数据存储和...
《Flappy Bird 图像音频资源解析》 在游戏开发领域,资源是构成游戏世界的基础,它们赋予游戏视觉和听觉的生动性。本资源包“flappybird图像音频资源包”便是针对经典游戏《Flappy Bird》而设计的,旨在为开发者...
《Flappy Bird游戏素材解析:图像与音效的全方位探讨》 Flappy Bird,这款曾经风靡全球的小游戏,以其简单却极具挑战性的玩法吸引了无数玩家。在学习游戏开发的过程中,掌握并理解游戏素材——尤其是图像和音效——...
《flappy bird》是一款由来自越南的独立游戏开发者Dong Nguyen所开发的作品,游戏于2013年5月24日上线,并在2014年2月突然暴红。2014年2月,《Flappy Bird》被开发者本人从苹果及谷歌应用商店撤下。2014年8月份正式...
《Flappy Bird游戏资源与开发解析》 在游戏开发领域,Unity引擎因其强大的功能和易用性而备受青睐,尤其对于初学者来说,它是一个极好的起点。本篇将深入探讨利用Unity进行游戏开发,以Flappy Bird为案例,同时延伸...
Bluebird作为Promise库,它的性能出色,支持多种Promise A+规范,并提供了丰富的API,如`.then()`, `.catch()`, `.finally()`, `.map()`, `.each()`等,使得开发者能够更方便地处理异步流程。此外,Bluebird还提供了...
《Flappy Bird游戏制作资源素材详解》 Flappy Bird,这款简单却又极具挑战性的手机游戏,在全球范围内引发了一股热潮。对于游戏开发者来说,了解并掌握其制作资源和素材是至关重要的一步。本资源包主要包含了Flappy...
flappybird游戏资源,图片+音效
C++库如SDL或SFML提供了绘图API,开发者可以利用这些API绘制鸟、管道、地面等游戏元素,并通过改变它们的位置来实现动画效果。例如,鸟的上下振翅、管道的滚动都可以通过平移坐标实现。 六、分数系统与计时器 分数...
《Flappy Bird游戏素材解析与应用》 Flappy Bird,这款曾经风靡全球的休闲小游戏,以其简单却极具挑战性的玩法吸引了无数玩家。本素材包是根据某博主在CSDN上的分享(链接:...
【FlyBird资源文件图片加音效】是一款深受国内外玩家喜爱的游戏资源包,它包含了用于创建类似"FlappyBird"游戏的素材,包括视觉元素和音频效果。这些资源为开发者提供了便利,使他们能够快速构建一个与原版Flappy...