So i have a simple Java assignment involving 4 different packages with classes that inherit from classes in other packages.
The assignment says, "For each of the classes, you must include at least the following methods: accessors, mutators, toString() and equals() methods (notice that you are always overriding the last two methods). For all classes you are required to use either private or package access rights."
But if i'm making my accessors and mutators private/package only then that leads to a bunch of redundant code. Is there something i missed or should i just make them public?
[QUOTE=WeltEnSTurm;39507895]UTF-8 followup bytes are negative most of the time[/QUOTE]
But that's only because the bytes are signed
Raw binary data does not have a concept of "sign"
OpenGL 3+.
In a 3D world, how do you draw something on screenspace? (A HUD)
Can be per pixel size, or the -1 to 1 scale.
[QUOTE=Zyx;39509116]OpenGL 3+.
In a 3D world, how do you draw something on screenspace? (A HUD)
Can be per pixel size, or the -1 to 1 scale.[/QUOTE]
You write a shader that renders in screen space?
Instead of multiplying points with a view matrix you do either nothing for -1 to 1 or simple math for pixel coordinates.
[QUOTE=WeltEnSTurm;39509171]You write a shader that renders in screen space?
Instead of multiplying points with a view matrix you do either nothing for -1 to 1 or simple math for pixel coordinates.[/QUOTE]
Can't believe I never thought of that before.. Using multiple shaders didn't work out so well for me last time I tried though.
But thanks!
Can anyone help me with my Maya python script? It generates a set number of cuboids of random depths in a grid. My problem is that they scale from the objects center both ways, and this leaves them all appear to float. How could I scale them out from only one face so that all of the cuboids appear to be attached to a flat plane?
[IMG]http://snag.gy/AhIu4.jpg[/IMG]
Can you just move them all up by half of their width?
[QUOTE=MakeR;39509820]Can you just move them all up by half of their width?[/QUOTE]
That worked. Thank you. The first time I did it I was doing it wrong but I've just fixed it by translating relatively by 0.5 in y.
Ok, making progress, the clearing and displaying thing worked.
But now...
[media]http://www.youtube.com/watch?v=Ra2aCqX4Nuw[/media]
[cpp]void Menu::MenuItem::highlightRectOutline(sf::RenderWindow &window, const Text &text, const sf::Color &color) {
sf::RectangleShape outlineRect;
sf::Vector2f size(WINDOW_WIDTH, text.getHeight());
outlineRect.setSize(size);
outlineRect.setPosition(text.getPosition().x - text.getWidth(), text.getPosition().y);
outlineRect.setFillColor(sf::Color::Transparent);
outlineRect.setOutlineColor(color);
outlineRect.setOutlineThickness(5);
//window.clear(sf::Color(31, 32, 35));
window.draw(outlineRect);
window.display();
}
Menu::MenuResult Menu::handleButtonHover(sf::RenderWindow &window, float x, float y) {
sf::Color color(255, 122, 40);
std::list<MenuItem>::iterator it;
for(it = menuItems.begin(); it != menuItems.end(); it++)
{
sf::FloatRect menuItemRect = it->buttonrect;
if( menuItemRect.contains(x, y)) {
printf("highlighting button...\n");
it->highlightRectOutline(window, it->text, color);
}
}
return Nothing;
}
Menu::MenuResult Menu::getMenuResponse(sf::RenderWindow& window) {
sf::Event menuEvent;
while(true)
{
while(window.pollEvent(menuEvent))
{
if(menuEvent.type == sf::Event::MouseButtonPressed)
return handleClick((float)menuEvent.mouseButton.x, (float)menuEvent.mouseButton.y);
if(menuEvent.type == sf::Event::MouseMoved)
return handleButtonHover(window, (float)menuEvent.mouseMove.x, (float)menuEvent.mouseMove.y);
if(menuEvent.type == sf::Event::Closed)
return Exit;
}
}
}[/cpp]
Also, "highlighting button..." is being printed twice when I mouse over something. If the video is unclear (for some reason it's running at a good 5 fps) I can elaborate.
[editline]8th February 2013[/editline]
Why the fuck does FRAPS think it runs at 5 fps... it is responding much faster and fine for me.
Trying to do circles pixel-by-pixel in XNA, and I feel my way of achieving this is extremely inefficient. Anyone know a way to colour a pixel instead of using sprites?
[IMG]http://i.imgur.com/p69BkVR.png[/IMG]
I'm totally new to programming, but i want to work my way to being able to write software with a very present visual effect menu
What language do I start with?
I am doing some bit operations in C, how would you go about extending 1 bit to 32 bits.
Lets say I have 0x01, how would I extend that to 0xFFFFFFFF
EDIT: Solved, (!(x&1)+1)
[QUOTE=Rob Markia;39511604]Trying to do circles pixel-by-pixel in XNA, and I feel my way of achieving this is extremely inefficient. Anyone know a way to colour a pixel instead of using sprites?[/QUOTE]
This is how I used to draw circles in SDL a while back:
[cpp]
void drawCircle(SDL_Surface* surface, int x, int y, float rad, Uint32 color)
{
for (int offy = -(rad+1); offy < (rad+1); ++offy)
for (int offx = -(rad+1); offx < (rad+1); ++offx)
{
float d2 = static_cast<float>(offx*offx + offy*offy);
/*
if (d2 < ((rad+1)*(rad+1)))
{
Uint32 modCol = color;
d2 -= rad*rad;
if (d2 > 0.f)
{
Uint8 r,g,b,a;
SDL_GetRGBA(color, surface->format, &r, &g, &b, &a);
d2 = 1.f - d2;
r = static_cast<Uint8>(r*d2);
g = static_cast<Uint8>(g*d2);
b = static_cast<Uint8>(b*d2);
a = static_cast<Uint8>(a*d2);
modCol = SDL_MapRGBA(surface->format, r, g, b, a);
}
setPixel(surface, offx+x, offy+y, modCol);
}
*/
if (d2 < (rad*rad))
setPixel(surface, offx+x, offy+y, color);
}
}
[/cpp]
However, that draws filled circles. If I remember correctly, the commented out code in there is the code to draw outlines.
How does this look, is there something that I could do to remove redundant code/rewrite in a way to reduce lines?
It's a very basic calculator app in C# that saves input to a text file that can be read from later in-program.
[url]http://pastebin.ca/2311731[/url]
[QUOTE=SIRIUS;39512705]I'm totally new to programming, but i want to work my way to being able to write software with a very present visual effect menu
What language do I start with?[/QUOTE]
Sorry, changed it
What people normally use to create apps for iphone and android?
I know you can use HTML5 and JavaScript (I think), but how do I "compile" this for those devices?
Thanks in advance.
I'm using IntelliJ for Java and it debugs fine with the built in console, however, when I compile my code to a Jar file, it doesn't run. Any help?
[QUOTE=cody8295;39517388]I'm using IntelliJ for Java and it debugs fine with the built in console, however, when I compile my code to a Jar file, it doesn't run. Any help?[/QUOTE]
Make sure you're exporting as Runnable JAR. It should be should 2 spots below where you click "JAR". Here is a picture:
[IMG]http://www.ngeeks.com/wp-content/uploads/2011/08/Eclipse-Export-Java-Runnable_JAR_file-1-286x300.png[/IMG]
EDIT: Missed the IntelliJ part... no clue sorry haha
[QUOTE=Mete;39516854]What people normally use to create apps for iphone and android?
I know you can use HTML5 and JavaScript (I think), but how do I "compile" this for those devices?
Thanks in advance.[/QUOTE]
[url]http://phonegap.com/[/url]
What would be a good starting language?
[QUOTE=SIRIUS;39517911]What would be a good starting language?[/QUOTE]
It depends what you want to make.
[QUOTE=cody8295;39518331]It depends what you want to make.[/QUOTE]
[QUOTE=SIRIUS;39512705]software with a very present visual effect menu[/QUOTE]
[QUOTE=cody8295;39518331]It depends what you want to make.[/QUOTE]
To be honest my eventual project will be to make a program much like JARVIS in Iron man.
[QUOTE=SIRIUS;39512705]I'm totally new to programming, but i want to work my way to being able to write software with a very present visual effect menu
What language do I start with?[/QUOTE]
Not sure what you refer to with "very present visual effect menu".
I'm having a problem with SSL :/
Stacktrace:
[url]http://pastebin.com/raw.php?i=qTKiph5S[/url]
I'm using the DefaultHttpClient btw.
also I've tried a lot of the snippets I could find online but all of them didn't work or contained errors.
Are you sure the website has got an updated and valid SSL-certificate? Have you tried making your own TrustManager?
[QUOTE=Meatpuppet;39511059]Ok, making progress, the clearing and displaying thing worked.
But now...
Also, "highlighting button..." is being printed twice when I mouse over something. If the video is unclear (for some reason it's running at a good 5 fps) I can elaborate.
[editline]8th February 2013[/editline]
Why the fuck does FRAPS think it runs at 5 fps... it is responding much faster and fine for me.[/QUOTE]
I'm not sure what the cause of this specific bug is, but I think your program flow is fundamentally flawed. Here's the bare-bones game loop in SFML pseudocode:
[code]
while window is open
process events
update program state
clear window
draw to the window
display window
end while
[/code]
It may seem really slick to abstract that beyond recognition and try to hide the SFML stuff, but then you get bugs like yours and it's entirely unclear in what order things are happening and what exactly is being called when.
If you want to abstract things while still keeping the usual loop structure intact, here's the approach I take:
1. create an InputHandler abstract base class that you can pass sf::Events to and which all classes that need to respond to input derive from
2. Pass game state to your InputControllers by reference so that they can alter it inside their own methods
3. Create a void draw_on(sf::RenderWindow& window) const function for any (non-SFML) object that needs to be drawn to the window
Then your game loop would look something like this
[code]
while window is open
for input_handler in input_handler_array
input_handler processes events
update program state
clear window
draw menu on window
draw foo
...
display window
end while
[/code]
[QUOTE=Gulen;39521982]Are you sure the website has got an updated and valid SSL-certificate? Have you tried making your own TrustManager?[/QUOTE]
Chrome tells me that their certificate is fine.
[url]https://planning-scores.nl/serverlogout.html[/url] (the website I'm trying to do a request to)
Anybody know why this isn't working? I'm just trying to draw a rectangle D:
[IMG]http://i.imgur.com/y10hZcZ.png[/IMG]
[QUOTE=Larikang;39522204]I'm not sure what the cause of this specific bug is, but I think your program flow is fundamentally flawed. Here's the bare-bones game loop in SFML pseudocode:
[code]
while window is open
process events
update program state
clear window
draw to the window
display window
end while
[/code]
It may seem really slick to abstract that beyond recognition and try to hide the SFML stuff, but then you get bugs like yours and it's entirely unclear in what order things are happening and what exactly is being called when.
If you want to abstract things while still keeping the usual loop structure intact, here's the approach I take:
1. create an InputHandler abstract base class that you can pass sf::Events to and which all classes that need to respond to input derive from
2. Pass game state to your InputControllers by reference so that they can alter it inside their own methods
3. Create a void draw_on(sf::RenderWindow& window) const function for any (non-SFML) object that needs to be drawn to the window
Then your game loop would look something like this
[code]
while window is open
for input_handler in input_handler_array
input_handler processes events
update program state
clear window
draw menu on window
draw foo
...
display window
end while
[/code][/QUOTE]I don't see what you mean. Here's my project on git: [url]https://github.com/Tetramputechture/Yttra[/url]
[editline]9th February 2013[/editline]
What the hell? [url=http://www.sfml-dev.org/documentation/2.0/classsf_1_1RectangleShape.php]sf::RectangleShape[/url] has no function to build itself from an sf::rect?
WHY
Sorry, you need to Log In to post a reply to this thread.