sdl

main.cpp:(.text+0x5f): undefined reference to

[亡魂溺海] 提交于 2019-12-21 06:21:00
问题 I try to compile some exercise from a SDL guide. I compile like this: g++ -o main main.cpp -I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2 and i get this: /tmp/cci2rYNF.o: In function `main': main.cpp:(.text+0x5f): undefined reference to `Game::init(char const*, int, int, int, int, int)' collect2: error: ld returned 1 exit status and my code is: main.cpp #include "Game.h" // our Game object Game* g_game = 0; int main(int argc, char* argv[]) { g_game = new Game(); g_game->init("Chapter 1",

HOWTO draw circles, arcs and vector graphics in SDL?

只愿长相守 提交于 2019-12-20 20:46:29
问题 (I'm using SDL2) SDL is a relatively small library for "low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D" It's used for game development and, in my case, as simple audio visual output and mouse+keyboard input. It's not a "toolkit" like GTK, Qt, wxWindows, etc. But it is cross-platform. But the only way I can find to draw a shape is with the line, rect and pixel functions. Apart from using trig or the "equation of a circle", how could I draw a

如何在C++中嵌入JAVA

柔情痞子 提交于 2019-12-20 18:46:16
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如何在C++中嵌入JAVA 最近在为 AWTK 增加 JAVA 绑定,在 Windows 和 Linux 下工作正常,但是在 MACOS 上运行起来遇到下列问题: java[5714:260503] WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future. Called from ( 0 AppKit 0x00007fff50d21607 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 378 1 AppKit 0x00007fff50d1e9f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479 2 AppKit 0x00007fff50d1e42a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45 3 AppKit

SDL / OpenGL: Implementing a “Loading thread”

随声附和 提交于 2019-12-20 14:13:39
问题 I currently try to implement a "Loading thread" for a very basic gaming engine, which takes care of loading e.g. textures or audio while the main thread keeps rendering a proper message/screen until the operation is finished or even render regular game scenes while loading of smaller objects occurs in background. Now, I am by far no OpenGL expert, but as I implemented such a "Loading" mechanism I quickly found out that OGL doesn't like access to the rendering context from a thread other than

SDL - drawing 'negative' circles (Fog of War)

怎甘沉沦 提交于 2019-12-20 10:11:29
问题 I have this 800x600square I want to draw to the screen. I want to 'cut' circles in it (where alpha would be 0). Basically I'm drawing this whole rectangle over a map so in these 'circles' I drew, you can see the map, otherwise you see the grey square 回答1: So, I assume you're trying to add fog of war to one of you game? I had a small demo I made for a local University a few weeks ago to show A* pathfinding, so I thought I could add fog of war to it for you. Here's the results: Initial map

OpenGL Low-Level Performance Questions

你。 提交于 2019-12-20 09:53:32
问题 This subject, as with any optimisation problem, gets hit on a lot, but I just couldn't find what I (think) I want. A lot of tutorials, and even SO questions have similar tips; generally covering: Use GL face culling (the OpenGL function, not the scene logic) Only send 1 matrix to the GPU (projectionModelView combination), therefore decreasing the MVP calculations from per vertex to once per model (as it should be). Use interleaved Vertices Minimize as many GL calls as possible, batch where

Undefined reference to 'SDL_main' while using Dev C++

荒凉一梦 提交于 2019-12-20 02:52:30
问题 i am currently having problem compiling my project in dev c++ which uses SDL libraries, what i did was first download the file SDL2-devel-2.0.3-mingw.tar.gz (MinGW 32/64-bit) from this site, then in Tools -> Compiler Options and then in ' Directories ' section i included the x86_64-w64-mingw32/lib in ' libraries ' tab and x86_64-w64-mingw32/include in ' C++ includes ' tab after i extracted the downloaded folder in C drive. Finally, in project options i added these linkers -lmingw32 -lSDL2main

SDL2 Undefined references to functions

无人久伴 提交于 2019-12-20 02:10:28
问题 I'm trying to set up a C++ project that builds on MinGW and uses SDL. When i try to compile my program, g++ says undefined reference to 'SDL_Function' for each SDL function i use. Lib/SDL2: contents of SDL2-devel-2.0.0-mingw.tar.gz from SDL's website Source/Main.cpp: #include "SDL.h" int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); SDL_Window *window = SDL_CreateWindow( "Hello World", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0 ); SDL_Delay(3000); SDL_DestroyWindow

SDL_GetTicks() accuracy below the millisecond level

a 夏天 提交于 2019-12-19 21:20:23
问题 I program currently something with SDL2. All works fine, but I have a problem with the SDL_GetTicks() method. Normally it should return the total application time in milliseconds, but it always returns most of the time the value 0 and sometimes the value 1. I initialized SDL with SDL_INIT_EVERYTHING flag. The problem with the following code is the loop is too fast, so the delta time is smaller than 1 ms. Is there a method to achieve a higher precision? #include "Application.hpp" void

SDL_GetTicks() accuracy below the millisecond level

若如初见. 提交于 2019-12-19 21:20:21
问题 I program currently something with SDL2. All works fine, but I have a problem with the SDL_GetTicks() method. Normally it should return the total application time in milliseconds, but it always returns most of the time the value 0 and sometimes the value 1. I initialized SDL with SDL_INIT_EVERYTHING flag. The problem with the following code is the loop is too fast, so the delta time is smaller than 1 ms. Is there a method to achieve a higher precision? #include "Application.hpp" void