Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c]

C is a general-purpose computer programming language used for operating systems, libraries, games and other high performance work.

0
votes
1answer
45 views

How to save game state in C in Allegro?

I'm working on my first game in Allegro in C for a course project. Part of my goal is to make a gamesave of the current gamestate. For example, lets say I lose the game or I want to exit the game. ...
0
votes
0answers
16 views

how to register update function in Lua from C game engine?

This is my first attempt to make a SDL2 based 2d game engine in C, i am planning using Lua as scripting language for gameplay purposes. First i learned how to call a C function from Lua: ...
1
vote
2answers
50 views

Getting Model View Matrix by hand

Right now I'm trying to calculate the model view MAtrix by hand... The App is 2D. I have Somethign like this.. ...
0
votes
1answer
39 views

Wrong angles given by atan2

I have a method to calculate angle between two vectors, but it is giving wrong values. here is the code : ...
0
votes
0answers
48 views

How can I make this tile map correctly?

I'm having the following problem creating this hexa tiled map. this is what I wanted : [EDIT] Ok I've Managed to do this: ...
-1
votes
0answers
27 views

ncurses rgb noise testing

Lately I have been having a lot of fun with ncurses as I try to learn C. My medium and long-term goals are to make some fun games with the library in pure C for the sake of historical appreciation and ...
1
vote
0answers
59 views

Doom-style 8 directions sprite math HELP C++ [duplicate]

I'm trying to get Doom-style 8 direction sprite rotation that changes its sprite depending on the camera and the forward vector of the entity just like this video here: https://www.youtube.com/watch?v=...
0
votes
1answer
34 views

OpenGL Tiled map texturing problem

Some Tiles in my map are drawn wrong, I think it might be a indexing problem. Here's the output : some tiles just look wrong!! I'm not sure where i'm going wrong with my code, so please take a look. ...
1
vote
1answer
26 views

Trying to translate object

I'm trying to tranlate a matrix by xy but the result is strange. can someone help me translate and rotate the matrix properly? ...
1
vote
2answers
60 views

Is it possible to make desktop visible behind drawn object using SDL2?

I would like to draw an avatar over the desktop, something similar to those word 97 assistants, my idea so far is to make only the background transparent but I haven't had any luck, any suggestion? is ...
0
votes
0answers
47 views

how to calculate Z cooridnate based on X & Y?

I'm new to 3d development so please bare with me. What I want to do is be able to draw a 3D cube with colored faces and rotate the cube around a X, Y & Z axis. I'm not sure if this matter, but ...
1
vote
1answer
241 views

How do I check if a window has focus in SDL2?

Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the ...
0
votes
2answers
71 views

SDL2 only renders a single image

As an attempt to learn SDL on C, I decided to try and create a simple Pong program using it. My problem now is that of the textures I've given it, two paddles and a ball, only the ball is rendered. It ...
3
votes
0answers
48 views

Is the C or the Android code a problem?

Starting to write a game, it'll have a C server, and at the very least an Android client. However I have run into an issue where I can't seem to get them to connect. I have thrown debug logging into ...
0
votes
0answers
92 views

CSFML sfRenderTexture trouble

I am having trouble creating a sfRenderTexture in CSFML so that I can dynamically update my lighting. Why does this code: ...
1
vote
0answers
161 views

ANSI C (C11) math libraries? [closed]

I know there are a multitude of C++ math libraries out there, but my current project is C-only (C11). So far I've made due with writing my own matrix/vector functions, but now I need to do the more ...
0
votes
0answers
48 views

How to insert the SDL2 library into visual studio for C but not C++

I am a student and want to make an RPG game using visual studio by C programming as my project, so I need to insert some png photo into the game as the background. But I was frustrated to discover no ...
0
votes
1answer
717 views

Why am I getting these errors when including stb_image.h?

I'm trying to put an include guard around including stb_image.h (from the well-known public domain image library). I have noticed that, unusually, the include ...
0
votes
0answers
56 views

3D Rotation Motion

I am trying to move a small sphere around a larger sphere or box in OpenGL. The first rotation I want is motion A in the picture below. Motion A acts as a satellite around a planet or box. Also The ...
0
votes
0answers
71 views

OpenGL: Freetype font does not appear

I am learning OpenGL for 2d by following this tutorial here. I followed the tutorial for rendering font to the screen as it is given but still the font does not appear. Whenever I run the program i ...
1
vote
1answer
49 views

Segmentation Fault using Allegro_Tiled, function al_open_map();

I have consistently segfaulted trying to load a TMX file into a *map. ...
1
vote
1answer
901 views

Are there any game engines for developing in C? [closed]

I cant find any game engines which use C, mostly just Java, Anyone know any good engines that support 2d Development in C? ALso I have an additional question how hard is it to write your own game ...
0
votes
0answers
782 views

corrupted size vs. prev_size: 0x09584448

im working on a menu which has 3 buttons(play,story,quit) and i want to make effects for the buttons. I tried to use SDL_mousemotionn but the program goes wrong like for example when i enter the zone ...
1
vote
1answer
72 views

Change the image of sdl window with a new one

I will make a game and it has 3 buttons on its menu. Those buttons supposed to change the picture the background of the menu When i click on play, another picture should appear like so I found a ...
0
votes
1answer
286 views

Programming Action RPG Battle system

My best goal atm is just make one 1vs1 battle with no animations more than something which makes me realize the attack is done. I'm learning C and Xlib, and now I know how to put an image in a window ...
2
votes
1answer
151 views

How to handle Japanese on Windows and Linux using SDL_ttf and C++?

In SDL_ttf, there are a few functions provided that handles non-ASCII string literals, such as: TTF_RenderUNICODE_Solid ...
-2
votes
1answer
155 views

Find a vector 90 degrees to the right of a given angle

Can you help transform this function to move the point not only by Forward distance but also by a distance to the right or left? ...
2
votes
1answer
847 views

Handling variable frame rate in SDL2

i am creating a game with C++ and SDL2 game engine but i noticed this. I used the Vsync option for rendering, so it'll render at 60fps. If i use this game with another monitor, fps are different (for ...
2
votes
2answers
139 views

Mixing DirectX headers with C mod project not working

I'm trying to add a DirectX 11 renderer (not sure if that is even doable in a "simple" manner) to the Return To Castle Wolfenstein source code and I'm having some problems. I have a rendering class in ...
1
vote
0answers
117 views

How do I detect collision between an ellipse and a rhombus?

I'm building a game in C/C++ (been alternating between the two), but one of the biggest problems I've run into is collision detection. The game is isometric and exists on a 2x1 grid (e.g. the base ...
1
vote
1answer
224 views

SDL 2.0 OpenGL not drawing anything except background

My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code: main.cpp ...
1
vote
0answers
63 views

2D Collisions engine

I am working on a fabric simulator at low level, I have done some work and at this point there are some points where I would appreciate help. The input of the program is a DRF file. This is a format ...
2
votes
2answers
263 views

Setting a uniform float in a fragment shader results in strange values, is this a type conversion? How can it be fixed?

First, some details: I'm learning OpenGL from the tutorials on https://open.gl My computer is running Linux Mint 18.1 Xfce 64-bit My graphics card is a GeForce GTX 960M OpenGL Version: 4.5.0 NVIDIA ...
1
vote
0answers
87 views

Linux: blit image on screen without stuttering at a stable frame rate

I'm working on a very simple game, and one of the project goals is to minimise the use of libraries. I'm drawing every frame into a buffer, which is then displayed using ...
0
votes
6answers
193 views

C/C++ Flexible yet fast way of linking UI elements to functions

I am currently working on the UI functionality of my game, which will have very minimal GUI design, yet it needs to be functional and flexible e.g. easy to redesign. I am planning to construct all my ...
1
vote
2answers
160 views

Network game like MMO - TPC or UDP [closed]

I saw this subject several times, however I will wish better understand. I am working on the development of a 2d game like a little MMO. (Currently I only do research). I see people who says it's ...
3
votes
1answer
2k views

Key released, multiple Keys, how to go around ncurses limitations?

I have been trying to make a small game in the terminal in C++ using ncurses. After searching around for some time, I came to realize that ncurses is pretty limiting as far as keyboard inputs are ...
0
votes
1answer
106 views

glUniformMatrix4dv with a unidimensional array

I am trying to convert this C++ gml code to C and am getting the same array but I cannot see anything on the screen, is there something I am doing wrong maybe on the shader? GML code in C++: ...
0
votes
1answer
54 views

How to move from A to B, with check and fix the destiny?

I only found the formula for check the collision between two lines. But never about of movement and fixed from one point to other point in one of the line. I need move from pA to pB and if take ...
-1
votes
1answer
792 views

Rotate Earth around sun, and moon around earth

SOLVED: I'm trying to rotate the moon around the earth. Which this part of the code only the earth is rotated around the sun, how can I make the axis to be center of earth's object? I thought about ...
0
votes
0answers
145 views

Smart algorithm to find clusters in matrix of numbers

I´m developing in C, a solver for puzzles like this game Bubble Popper (https://play.google.com/store/apps/details?id=com.bytesequencing.bubble_popper_ads). Fast explanation: we have to find clusters ...
1
vote
1answer
436 views

SDL_RenderPresent is writing over the previous frame

Whenever I call SDL_RenderPresent, the previous frame is replaced with black before the new frame is displayed. It's almost like when I call ...
5
votes
1answer
742 views

Drawing at floating point position

The library I am using (SDL2) only supports drawing to int positions. I am currently storing my objects positions as double, and ...
-1
votes
1answer
46 views

Why do I get this compiler error when trying to include Allegro headers on a Mac?

I ran brew install allegro on OSX while following this tutorial. My code looks like this: ...
0
votes
1answer
74 views

Can't figure out how to create texture from a font-surface

I can't seem to be able to render my font, it crashes and I can't figure out why. It seems to load the font correctly, but the parts relating to surface crashes. Why does my texture crash? Here is ...
1
vote
1answer
142 views

How do I use data-orientated programming without object-orientated programming?

I have been reading many resources about data oriented programming, and one thing I understand about it is that it's about keeping chunks of memory together to improve performance. Other than that, I ...
1
vote
1answer
95 views

SDL Player do something for 3 seconds then stop

I'll make my player respawn after 1 of his lives is taken, but I want him to be invincible for 2 or 3 seconds and not instadie again because he will be in the way of enemy bullets. ...
1
vote
1answer
86 views

SDL Detect change score

I have this in my loop , it works but I get verry low fps and game is working in slow motion : ...
0
votes
1answer
433 views

C SDL render text?

I'm making a game in C using SDL library and I want to display a score. I have 9 photos with numbers from 0-9 and I want to know if I can use them somehow to display score, if my score is 2679 the ...
0
votes
1answer
102 views

Text-based hold 'em game in C using TCP

So I'm trying to create a simple text input Texas Hold 'Em game that can be played in a Terminal between multiple computer. (Disturbing lack of hold 'em games that don't require Facebook integration ...