[QUOTE=ZeekyHBomb;27147565]Qt is LGPL, so unless you make changes to the Qt library you're fine with developing code using any other license.
Qt and wxWidgets both have a GL widget and for GTK+ there's GtkGLExt, so there's no need for SFML.[/QUOTE]
Ahh cool, i though for you to use Qt free your project had to be open source, id rather have SFML as it does all the image loading and that for me.
I will be making a simple tile map editor you see
Image loading is rather easy:
[url]http://www.qtforum.org/article/27362/qt-opengl-texture-display-troubles.html[/url]
[QUOTE=ZeekyHBomb;27147810]Image loading is rather easy:
[url]http://www.qtforum.org/article/27362/qt-opengl-texture-display-troubles.html[/url][/QUOTE]
Is it easy to integrate it into VS2010?
Or do i have to use their Qt creator
At least for 2005 and 2008 ([url=http://developer.qt.nokia.com/faq/answer/what_is_the_qt_visual_studio_add-in]source[/url]).
But apparently also for 2010 ([url=http://labs.qt.nokia.com/2010/05/06/qt-470-beta1/]source[/url]); note that 4.7 is gold already.
I have problems with getting a vector normal from a segment.
I have this:
[code]
U.X = x2 - x;
U.Y = y2 - y;
R.X = middle.X - x;
R.Y = middle.Y - y;
normal.X = -U.Y * (U.X * R.Y - U.Y * R.X);
normal.Y = U.X * (U.X * R.Y - U.Y * R.X);
normal = new Vector2(normal.X, normal.Y);
normal.Normalize();
[/code]
The middle is correct but the normal is wrong :/
x and y are the coordinates of the first vector
x2 and y2 of the second.
This is in C#
Can someone please tell me what is wrong with my code?
How do I make an HTTP GET request? Also is there a way to get only a selected part of the file and not all of it?
[QUOTE=TerabyteS;27153279]How do I make an HTTP GET request? Also is there a way to get only a selected part of the file and not all of it?[/QUOTE]
You could use [url=http://curl.haxx.se/libcurl/]libcurl[/url].
[QUOTE=DevBug;27153655]You could use [url=http://curl.haxx.se/libcurl/]libcurl[/url].[/QUOTE]
Is there no way of doing it manually?
Yes:
[cpp]
std::string HttpHeader::Produce() {
std::ostringstream Out;
// Write the method
if(m_Method != Response) {
switch (m_Method) {
case Get: Out << "GET"; break;
case Post: Out << "POST"; break;
case Head: Out << "HEAD"; break;
}
Out << " " << m_Uri << " ";
}
// Write the HTTP version
Out << "HTTP/" << (int)m_Version.MajorVersion << "." << (int)m_Version.MinorVersion << "\r\n";
// Write fields
for (HttpFieldTable::const_iterator iter = m_Fields.begin(); iter != m_Fields.end(); ++iter) {
Out << iter->first << ": " << iter->second << "\r\n";
}
// Body
Out << "\r\n" << m_Body;
return Out.str();
}
[/cpp]
You'll need to implement the host field, chunked transfer-encoding, persistent connections, etc.
[QUOTE=TerabyteS;27153279]How do I make an HTTP GET request? Also is there a way to get only a selected part of the file and not all of it?[/QUOTE]
HTTP is just a line-oriented protocol (line endings are CRLF) sitting on top of TCP.
And to get only a certain part of a file, you can use [url=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16]HTTP/1.1's Content-Range[/url] header
Recently ive been working on a VB project that uses AddressOf to handle multiple buttons created from an array
But everytime I test the program it complains about how I wrote the AddressOf.
Here is the Sub im having trouble with. Its called on [i]form load[/i].
[code]
Private Sub Generate_IPC_Items()
'Create all the buttons we need automaticly using arrays and loops
Dim numb, size, x, y As Integer
For numb = 0 To 24
'Create a new button/picturebox
IP_Buttons(numb) = New Button
IP_Buttons(numb).Size = New Point(size, size)
IP_Buttons(numb).Name = "IP_Button" & numb
IP_Buttons(numb).Location = New Point(x, y)
'Set the settings for the buttons
IP_Buttons(numb).Cursor = Cursors.Cross
IP_Buttons(numb).BackColor = Color.Transparent
IP_Buttons(numb).ForeColor = Color.Red
'It might still be clickable if its invisible
IP_Buttons(numb).Visible = False
IP_Buttons(numb).Enabled = False
IP_Buttons(numb).BackgroundImageLayout = ImageLayout.Stretch
'Now create the corosponding timers
IPD_Timers(numb) = New Timer
IPD_Timers(numb).Interval = 100
IPD_Timers(numb).Enabled = False
'Now set information for onscreen items
Items(numb) = New PictureBox
Items(numb).Name = "Item" & numb
Items(numb).Enabled = False
Items(numb).Visible = False
'Now set used bools
IP_Buttons_USED(numb) = False
Me.Controls.Add(IP_Buttons(numb))
Me.Controls.Add(Items(numb))
' NOTE TO SELF; DEBUG THESE!!!
[b] AddHandler IP_Buttons(numb).Click, AddressOf IP_Kill_Check(numb, Strength)
AddHandler Items(numb).Click, AddressOf Kill_IPC(numb, False) [/b]
Next
End Sub
[/code]
The subs "IP_Kill_Check" and "Kill_IPC" require an integer (dimmed as numb). IP_Kill_Check requires an integer (dimmed as Strength). Kill_IPC Requires a Bool.
What am I doing wrong?
-snip it's 7am here, wrong thread-
[QUOTE=ZeekyHBomb;27146193][cpp]boost::iostreams::filtering_streambuf<boost::iostreams::input> gzipStreamBuf(std::ostringstream(gzipString));
gzipStreamBuf.push(boost::iostreams::gzip_decompressor());
std::ostream gunzippedStream(gzipStreamBuf);[/cpp]
Summin' like that.[/QUOTE]
thanks, will try.
[editline]3rd January 2011[/editline]
[QUOTE=MakeR;27145109]efex, I like your avatar.[/QUOTE]
:smug:
[cpp]
import javax.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class menutest2 {
private static String password = "doodle";
public static void main (String[] arg) {
JFrame frame = new JFrame("Test");
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300,200);
JPanel panel = new JPanel();
frame.add(panel);
JLabel label = new JLabel("Enter password");
panel.add(label, BorderLayout.WEST);
JPasswordField pass = new JPasswordField(10);
pass.setEchoChar('*');
pass.addActionListener(new AL());
panel.add(pass, BorderLayout.WEST);
}
static class AL implements ActionListener{
public void actionperformed(ActionEvent e){
JPasswordField input = (JPasswordField) e.getSource();
char [] pass = input.getPassword();
String p = new String (pass);
if (p.equals(password)){
JOptionPane.showMessageDialog(null, "CORRECTO!");
}
else
JOptionPane.showMessageDialog(null, "Fail!");
}
}
}
[/cpp]
The ActionListener refuses to work. The code itself is correct but it doesn't accept any name for it, like "AL" in this case. Says something about abstract methods.. :confused:
[editline]3rd January 2011[/editline]
Been doing exactly as this video: [url]http://www.youtube.com/watch?v=1G8H8uAAsLo[/url]
I have an interesting one.
In my game I have day and night time
For the nighttime i just draw a black texture with about 40% alpha and it looks good
problem is how could i make him have a torch or something?
Like when he uses the flame thrower it should create light but it doesnt
[img]http://img88.imageshack.us/img88/5994/untitlebd.png[/img]
I cant change the layers of drawing stuff as the fire needs to be light but things on the next layer need to be dark
C# and XNA
So I have this adobe after effects created animation of a 2D image scrolling by in a 3D manner:
[img]http://filesmelt.com/dl/bla.gif[/img][img]http://filesmelt.com/dl/stuff6.png[/img]
My problem now is that I have to find a formula to calculate the y of a certain 2D point from a linear range.
Input: "progress" 0-1
Output: "y" 0-440
so 0 becomes 0 and 1 becomes 440, but 0.5 doesn't become 220 but 150 or something.
The thing next to the gif shows what I mean; a point would have his 0.5 "progress" not in the center of the screen but above.
Any ideas how to find a formula like that? I currently have y = ((progress+5.5)^30)/6900000000000000000000 but that's dumb and not quite correct.
Need some help inplementing SAT (Seperate axis theorem) for rotated boxes (only that) need someone who can explain / help me write some code.
giant snip
[QUOTE=Maurice;27175325]So I have this adobe after effects created animation of a 2D image scrolling by in a 3D manner:
[img_thumb]http://filesmelt.com/dl/bla.gif[/img_thumb][img_thumb]http://filesmelt.com/dl/stuff6.png[/img_thumb]
My problem now is that I have to find a formula to calculate the y of a certain 2D point from a linear range.
Input: "progress" 0-1
Output: "y" 0-440
so 0 becomes 0 and 1 becomes 440, but 0.5 doesn't become 220 but 150 or something.
The thing next to the gif shows what I mean; a point would have his 0.5 "progress" not in the center of the screen but above.
Any ideas how to find a formula like that? I currently have y = ((progress+5.5)^30)/6900000000000000000000 but that's dumb and not quite correct.[/QUOTE]
Try something like: floor(progress*0.682*height)
[editline]3rd January 2011[/editline]
Get the hypotenuse of the left side multiply it by 0.682 then by 0.5. You'll get it.
Does anyone know how to check if an sf::Image is empty in SFML?
What the fuck is wrong with page 117?
-snop-
[editline]3rd January 2011[/editline]
Check for the default ctor values, I suppose. I'm not sure whether a pristine Image is distinguishable from a carefully created one, though.
How do I pass an int value e.g int bullet = 1; into another class in Java?
Bit more of an explination.
Got 4 if statements - When one of them is chosen, it will make bullet equal either 1,2,3 or 4.
The program then changes screens and moves to another, seperate class. This class needs to use the value of bullet to determine a few simple things.
How do I get the value of bullet from one class into another ?
[QUOTE=Richy19;27174355]I have an interesting one.
In my game I have day and night time
For the nighttime i just draw a black texture with about 40% alpha and it looks good
problem is how could i make him have a torch or something?
Like when he uses the flame thrower it should create light but it doesnt[/QUOTE]
Can you change the blending mode so that it does what Photoshop would call a "multiply" rather than using an alpha channel for opacity? That way, a white pixel in the "night layer" would leave the underlying color unchanged (multiplying by 100%), a black pixel in the "night layer" would result in black onscreen (multiplying by 0%), and intermediate shades would darken the image proportionally.
If you do that, your "night layer" can change from being black with 40% alpha to just 40% gray with no need for an alpha channel. Then, each frame you can render the flame into the night layer using blurry white blobs instead of flame sprites as the particles, and you'll get an area around the flame where the ground doesn't get darkened as much, so it looks like illumination from the fire.
[QUOTE=Wyzard;27183148]Can you change the blending mode so that it does what Photoshop would call a "multiply" rather than using an alpha channel for opacity? That way, a white pixel in the "night layer" would leave the underlying color unchanged (multiplying by 100%), a black pixel in the "night layer" would result in black onscreen (multiplying by 0%), and intermediate shades would darken the image proportionally.
If you do that, your "night layer" can change from being black with 40% alpha to just 40% gray with no need for an alpha channel. Then, each frame you can render the flame into the night layer using blurry white blobs instead of flame sprites as the particles, and you'll get an area around the flame where the ground doesn't get darkened as much, so it looks like illumination from the fire.[/QUOTE]
This stuff is too advanced for my level of programming but maybe this could work too. Is it not possible to perhaps have a mask, the shape of a light "cone" or something? The cone will remove the black layer and reveal the base "daytime" so it looks brighter.
As an alternative to the multiply blending, you could also just modify the alpha channel in your current scheme. Just make it more transparent in the areas that should remain lit. (That fits your description of removing the black layer to reveal the "daytime" layer.)
You could use a soft-edged cone shape, but I think it'd look better to base it on the fire itself. From your screenshots I'm guesing your fire effect is particle-based, right? You have a bunch of little flame sprites and you animate them spraying out. Open a graphics program, draw a white circle on a black background and hit it with a heavy Gaussian blur, and save that as your "flame glow" sprite. Then draw those into the black layer's alpha channel at the same coordinates where you draw the normal flame sprites. That should produce a nice soft lighting effect around the fire.
I'm trying to pass in arguments through the command line, however I'm not sure how I can get the second argument rather than the first.
I have this (as an example):
[cpp]
#include <iostream>
int main(int argc, char *argv[])
{
using namespace std;
cout<<"argv: "<<*argv<<endl;
cout<<"argc: "<<argc<<endl;
return 0;
}
[/cpp]
Will return:
[code]
argv: test
argc: 2
[/code]
When I start the program with "test prog.asm". I want to get the "prog.asm" part, but I'm not sure how.
[QUOTE=Niteshifter;27185553]I'm trying to pass in arguments through the command line, however I'm not sure how I can get the second argument rather than the first.
I have this (as an example):
[cpp]
#include <iostream>
int main(int argc, char *argv[])
{
using namespace std;
cout<<"argv: "<<*argv<<endl;
cout<<"argc: "<<argc<<endl;
return 0;
}
[/cpp]
Will return:
[code]
argv: test
argc: 2
[/code]
When I start the program with "test prog.asm". I want to get the "prog.asm" part, but I'm not sure how.[/QUOTE]
for(int i = 0; i < argc; ++i)
printf("argv[%d] == %s", i, argv[i]);
Apply logic.
[QUOTE=DevBug;27185925]for(int i = 0; i < argc; ++i)
printf("argv[%d] == %s", i, argv[i]);
Apply logic.[/QUOTE]
Ok, I see. I thought the array was something else. Thanks.
[QUOTE=Niteshifter;27185553]I'm trying to pass in arguments through the command line, however I'm not sure how I can get the second argument rather than the first.
I have this (as an example):
[cpp]
#include <iostream>
int main(int argc, char *argv[])
{
using namespace std;
cout<<"argv: "<<*argv<<endl;
cout<<"argc: "<<argc<<endl;
return 0;
}
[/cpp]
Will return:
[code]
argv: test
argc: 2
[/code]
When I start the program with "test prog.asm". I want to get the "prog.asm" part, but I'm not sure how.[/QUOTE]
A better solution, if you'd prefer to use a C++ STL type.
[cpp]
#include <vector>
#include <string>
int main(int argc, char* argv[])
{
std::vector<std::string> parameters(argv, argv + argc);
}
[/cpp]
Go hog wild! :v:
[QUOTE=Wig Wam;27178199]How do I pass an int value e.g int bullet = 1; into another class in Java?
Bit more of an explination.
Got 4 if statements - When one of them is chosen, it will make bullet equal either 1,2,3 or 4.
The program then changes screens and moves to another, seperate class. This class needs to use the value of bullet to determine a few simple things.
How do I get the value of bullet from one class into another ?[/QUOTE]
Pass the value to whatever method you're calling in the other class where it's needed?
I'm working on an OpenGL 3.x application in Windows 7. In the control scenario, it runs at about 3 frames per second, almost as if it has background priority. Then, if I alt+tab out and back in (change active window), it runs smoothly. However, the only messages I run stuff on relating to window (de)activation is related to mouse input.
I timed my DrawText function. An average call during the control scenario takes 25 milliseconds. If I alt+tab out and back in, the call averages at 1 millisecond. What am I doing wrong? Do OpenGL Windows applications need to make a "focus" call or acquire graphics card priority or something?
[editline]3rd January 2011[/editline]
Also, the application runs in windowed mode.
[editline]3rd January 2011[/editline]
I disabled process priority boost ( SetProcessPriorityBoost(GetCurrentProcess(), true); ) and the situation stays the same. I tried both disabling process priority boost and lowering the process priority ( SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); ) and the refocus scenario only slowed by about 3-5 ms more (still smooth).
Sorry, you need to Log In to post a reply to this thread.