Hey Nikola,
Like Matt mentioned you make a lot of “evil” assumptions, but you’ll learn
them with experience. For example, the proper way to include SDL headers is
#include “SDL_whatever.h” and pass the system location in on the command
line. With a little massaging, (and a handy CMake template I keep around) I
built it on Windows, attached if you’re interested. (You didn’t remove the
.svn directory from your release tar, which is also bad, but fortunate as I
was able to grab a quick diff
)
Game seems promising–keep working at it.
-BrendanOn Mon, Aug 2, 2010 at 6:39 PM, wrote:
i suggest you dont litter users home dir with data files that dont need to
be there. if this is a dev project use the project dir. make it better
and have a command line argument to specify the path.
you also skip simple runtime checks, bad and lazy.
ImageObject.cpp line 11 and 12, you open and image file and fail to check
if it succeeded, if a user didnt have data files in the path you assumed, it
will segfault.
matt
On Sun, 1 Aug 2010, Nikola Whallon wrote:
Hello, I am finally going to make a finished game (with SDL and OpenGL),
but I would like a bit of feedback. It is an “arcade” game where you are a
ship and you are trying to fly to a destination planet before your fuel runs
out. Here is a tiny demo:
http://www.theoctoroks.com/gravity/downloads/
The default level has no destination planet, nor does it have moving
planets, but if you replace it with the “level1.dat” under “custum_levels”
on that website, you can see those two things as well. (aka, replace the
current game_resources/levels/level1.dat).
Anywho, I have only been able to get it working with Linux and OS X (as I
don’t have a Windows computer).
I’d like some simple feedback on how to make the gameplay more fun, but
still really simple, or how to make levels more fun. My programming skills
are quite n00bish, so simple is better.
Thanks a lot,
saturn
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
-------------- next part --------------
#CMake script for Gravity
#Run ‘cmake <source_directory>’ to generate a makefile
cmake_minimum_required(VERSION 2.6)
#definitions
set(PROJECT_NAME “Gravity”)
set(APP_NAME gravity)
set(PROJECT_VERSION 0 1 0)
set(DESCRIPTION “DESCRIPTION”)
set(README README.txt)
set(LICENSE ${README})
set(AUTHORS “Nikola Whallon”)
set(EXTRA_MODULES_IN “cmake/Modules”)
set(TOOLS_NEEDED SDL SDL_image OpenGL)
set(TOOLS_WANTED “”)
set(CMAKE_BUILD_TYPE Debug)
#more definitions!
set(WIN_DIR “${CMAKE_SOURCE_DIR}/win”)
set(EXTRA_INCLUDE_DIRECTORIES “${CMAKE_SOURCE_DIR}/src”)
set(EXTRA_LINK_DIRECTORIES “F:/lib”)
set(COMPILE_FLAGS “-LF:/lib”)
if(WIN32)
file(GLOB EXTRA_SOURCES ${WIN_DIR}/*.c)
list(APPEND DLLFILES ${WIN_DIR}/SDL.dll)
list(APPEND COMPILEDEFS NO_STDIO_REDIRECT _USE_MATH_DEFINES BASEPATH=“${CMAKE_SOURCE_DIR}/”)
endif(WIN32)
set(LINKED_LIBS ${SDLIMAGE_LIBRARY})
################################################################################
Below be boilerplate!
################################################################################
#tell CMake where to find extra scripts for this project
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
“${CMAKE_SOURCE_DIR}/${EXTRA_MODULES_IN}”)
#declare the project
project(${PROJECT_NAME})
#grab source files
file(GLOB_RECURSE HEADERS ${CMAKE_SOURCE_DIR}/src/.h)
file(GLOB_RECURSE SOURCES ${CMAKE_SOURCE_DIR}/src/.c
${CMAKE_SOURCE_DIR}/src/*.cpp
CMakeLists.txt) #include this script for convenience
message("Found sources: " ${SOURCES} ${EXTRA_SOURCES} ${HEADERS})
#declare the target program
add_executable(${APP_NAME} ${SOURCES} ${EXTRA_SOURCES} ${HEADERS})
#extract the proper versioning breakdown
list(GET PROJECT_VERSION 0 VERSION_MAJOR )
list(GET PROJECT_VERSION 1 VERSION_MINOR )
list(GET PROJECT_VERSION 2 VERSION_PATCH )
#add some useful preprocessor defines
add_definitions(${COMPILEDEFS})
set_property(
TARGET ${APP_NAME} PROPERTY COMPILE_DEFINITIONS
${COMPILEDEFS}
PROJECT_NAME=“${PROJECT_NAME}”
AUTHOR_NAMES=“${AUTHORS}”
PROJECT_VERSION=“${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}”
)
#pass on the flags
set(CMAKE_CXX_FLAGS ${COMPILE_FLAGS})
set(CMAKE_C_FLAGS ${COMPILE_FLAGS})
#find tools required for compilation
foreach(TOOL ${TOOLS_NEEDED})
find_package(${TOOL} REQUIRED)
list(APPEND EXTRA_INCLUDE_DIRECTORIES ${${TOOL}_INCLUDE_DIR})
list(APPEND LINKED_LIBS ${${TOOL}_LIBRARY})
string(TOUPPER ${TOOL} TOOL) #most vars are set in all uppercase
list(APPEND EXTRA_INCLUDE_DIRECTORIES ${${TOOL}_INCLUDE_DIR})
list(APPEND LINKED_LIBS ${${TOOL}_LIBRARY})
endforeach(TOOL)
#find nice-to-have things
foreach(TOOL ${TOOLS_WANTED})
find_package(${TOOL})
if(${TOOL}FOUND)
set(HAVE${TOOL} true)
endif()
endforeach(TOOL)
target_link_libraries(${APP_NAME} ${LINKED_LIBS})
link_directories(${EXTRA_LINK_DIRECTORIES})
include_directories(${EXTRA_INCLUDE_DIRECTORIES})
################################################################################
Above be boilerplate!
################################################################################
#install the binary to bin under the install directory
install(TARGETS ${APP_NAME}
DESTINATION bin
COMPONENT Game
)
install(FILES ${README} ${LICENSE} ${ADDL_INSTALL_FILES}
DESTINATION .
COMPONENT Game
)
install(FILES ${DLLFILES}
DESTINATION bin
COMPONENT Game
)
#more packaging metadata
set(README ${CMAKE_SOURCE_DIR}/${README})
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME})
set(CPACK_PACKAGE_DESCRIPTION_FILE ${README})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${DESCRIPTION})
set(CPACK_PACKAGE_DESCRIPTION ${DESCRIPTION})
set(CPACK_PACKAGE_EXECUTABLES “${APP_NAME}”;${CPACK_PACKAGE_NAME})
set(CPACK_RESOURCE_FILE_README ${README})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/${LICENSE})
set(CPACK_PACKAGE_VENDOR ${AUTHORS})
set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_NAME})
set(CPACK_COMPONENT_GAME_DESCRIPTION ${DESCRIPTION})
#tell CPack not to include generated build junk in source packages
list(APPEND CPACK_SOURCE_IGNORE_FILES
${CMAKE_BINARY_DIR}
)
include(CPack)
-------------- next part --------------
A non-text attachment was scrubbed…
Name: gravity_win.patch
Type: application/octet-stream
Size: 13796 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100802/596efec7/attachment.obj