LibGdx和Overlap2D无法将Actor添加到GameStage

时间:2015-08-14 19:37:59

标签: java eclipse gradle libgdx overlap2d

我刚刚设置了一个新的LibGdx-Project与Overlap2D集成,并尝试启动我的第一个场景,如教程here和Overlap2D网站所示,但它一直给我保存错误。

public class GameStage extends Stage {

    SceneLoader sceneLoader;

    public GameStage() {
        sceneLoader = new SceneLoader();
        sceneLoader.loadScene("MainScene");
        // The method addActor(Actor) in the type Stage is not applicable for the arguments (Entity)
        **addActor**(sceneLoader.getRoot());
    }

}

public class EyeCore extends ApplicationAdapter {

    private GameStage stage;

    @Override
    public void create () {
        stage = new GameStage();
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act();
        stage.draw();
    }
}

我根本没有改变任何配置文件。

当我尝试执行它时,它会抛出以下错误:

Stage类型中的方法addActor(Actor)不适用于参数(Entity)

完整的错误消息:

  

建立失败

     

总时间:0.737秒[sts]构建失败   org.gradle.tooling.BuildException:无法使用执行构建   Gradle分布   ' http://services.gradle.org/distributions/gradle-2.4-all.zip&#39 ;.在   org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:57)     在   org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor $ 1 $ 1.run(DefaultAsyncConsumerActionExecutor.java:57)     在   org.gradle.internal.concurrent.DefaultExecutorFactory $ StoppableExecutorImpl $ 1.run(DefaultExecutorFactory.java:64)     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)     在java.lang.Thread.run(未知来源)at   org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)     在   org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:71)     在   org.springsource.ide.eclipse.gradle.core.TaskUtil.execute(TaskUtil.java:117)     在   org.springsource.ide.eclipse.gradle.core.launch.GradleProcess $ 1.doit(GradleProcess.java:92)     在   org.springsource.ide.eclipse.gradle.core.util.GradleRunnable $ 1.run(GradleRunnable.java:53)     在org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)引起的   by:org.gradle.internal.exceptions.LocationAwareException:执行   任务失败'核心:compileJava'。在   org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:77)     在   org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)     在   org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)     在   org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)     在   org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)     在   org.gradle.launcher.exec.InProcessBuildActionExecuter $ DefaultBuildController.run(InProcessBuildActionExecuter.java:90)     在   org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)     在   org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)     在   org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)     在   org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)     在   org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)     在   org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:74)     在   org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:72)     在org.gradle.util.Swapper.swap(Swapper.java:38)at   org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)     在   org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)     在   org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run(StartBuildOrRespondWithBusy.java:50)     在   org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run(DaemonStateCoordinator.java:246)     在   org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)     在   org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:40)   引起:org.gradle.api.tasks.TaskExecutionException:执行   任务失败'核心:compileJava'。在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)     在   org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)     在   org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)     在   org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)     在   org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)     在   org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)     在   org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)     在   org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)     在   org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)     在   org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)     在   org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)     在   org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)     在   org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)     在   org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)     在   org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)     在   org.gradle.execution.DefaultBuildExecuter.access $ 200(DefaultBuildExecuter.java:23)     在   org.gradle.execution.DefaultBuildExecuter $ 2.proceed(DefaultBuildExecuter.java:68)     在   org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)     在   org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)     在   org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)     在   org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)     在   org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)     ... 34更多引起:   org.gradle.api.internal.tasks.compile.CompilationFailedException:   编译失败;请参阅编译器错误输出以获取详细信在   org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:47)     在   org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)     在   org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:101)     在   org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)     在   org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)     在   org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)     在   org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)     在   org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157)     在   org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:137)     在   org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:91)     在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)     在   org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ IncrementalTask​​Action.doExecute(AnnotationProcessingTaskFactory.java:243)     在   org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)     在   org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ IncrementalTask​​Action.execute(AnnotationProcessingTaskFactory.java:230)     在   org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)     ......还有57个

0 个答案:

没有答案