game-development

how to alternate colors in a circle, so that circle looks like rotating?

回眸只為那壹抹淺笑 提交于 2021-02-11 16:39:41
问题 The expected output should be like this with the colors changing their position as well: Expected output-: the colors should change their positions in a circle so that it looks like they are moving without changing the position of circle. though my code is written in codeblocks in c/c++, i will be happy to get answers in any other programming languages. my present code #include<graphics.h> #include<stdlib.h> #include<stdio.h> #include<conio.h> #include<math.h> #include<string.h> #include

C++ SDL2: How to render rects into multiple viewports

旧城冷巷雨未停 提交于 2021-01-29 13:52:42
问题 I am new into SDL2(version 2.0.10) and I teach it from Lazy Foo tutorial. In Lesson of The ViewPort example code render me only first image in left viewport and others not. Render of rects in different viewports don't work either. What I am doing wrong when I want render rects in different viewports like this: while( !quit ){ while( SDL_PollEvent( &e ) != 0 ){ if( e.type == SDL_QUIT ){ quit = true; } } //Clear screen SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF ); SDL_RenderClear

How to create a timer/counter in C# XNA

给你一囗甜甜゛ 提交于 2021-01-29 08:11:45
问题 I'm fairly new to C# programming, and this is my first time using it in XNA. I'm trying to create a game with a friend, but we're struggling on making a basic counter/clock. What we require is a timer that starts at 1, and every 2 seconds, +1, with a maximum capacity of 50. Any help with the coding would be great! Thanks. 回答1: To create a timer in XNA you could use something like this: int counter = 1; int limit = 50; float countDuration = 2f; //every 2s. float currentTime = 0f; currentTime +

Trouble with separating axis theorem C++

人盡茶涼 提交于 2020-12-26 12:45:58
问题 I am trying to perform separating axis theorem on two triangles to test for collisions between them however it is not working. My relevant code is: glm::vec3 CalcSurfaceNormal(glm::vec3 tri1, glm::vec3 tri2, glm::vec3 tri3) { //Get surface normal of a triangle glm::vec3 u = tri2 - tri1; glm::vec3 v = tri3 - tri1; glm::vec3 nrmcross = glm::cross(u, v); nrmcross = glm::normalize(nrmcross); return nrmcross; } bool SATTriangleCheck(glm::vec3 axis, glm::vec3 tri1vert1, glm::vec3 tri1vert2, glm:

Can I program a hold point into an Xbox game that waits for a user's cloud data sync to complete?

眉间皱痕 提交于 2020-12-15 06:19:27
问题 Is it possible to program a startup hold into an Xbox game package that waits for the user's cloud saves to sync before continuing? I have an HTML5 game package for which I require save data to be loaded from Xbox Live which is then read from local storage (in JSON format) to populate the load screen at startup, and I also have to account for any error messages for which the user may have to respond. The game itself is started up once sync is done (but obviously not until after the legal