[QUOTE=Richy19;42668718]Whats the best way to determine if a pixel is blue and not just gray(or any other combination of rgb)?
At the moment im just doing:
[code]
long bluePixels = 0;
for(int y = 0; y < image.rows; y++)
{
for(int x = 0; x < image.cols; x++)
{
cv::Vec3b pixel = image.at<cv::Vec3b>(y,x);
int b = pixel[0], g = pixel[1], r = pixel[2];
if(b * 0.8 > r && b * 0.8 > g )
bluePixel++;
}
}
[/code]
so if 80% of the value of blue in a pixel is heigher than the amount of green and red, I determine its blue[/QUOTE]
You could convert the color to HSV and check the hue.
Would you guys have any article suggestions for rogue-like.. like dungeon generation?
[QUOTE=reevezy67;42669914]Would you guys have any article suggestions for rogue-like.. like dungeon generation?[/QUOTE]
Like this? [url]http://roguebasin.roguelikedevelopment.org/index.php?title=Basic_BSP_Dungeon_generation[/url]
[QUOTE=Richy19;42668718]Whats the best way to determine if a pixel is blue and not just gray(or any other combination of rgb)?
At the moment im just doing:
[code]
long bluePixels = 0;
for(int y = 0; y < image.rows; y++)
{
for(int x = 0; x < image.cols; x++)
{
cv::Vec3b pixel = image.at<cv::Vec3b>(y,x);
int b = pixel[0], g = pixel[1], r = pixel[2];
if(b * 0.8 > r && b * 0.8 > g )
bluePixel++;
}
}
[/code]
so if 80% of the value of blue in a pixel is heigher than the amount of green and red, I determine its blue[/QUOTE]
[url=http://blog.xkcd.com/2010/05/03/color-survey-results/]It's complicated:[/url]
[thumb]http://imgs.xkcd.com/blag/satfaces_map_1024.png[/thumb]
There's a full mapping in the blog post :v:
Otherwise, what Foxtrot200 wrote should work about as well.
[QUOTE=Foxtrot200;42669858]You could convert the color to HSV and check the hue.[/QUOTE]
But then wouldnt I have the same problem in that it could have correct Hue value but a high saturation meaning its white?
I gues I could do something like:
[code]
BGR -> HSV
if( 150 < H < 250 )
{
if( S > 0.25 )
{
if( V > 0.25 )
{
//its blue?
}
}
}
[/code]
Two questions, both are probably pretty easy to answer.
I'm looking to get into game development, I know Lua and C++ (I prefer C++, but I know more Lua) - I've been thinking about creating some kind of Legend of Zelda (NES)/Animal Crossing type game, but as some kind of Fantasy RPG. What would be the best library for me to use (I would prefer one which isn't that complicated)?
Second question: For a configuration file, is it best practice to use a PHP Array in a file, or a JSON file that gets decoded into a variable?
What's the best and easiest way of getting into games development with C# nowadays? I hear the XNA game studio has been discontinued so I'm wondering where I would start. I'm looking to make some basic 2D games.
[QUOTE=benbb;42675496]What's the best and easiest way of getting into games development with C# nowadays? I hear the XNA game studio has been discontinued so I'm wondering where I would start. I'm looking to make some basic 2D games.[/QUOTE]
Monogame should serve you fine.
[editline]28th October 2013[/editline]
I've got a problem with SDL2. Currently I'm trying to follow the Open.GL instructions for context creation, and I am currently sat with the problem of undefined references.
the code:
[code]
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
int main( int argc, char *argv[] ) {
SDL_Init( SDL_INIT_VIDEO );
SDL_Delay( 1000 );
SDL_Quit();
return 0;
}
[/code]
compiled with:
[code]
cc -Wall -std=c99 -I/home/necrophcodr/work/Prototypes/Dexterity/deps/SDL2/build/include -c -o dexterity.o dexterity.c
cc -L/home/necrophcodr/work/Prototypes/Dexterity/deps/SDL2/build -lm -ldl -pthread -lGL -lSDL2 -lSDL2main -o dexterity dexterity.o
[/code]
It is worth mentioning that after building SDL2, I copied all the headers from SDL2/include into build/include/SDL2
The following error is produced:
[code]
dexterity.o: In function `main':
dexterity.c:(.text+0x15): undefined reference to `SDL_Init'
dexterity.c:(.text+0x24): undefined reference to `SDL_Quit'
collect2: error: ld returned 1 exit status
[/code]
Installed. Doesn't show up in VS2013 and Google doesn't yield any useful results.
[QUOTE=mastersrp;42675576]Monogame should serve you fine.
[editline]28th October 2013[/editline]
I've got a problem with SDL2. Currently I'm trying to follow the Open.GL instructions for context creation, and I am currently sat with the problem of undefined references.
the code:
[code]
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
int main( int argc, char *argv[] ) {
SDL_Init( SDL_INIT_VIDEO );
SDL_Delay( 1000 );
SDL_Quit();
return 0;
}
[/code]
compiled with:
[code]
cc -Wall -std=c99 -I/home/necrophcodr/work/Prototypes/Dexterity/deps/SDL2/build/include -c -o dexterity.o dexterity.c
cc -L/home/necrophcodr/work/Prototypes/Dexterity/deps/SDL2/build -lm -ldl -pthread -lGL -lSDL2 -lSDL2main -o dexterity dexterity.o
[/code]
It is worth mentioning that after building SDL2, I copied all the headers from SDL2/include into build/include/SDL2
The following error is produced:
[code]
dexterity.o: In function `main':
dexterity.c:(.text+0x15): undefined reference to `SDL_Init'
dexterity.c:(.text+0x24): undefined reference to `SDL_Quit'
collect2: error: ld returned 1 exit status
[/code][/QUOTE]
Do you have the libSDL2.so in the default linker pathsor blah/SDL2/build?
Also, you can use pkg-config (or sdl2-config, I don't really know why it exists, perhaps for portability reasons) to get the flags you need. My SDL2 for example also passes -D_REENTRANT to the compiler and has no libSDL2main.so.
[editline]28th October 2013[/editline]
Tried the same source with my system-wide installed SDL2, took out the -I..., -L... and -lSDL2main and it works here.
SDL2 2.0.1
I downloaded sfml.net for x86 processors, which I have. Visual studio throws an error at me that says this:
[IMG]http://i.imgur.com/khQq3Ow.png[/IMG]
When I try to compile it says I am trying to load the program with an incorrect format.
Any ideas how to fix this?
Try [url=http://stackoverflow.com/questions/3244464/how-to-solve-warning-referenced-assembly-targets-a-different-processor-than-the/8470087#8470087]selecting a target processor in the project properties[/url].
Just moved from console applications and started working with UI (CLR project) in visual studio 2012. And I was wondering, where do I put my main() code? Does it go into MyForm.h or MyForm.cpp?
I tried to open the project properties but it just shows a really simplified version with no compile tab. Is there a way to get to another property menu?
[QUOTE=ZeekyHBomb;42676645]Do you have the libSDL2.so in the default linker pathsor blah/SDL2/build?
Also, you can use pkg-config (or sdl2-config, I don't really know why it exists, perhaps for portability reasons) to get the flags you need. My SDL2 for example also passes -D_REENTRANT to the compiler and has no libSDL2main.so.
[editline]28th October 2013[/editline]
Tried the same source with my system-wide installed SDL2, took out the -I..., -L... and -lSDL2main and it works here.
SDL2 2.0.1[/QUOTE]
It get's even more strange from here my man. I've got SDL2 installed on my Arch setup, so it should at least pick up the system wide install, right? Doesn't seem to be the case. As you can see on the linker part I've added both -lSDL2 and -lSDL2main, and both are in linker path. I don't know what -D_REENTRANT is about, but I'll try passing that in a second.
[editline]28th October 2013[/editline]
Removed SDL2main and added -D_REENTRANT changed nothing it seems, still comes up with undefined references.
running sdl2-config --libs --cflags yields the following:
[code]
-L/usr/lib -lSDL2 -lpthread
-I/usr/include/SDL2 -D_REENTRANT
[/code]
Both paths are system included paths, and there are no errors about libSDL2.{so,a} not being found, so it does find and link with them, however it does not find the symbols it requires. It could be that SDL2 was built incorrectly though, so I'll try to use only the system wide installation.
[editline]28th October 2013[/editline]
It seems the system wide installation works perfectly fine, so I must be building SDL2 incorrectly somehow. Huh.
What's a good way to structure the base loop for a game engine? Currently I am just doing this:
[CODE]
public class Game {
private boolean running;
public Game(){
start();
while(running){
update();
render();
}
}
public void start() {
running = true;
}
public void stop() {
running = false;
}
public void update() {
}
public void render() {
}
public static void main(String[] args) {
new Game();
}
}
[/CODE]
But I would like to manage the loop in an entirely different class than Game just for cleanliness? Is this a good idea and how would I call update() and render() in the game class from a separate loop class?
So I need to make a Windows 8 app for a surface tablet.
It has to get information from a website, and display it on the device, and use some sort of buffered scrolling to display information.
How do I go about getting information from the website? As far as I know you just query the website and it will give me the information? But I have no idea how to and finding out information about windows 8 app development on tablets is quite hard. I don't really know what to search for.
It's in C# but I think its a specialized version of it as some things you cannot do, so do I always have to search "Windows 8 development blah blah blah".
Would appreciate any help with this shit. Thanks
[QUOTE=buster925;42678401]I tried to open the project properties but it just shows a really simplified version with no compile tab. Is there a way to get to another property menu?[/QUOTE]
Never mind I fixed it by downloading visual studio 2013 for desktop. But thanks ZeekyHBomb because it solved the problem in visual studio 2013.
So, surprise, i need more assistance.
I don't know that I'm thinking of this right.
We're supposed to make a program that takes the name of a month, and prints out what the number of said month would be.
I'm thinking i can do some "If/Else" statements that say "if(month == April) cout << "April is 04. " <<endl;
Does that seem like a valid way to do this? Or is my head completely buried in my ass?
[QUOTE=JohnStamosFan;42680991]So, surprise, i need more assistance.
I don't know that I'm thinking of this right.
We're supposed to make a program that takes the name of a month, and prints out what the number of said month would be.
I'm thinking i can do some "If/Else" statements that say "if(month == April) cout << "April is 04. " <<endl;
Does that seem like a valid way to do this? Or is my head completely buried in my ass?[/QUOTE]
Use a switch statement if that's available. April in the condition should be the string literal instead.
Normalizing capitalization to allow all of "april", "April", "ApRiL"... is also a good idea, but I have no idea how to do that in C++. (There should be a function somewhere.)
[editline]29th October 2013[/editline]
[QUOTE=Duskling;42679776]What's a good way to structure the base loop for a game engine? Currently I am just doing this:
[CODE]
public class Game {
private boolean running;
public Game(){
start();
while(running){
update();
render();
}
}
public void start() {
running = true;
}
public void stop() {
running = false;
}
public void update() {
}
public void render() {
}
public static void main(String[] args) {
new Game();
}
}
[/CODE]
But I would like to manage the loop in an entirely different class than Game just for cleanliness? Is this a good idea and how would I call update() and render() in the game class from a separate loop class?[/QUOTE]
Is that Java? In that case you'd either have to derive your game from the loop class or fake events with anonymous classes.
[QUOTE=Tamschi;42681361]Use a switch statement if that's available. April in the condition should be the string literal instead.
Normalizing capitalization to allow all of "april", "April", "ApRiL"... is also a good idea, but I have no idea how to do that in C++. (There should be a function somewhere.)
[editline]29th October 2013[/editline]
Is that Java? In that case you'd either have to derive your game from the loop class or fake events with anonymous classes.[/QUOTE]
Thanks!
Searching around, i've found this:
[code]
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
using namespace std;
string Months[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
int main(void)
{
int m;
cout << "What month were you born? (1-12)";
cin >> m;
cout << "So, you were born in the month of " << Months[m-1]<< "\n\n"; // subtract 1 from input, since arrays start at 0
return 0;
}
[/code]
I'm trying to it as a nice starting point, only downside is it's the opposite of what i need. It's changing the Month name to the number.
I'm going to see if i can figure out how to swap the two and hopefully not completely dick-up this code and get myself even more lost.
Thanks again!
:edit:
I'm an idiot. The thing i found is actually exactly what i need.
Now i'm just going to go through and make sure it throws an error up if you put anything above 12. I think i can use an if/else and have the if be month > 12 gives a cout of "please enter 1-12" or something.
Stackoverflow is not responding, so this is your chance Facepoonch;
The problem I'm having is when attempting to render on the unscaledBuffer FBO, instead of filling the expected area, it fill the whole screen when rendered
[IMG]http://i.imgur.com/tLKgRDK.png[/IMG]
I'm fairly confused about this as you can see in the default FBO the red square is rendered as intended! Can anyone help me figure out why this issue might be occuring instead of working as expected?
[url]http://pastebin.com/CjWyh7Fk[/url]
Uh, I just installed Linux and started using Code Blocks and SFML, but after messing with it a bit, I suddenly got this weird error:
[code]||warning: libGLEW.so.1.7, needed by /usr/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)|[/code]
I tried googling it, but I understood jack shit about how to fix it, so I hope someone here has a simple explanation to why I get it?
Did you link GLEW?
I don't think so, but I don't think I did before when it worked?
[QUOTE=Edvinas;42678272]Just moved from console applications and started working with UI (CLR project) in visual studio 2012. And I was wondering, where do I put my main() code? Does it go into MyForm.h or MyForm.cpp?[/QUOTE]
.cpp and CLR? C++/CLI? You sure you want this?
You [i]can[/i] put it in MyForm.cpp, but you should probably just create a new .cpp file for it.
Visual Studio might have already auto-created it somewhere though. If it did, you'll get multiple definition-errors when building.
[QUOTE=Over-Run;42680861]So I need to make a Windows 8 app for a surface tablet.
It has to get information from a website, and display it on the device, and use some sort of buffered scrolling to display information.
How do I go about getting information from the website? As far as I know you just query the website and it will give me the information? But I have no idea how to and finding out information about windows 8 app development on tablets is quite hard. I don't really know what to search for.
It's in C# but I think its a specialized version of it as some things you cannot do, so do I always have to search "Windows 8 development blah blah blah".
Would appreciate any help with this shit. Thanks[/QUOTE]
[url=http://msdn.microsoft.com/en-gb/library/system.net.httpwebrequest.aspx]HttpWebRequest[/url] should be a starting point.
[editline]29th October 2013[/editline]
[QUOTE=Persious;42682951]Uh, I just installed Linux and started using Code Blocks and SFML, but after messing with it a bit, I suddenly got this weird error:
[code]||warning: libGLEW.so.1.7, needed by /usr/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)|[/code]
I tried googling it, but I understood jack shit about how to fix it, so I hope someone here has a simple explanation to why I get it?[/QUOTE]
Did you install SFML using your package manager?
Yeah, I used the package manager.
[QUOTE=Persious;42686351]Yeah, I used the package manager.[/QUOTE]
If you're on a debian based system, or ubuntu based, you'll need to add "-dev" to the package name as well.
But it seems that it can't find GLEW, so try installing that.
I have tried that, still same error. I guess I'm doing something wrong :P
[QUOTE=Persious;42687013]I have tried that, still same error. I guess I'm doing something wrong :P[/QUOTE]
You may need to run ldconfig as root, but other than that it really should just work.
Sorry, you need to Log In to post a reply to this thread.