我用C ++中的SDL2对游戏进行编程。
我想在此游戏中使用SDL_GetWindowSurface和SDL_CreateRenderer,如果仅使用其中之一,它的作品,但是如果尝试同时使用它们,则游戏崩溃。
我认为如果两个功能都处于活动状态,则这两个功能将无效。
这可能是问题吗?
答案 0 :(得分:1)
我认为如果两个功能都处于活动状态,则这两个功能将无效。
这可能是问题吗?
是的,与the SDL_GetWindowSurface()
declaration comment完全一样:
buildscript {
repositories {
jcenter()
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
}
}
plugins {
id 'java'
id 'signing'
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
apply plugin: 'signing'
group = 'com.example'
version = '1.1.0'
description = "example"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.9.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version:'2.9.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.9.6'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.5.5'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version:'4.4.9'
compile group: 'commons-io', name: 'commons-io', version:'2.6'
compile group: 'org.apache.tika', name: 'tika-core', version:'1.18'
testCompile group: 'junit', name: 'junit', version:'4.12'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc
}
publishing {
artifacts {
archives sourcesJar
archives javadocJar
}
publications
{
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
url "${project.version.endsWith('-SNAPSHOT') ? 'https://oss.sonatype.org/content/repositories/snapshots' : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' }"
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
signing
{
sign publishing.publications.mavenJava
}
报价以强调:
您可能不将其与此窗口中的3D或渲染API结合。
答案 1 :(得分:0)
surface = SDL_GetWindowSurface(window);
renderer = SDL_CreateSoftwareRenderer(surface);
if (!renderer) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
return 1;
}