Jump to content

DevilKrugeer

Member
  • Posts

    16
  • Joined

  • Last visited

Awards

This user doesn't have any awards

DevilKrugeer's Achievements

  1. this is awkward i have placed the example that i had, instead of assignment i need it help with it.
  2. the Imagine is suppose to change, when I click it, nothing happens. So I'm not 100% sure of what could be. It does work when i have something to print out into the console.
  3. Hey Everyone, As the title says, I need some help with the code for my java class. I have to add a mouse click function that will change the image that is moving around the application. I have placed the function, but its not working. I'm not sure what to do, I tried following examples from class, but still doesn't work. Any help is appreciated. for some reason im unable to upload the images to the forum, i believe it's because of the format .gif. thank you. import javafx.application.Application; import javafx.stage.Stage; import java.awt.event.MouseListener; import javafx.animation.AnimationTimer; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Rectangle2D; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.effect.Lighting; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Rectangle; import javafx.scene.text.Text; import javafx.util.Duration; public class ReboundImageOriginal extends Application { //main timeline private AnimationTimer timer; private ImageView image; private ImageView image2; private ImageView imageTemp; private int x,y,moveX,moveY; final int HEIGHT = 300; final int WIDTH = 500; final int IMAGE_SIZE = 35; //variable for storing actual frame private Integer i=0; @Override public void start(Stage stage) { Group p = new Group(); Scene scene = new Scene(p); stage.setScene(scene); stage.setWidth(550); stage.setHeight(400); p.setTranslateX(0); p.setTranslateY(20); x = 0; y = 0; moveX=moveY=3; //create an ImageView object Rectangle rectangle = new Rectangle(0,0,550,350); image = new ImageView(new Image("happyFace.gif")); image2 = new ImageView (new Image("redSmiley.gif")); imageTemp = new ImageView(); //Imagine Change rectangle.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { System.out.println("shit works"); imageTemp = image; image = image2; image2 = imageTemp; } }); //create a layout for the image final StackPane stack = new StackPane(); stack.getChildren().addAll(image); stack.setLayoutX(30); stack.setLayoutY(30); p.getChildren().addAll(rectangle); p.getChildren().add(stack); stage.show(); //You can add a specific action when each frame is started. timer = new AnimationTimer() { @Override public void handle(long l) { x += moveX; y += moveY; if (x <= 0 || x >= WIDTH) moveX = moveX * -1; if (y <= 0 || y >= HEIGHT) moveY = moveY * -1; stack.setLayoutX(x); stack.setLayoutY(y); } }; timer.start(); } public static void main(String[] args) { Application.launch(args); } }
  4. Yeah, I will try to do that whenever I have some extra time, right now I'm close to final exams, need to keep up with grades, so they don't go down hill. Although its almost time to change gpu, need to get a new gen one whenever they come out.
  5. Yeah, I dont have all the away up to 100%. It was my fault for not doing that, I just dont like the fan going crazy loud, especially since its the blower version of the card. They never got that hot until Division came out.
  6. My friend replaced the thermal paste about a year ago for me, I wasn't confident enough on doing it at the time. On Idle stays around 30C - 35C, Playing The division, everything medium at 1080p at 50FPS it would go up to 80C and sit there while I play the game, fans would go up to 60% - 65%. Maybe its time to change the thermal paste again, and do a deep clean.
  7. Hello Everyone, I'm having some problems with my GPU lately. Since I got The Division and played non-stop, I went back to CSGO, before i would have around 200-250 fps, now I'm having around 150 with consistent drops to 40 and can stay at 40 for half the competitive game. I'm not sure what it could be, I upgraded all the drives, and nothing has changed. Is this a possible warning that its time to replace it? I'm not sure what I can do to find out if its time. Thank you.
  8. Thaaaaannnnnkkk yooooou!!!!!!! Now its working =DDDDD Really appreciate the help =D Also want to thank everyone that help it. @madkinght3
  9. I fixed the random which is great, but I need to get the selection sort showing from the array without the garbage number. I try the program with showing the numbers in order, and it work it. but unfortunately i need to show in order =/.
  10. if that works, which I hope it does. I need to place a cout for that array, to show me the numbers that are on the array. also what should I do to initialize the value on the second part.
  11. the program needs to have a set of random numbers from 1 to 200(they can repeat), so after the list shows, you enter a number that you think that may be on the list. The search will start after you enter the number, it will do a linear search and a binary search, giving the position its located on that list for each search. I get the negative numbers also, I want to remove them. I cant find the solution for that ://
  12. I actually have that, but for some reason still showing negative numbers. my problem mainly is when I sort it out. If i remove the part to sort everything work, but my search for binary doesnt. My guess is that something on the sorting section I have the problem. I cant solve, and my teacher has no clue what to do.
  13. Hi everyone, I have a code that its working fine, but its giving me negative numbers on my array. on this array I should not have anything thats less than 0. I don't really know what to do right now. thank you for any help. here is the code. #include <iostream>#include <cmath>#include <fstream>#include <string>#include <cstdlib>#include <ctime> using namespace std;int value;int positionLinear;int positionBinary;char answer; //Constant Numbersconst int SIZE = 200; //Fuction Prototypesint linearSearch(const int[], int, int);int binarySearch(const int[], int, int);void selectionSort(int [], int);void checkAnswer();void createRandomNumbers(int [], int); // Main Fuctionint main(){const int min_Rvalue = 0;const int max_Rvalue = 200;int list[200];createRandomNumbers(list, SIZE);cout << "Please enter a random key from keyboard in between 1 and 200 " << endl;cin >> value;int linearSearch(const int list[] , int SIZE, int value);// (random Array, SIZE, value)positionLinear = linearSearch(list, SIZE, value); // Result Transfer from Linear Search int binarySearch(const int list[], int SIZE, int value ); // (random Array, SIZE, value)positionBinary = binarySearch(list, SIZE, value); // Result Transfer from Binary Search // Binary Searchif (positionBinary == -1){cout << "The number couldnt be found on the Binary Search" << endl;}else{cout << "On the Binary Search the number is found at position " << positionBinary << endl;} // Linear Searchif (positionLinear == -1)cout << "Could find the number on the Linear Search" << endl;else{// Position has been found on the Linear Search.cout << "On the Linear Search the number is found at position " << positionLinear << endl;} checkAnswer(); system("pause"); return 0;} int linearSearch(const int list[], int numElems, int value){ int index = 0;int positionLinear = -1;bool found = false; while (index < numElems && !found){ if (list[index] == value){found = true;positionLinear = index;}index++;}return positionLinear;} int binarySearch(const int list[], int numElems, int value){int first = 0,last = numElems - 1,middle,positionBinary = -1;bool found = false; while (!found && first <= last){middle = (first + last) / 2;if (list[middle] == value){found = true;positionBinary = middle;}else if (list[middle] > value){last = middle - 1;}elsefirst = middle + 1; }return positionBinary;} void checkAnswer(){cout << "Would you like to try a new set of numbers? (Y/N)";cin >> answer; if (answer == 'Y' || answer == 'y'){int main();}else if (answer == 'N' || answer == 'n'){exit(0);}elsecout << "You have entered a invalid choice." << endl;cout << "Please answer with a Y or N" << endl;checkAnswer(); } void createRandomNumbers(int list[], int SIZE){unsigned seed;seed = time(0);srand(seed); for (int r = 0; r < SIZE ; r++){list[r] = (rand() % 200) + 1; selectionSort(list, SIZE);cout << list[r] << endl;} } void selectionSort(int list[], int SIZE){ bool swap;int temp; do{swap = false;for (int count = 0; count < (SIZE - 1); count++){if (list[count] > list[count + 1]){temp = list[count];list[count] = list[count + 1];list[count + 1] = temp;swap = true;}}} while (swap);}
  14. Just post it. I should have done both, just to be save next time.
×