To fix the problem include the macro definition INT64_C(c) (c ## LL) and UINT64_C(c) (c ## ULL) before including the ffmgep library.
#include <iostream>
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
extern "C"{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
}
int main(int argc, char *argv[])
{
av_register_all();
return 0;
}
Friday, September 28, 2012
Sunday, September 16, 2012
Draw a circle using SDL Pixel Manipulation using C++/SDL
The function draw a circle and a second counting arrow and redraw the circle every second, the parameter time hast to initialized outside the while loop.
void putpixel(SDL_Surface* screen, int x, int y)
{
Uint32 *pixel = (Uint32*)screen->pixels;
Uint32 *p = pixel + y*screen->pitch/4 + x;
*p = SDL_MapRGB(screen->format, 0x00, 0x64,0x00);
}
void DrawCircle(SDL_Surface* screen, float time)
{
for(int i = 0; i<=360; i++)
{
putpixel(screen, (200 + (100*cos(i))), (100 + (100*sin(i))));
}
for(int j = 0; j<=100; j++)
{
putpixel(screen, (200 + (j*cos(time))), (100 + (j*sin(time))));
}
Sleep(1000);
}
void putpixel(SDL_Surface* screen, int x, int y)
{
Uint32 *pixel = (Uint32*)screen->pixels;
Uint32 *p = pixel + y*screen->pitch/4 + x;
*p = SDL_MapRGB(screen->format, 0x00, 0x64,0x00);
}
void DrawCircle(SDL_Surface* screen, float time)
{
for(int i = 0; i<=360; i++)
{
putpixel(screen, (200 + (100*cos(i))), (100 + (100*sin(i))));
}
for(int j = 0; j<=100; j++)
{
putpixel(screen, (200 + (j*cos(time))), (100 + (j*sin(time))));
}
Sleep(1000);
}
Collision Function for SDL/C++
The boolian function that detects a collision between two SDL_RECT's and returns a bool.
bool collision(SDL_Rect a, SDL_Rect b)
{
if((a.y + a.h) <= b.y)
return false;
if((a.x + a.w) <= b.x)
return false;
if(a.x >= (b.x + b.w))
return false;
if(a.y >= (b.y + b.h))
return false;
return true;
}
bool collision(SDL_Rect a, SDL_Rect b)
{
if((a.y + a.h) <= b.y)
return false;
if((a.x + a.w) <= b.x)
return false;
if(a.x >= (b.x + b.w))
return false;
if(a.y >= (b.y + b.h))
return false;
return true;
}
Creating a Progress Bar in SDL and C++
Progress Bar |
#include "sdl/sdl.h"
#include "sdl/sdl_image.h"
#include "SDL/SDL_ttf.h"
#include "sdl/sdl_mixer.h"
#include <iostream>
#include <sstream>
#include <string>
#include <sstream>
#include <windows.h>
using namespace std;
void putpixel(SDL_Surface* screen, int x, int y);
int MemFun();
void DrawBar(SDL_Surface* screen, int xpos, int xposmax, int ypos, int yposmax, int value, int width, int hieght, SDL_Rect* box, SDL_Rect* bgbox, Uint32 color);
Subscribe to:
Posts (Atom)
How to create Custom push button in QT5
To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...
-
Drawing a graph on an x, y plane... you can disregard the load image function, remember i am using the sdl_draw.h library, which is freely a...
-
Progress Bar #include "sdl/sdl.h" #include "sdl/sdl_image.h" #include "SDL/SDL_ttf.h" #include "sdl/...
-
To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...