pip install pygame – SDL.h file not found
This helped solved the issue. Use sudo if necessary. brew install sdl sdl_image sdl_mixer sdl_ttf portmidi; pip3 install pygame; pip install pygame
This helped solved the issue. Use sudo if necessary. brew install sdl sdl_image sdl_mixer sdl_ttf portmidi; pip3 install pygame; pip install pygame
On Windows, you can create a solid background color then set the window’s transparency color with the Win32 API function SetLayeredWindowAttributes(). (Called with pywin32) Code: import pygame import win32api import win32con import win32gui pygame.init() screen = pygame.display.set_mode((800, 600)) # For borderless, use pygame.NOFRAME done = False fuchsia = (255, 0, 128) # Transparency color dark_red … Read more
There is no “320×240 glOrtho canvas”. There is only the window’s actual resolution: 960×720. All you are doing is scaling up the coordinates of the primitives you render. So, your code says to render a line from, for example, (20, 20) to (40, 40). And OpenGL (eventually) scales those coordinates by 3 in each dimension: … Read more
I think that the following will work, as it finds the libraries on my ubuntu system and the example function you provided can link: project(shooter-cmake2) cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++0x”) add_executable(${PROJECT_NAME} src/test.cpp) INCLUDE(FindPkgConfig) PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0) INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES}) If cmake is executed with –debug-output it outputs: — Found PkgConfig: … Read more
Here’s a smaller example that reproduces the problem: struct FontLoader(String); struct Font<‘a>(&’a str); impl FontLoader { fn load(&self) -> Font { Font(&self.0) } } struct Window; struct Phi<‘window> { window: &’window Window, loader: FontLoader, font: Option<Font<‘window>>, } impl<‘window> Phi<‘window> { fn do_the_thing(&mut self) { let font = self.loader.load(); self.font = Some(font); } } fn main() … Read more
Libpng-1.6 is more stringent about checking ICC profiles than previous versions. You can ignore the warning. To get rid of it, remove the iCCP chunk from the PNG image. Some applications treat warnings as errors; if you are using such an application you do have to remove the chunk. You can do that with any … Read more
Per the SDL Windows FAQ: You should be using main() instead of WinMain() even though you are creating a Windows application, because SDL provides a version of WinMain() which performs some SDL initialization before calling your main code. If for some reason you need to use WinMain(), take a look at the SDL source code … Read more
This answer is about MinGW / GCC, and not Visual Studio. This answer only applies to Windows. Common errors The common errors are: SDL.h: No such file or directory (when compiling) undefined reference to various functions (when linking) ??.dll was not found (when running your program) procedure entry point … could not be located in … Read more