Started working on a recipe card object

This commit is contained in:
josua 2020-07-29 11:18:53 +10:00
parent d88b0946b5
commit 261ba8c69b
7 changed files with 310 additions and 225 deletions

View File

@ -101,7 +101,8 @@ public class Models
public static final ModelGui UI_BUTTON_DELETE_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_delete_hover.png"), new Vec2d(1.875, 1.875));
public static final ModelGui UI_BUTTON_PLAY = new ModelGui(Resources.ATLAS.get("/gui/button_play.png"), new Vec2d(1.875, 1.875));
public static final ModelGui UI_BUTTON_PLAY_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_play_hover.png"), new Vec2d(1.875, 1.875));
public static final ModelGui UI_LABEL = new ModelGui(Resources.ATLAS.get("/gui/label.png"), new Vec2d(24, 3));
public static final ModelGui UI_LABEL_BOX_BIG = new ModelGui(Resources.ATLAS.get("/gui/label_box_big.png"), new Vec2d(12, 1.5));
public static final ModelGui UI_LABEL_BOX_WIDE = new ModelGui(Resources.ATLAS.get("/gui/label_box_wide.png"), new Vec2d(24, 3));
public static final ModelGui UI_SELECTION_BOX_WIDE = new ModelGui(Resources.ATLAS.get("/gui/selection_box_wide.png"), new Vec2d(24, 12));
public static final ModelGui UI_SELECTION_BOX_BIG = new ModelGui(Resources.ATLAS.get("/gui/selection_box_big.png"), new Vec2d(12, 12));
public static final ModelGui UI_TEXT_BOX = new ModelGui(Resources.ATLAS.get("/gui/text_box.png"), new Vec2d(12, 1.5));

View File

@ -141,7 +141,7 @@ public class MenuSaves extends Menu
private void generateSaveCards()
{
double slider_length = Models.UI_LABEL.getHeight() * 18.0 * saves.size() / 16.0;
double slider_length = Models.UI_LABEL_BOX_WIDE.getHeight() * 18.0 * saves.size() / 16.0;
double selection_length = Models.UI_SELECTION_BOX_WIDE.getHeight() * 248 / 256.0;
slider.clear();
@ -153,10 +153,10 @@ public class MenuSaves extends Menu
SaveCard save = saves.get(index[0]);
GUISavesCard savesCard = new GUISavesCard(save.text, new Vec2d(
-Models.UI_LABEL.getWidth() / 2.0,
-Models.UI_LABEL.getHeight() +
-Models.UI_LABEL_BOX_WIDE.getWidth() / 2.0,
-Models.UI_LABEL_BOX_WIDE.getHeight() +
Models.UI_SELECTION_BOX_WIDE.getHeight() * 60.0 / 128.0 -
Models.UI_LABEL.getHeight() * 18.0 * i / 16.0))
Models.UI_LABEL_BOX_WIDE.getHeight() * 18.0 * i / 16.0))
{
@Override
public void onDeletePressed() {

View File

@ -1,6 +1,89 @@
package projectzombie.menu.gui;
import gl_engine.matrix.Matrix4;
import gl_engine.vec.Vec2d;
import projectzombie.init.Models;
import projectzombie.inventory.recipe.Recipe;
import projectzombie.model.ModelGui;
public class GUIRecipeCard implements GUIContainer
{
private static final ModelGui LABEL = Models.UI_LABEL_BOX_BIG;
private Vec2d pos;
private Recipe recipe;
private GUIContainer gui;
public GUIRecipeCard(GUIContainer gui, Recipe recipe, Vec2d pos) {
this.gui = gui;
this.recipe = recipe;
this.pos = pos;
}
@Override
public void render(Matrix4 matrix, Vec2d mousePos, boolean canHover)
{
LABEL.setModel(Matrix4.multiply(matrix, Matrix4.translate(pos.x, pos.y, 0)));
LABEL.render();
}
@Override
public void update(Vec2d mousePos) {
}
@Override
public boolean checkMouseHover(Vec2d mousePos) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onScroll(Vec2d mousePos, double amount) {
// TODO Auto-generated method stub
}
@Override
public void onRightClick(Vec2d mousePos) {
// TODO Auto-generated method stub
}
@Override
public void onMouseClick(Vec2d mousePos) {
// TODO Auto-generated method stub
}
@Override
public void onActivate() {
// TODO Auto-generated method stub
}
@Override
public void onBack() {
// TODO Auto-generated method stub
}
@Override
public GUIItemSlot getHoveringItemSlot(Vec2d mousePos) {
// TODO Auto-generated method stub
return null;
}
@Override
public void add(GUIComponent c) {
// TODO Auto-generated method stub
}
@Override
public void clear() {
// TODO Auto-generated method stub
}
}

View File

@ -9,7 +9,7 @@ import projectzombie.text.Text;
public class GUISavesCard implements GUIComponent
{
private static final ModelGui LABEL = Models.UI_LABEL;
private static final ModelGui LABEL = Models.UI_LABEL_BOX_WIDE;
private Vec2d pos = new Vec2d(0, 0);
private GUIButtonModel buttonDelete;

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,233 +1,234 @@
./tile/hemp6.png
./tile/hemp7.png
./tile/hemp1.png
./tile/rock.png
./tile/rock_ice.png
./tile/sapling3.png
./tile/ladder.png
./tile/tree_leaves_snow.png
./tile/ice_wall.png
./tile/water.png
./tile/sandstone_wall.png
./tile/ladder_up.png
./tile/cactus4.png
./tile/tall_grass.png
./tile/cactus2.png
./tile/grass_infested.png
./tile/tree_branch_leaves.png
./tile/dirt.png
./tile/wall.png
./tile/tree_base.png
./tile/cactus1.png
./tile/sapling4.png
./tile/hemp3.png
./tile/cactus_top.png
./tile/tunnel_down.png
./tile/stone.png
./tile/snow.png
./tile/boss_portal.png
./tile/hemp4.png
./tile/sand.png
./tile/lantern.png
./tile/ice.png
./tile/sapling1.png
./tile/chest.png
./tile/hemp2.png
./tile/hemp8.png
./tile/cactus3.png
./tile/lava.png
./tile/tree_leaves.png
./tile/hemp5.png
./tile/lava_flow.png
./tile/grass.png
./tile/tree_branch.png
./tile/sandstone.png
./tile/tree_branch_leaves_snow.png
./tile/rock_sandstone.png
./tile/sapling2.png
./text/char_question.png
./text/char_l_a.png
./text/char_u_j.png
./text/char_l_u.png
./text/char_u_s.png
./text/char_l_s.png
./text/char_apostrophe.png
./text/char_plus.png
./text/char_l_e.png
./text/char_7.png
./text/char_minus.png
./text/char_u_r.png
./text/char_u_l.png
./text/char_obracket.png
./text/char_pow.png
./text/char_u_m.png
./text/char_l_t.png
./text/char_percent.png
./text/char_l_y.png
./text/char_0.png
./text/char_4.png
./text/char_l_r.png
./text/char_l_m.png
./text/char_cbracket.png
./text/char_u_g.png
./text/char_u_q.png
./text/char_u_i.png
./text/char_tilde.png
./text/char_l_w.png
./text/char_l_v.png
./text/char_fslash.png
./text/char_u_p.png
./text/char_gthan.png
./text/char_8.png
./text/char_unknown.png
./text/char_and.png
./text/char_osbracket.png
./text/char_u_n.png
./text/char_l_i.png
./text/char_u_y.png
./text/char_l_p.png
./text/char_lthan.png
./text/char_l_g.png
./text/char_bslash.png
./text/char_1.png
./text/char_u_z.png
./text/char_l_f.png
./text/char_u_w.png
./text/char_9.png
./text/char_l_x.png
./text/char_ccbracket.png
./text/char_l_o.png
./text/char_equals.png
./text/char_l_d.png
./text/char_dollar.png
./text/char_hashtag.png
./text/char_l_q.png
./text/char_u_o.png
./text/char_6.png
./text/char_u_d.png
./text/char_u_e.png
./text/char_exclamation.png
./text/char_vertical.png
./text/char_ocbracket.png
./text/char_u_k.png
./text/char_u_c.png
./text/char_l_n.png
./text/char_semicolon.png
./text/char_u_b.png
./text/char_u_f.png
./text/char_l_h.png
./text/char_l_k.png
./text/char_u_t.png
./text/char_3.png
./text/char_u_v.png
./text/char_u_h.png
./text/char_quotation.png
./text/char_u_a.png
./text/char_l_b.png
./text/char_underscore.png
./text/char_u_x.png
./text/char_comma.png
./text/char_csbracket.png
./text/char_l_l.png
./text/char_5.png
./text/char_star.png
./text/char_colon.png
./text/char_l_z.png
./text/char_space.png
./text/char_2.png
./text/char_at.png
./text/char_grave.png
./text/char_l_j.png
./text/char_fullstop.png
./text/char_l_c.png
./text/char_u_u.png
./list.txt
./item/log.png
./item/rock.png
./item/acorn.png
./item/ammo_box.png
./item/plant_fibre.png
./item/flint_hatchet.png
./item/hemp_seed.png
./item/shield_upgrade.png
./item/grappling_hook.png
./item/log_snow.png
./item/health_potion.png
./item/snow_pile.png
./item/gun_upgrade.png
./item/sandstone.png
./item/flint.png
./player/player_white_front_moving.png
./player/player_white_back_moving.png
./player/player_black_back_moving.png
./player/player_black_back_still.png
./player/player_white_back_still.png
./player/player_white_front_still.png
./player/player_black_front_moving.png
./player/player_black_front_still.png
./player/player_black_back_moving.png
./player/player_black_back_still.png
./player/player_white_back_moving.png
./player/player_white_front_moving.png
./gui/selection_box_wide.png
./gui/text_box.png
./gui/pixel_white.png
./gui/water.png
./gui/gun.png
./gui/button_delete.png
./gui/button_delete_hover.png
./particle/smoke_trail.png
./particle/water.png
./particle/smoke_0.png
./particle/smoke_1.png
./particle/blood.png
./particle/lava.png
./particle/bullet.png
./particle/smoke_2.png
./particle/snow.png
./particle/rain.png
./particle/smoke_4.png
./particle/smoke_3.png
./particle/smoke_5.png
./gui/temperature.png
./gui/label_box_big.png
./gui/label_box_wide.png
./gui/slot_armor_chest.png
./gui/pixel_black.png
./gui/slot_clothing_shirt.png
./gui/button_play.png
./gui/health_empty.png
./gui/button_hover.png
./gui/water.png
./gui/slot_armor_legs.png
./gui/selection_box_big.png
./gui/inventory.png
./gui/label.png
./gui/slot_clothing_pants.png
./gui/health_empty.png
./gui/hotbar_selected.png
./gui/health_full.png
./gui/temperature.png
./gui/button_play_hover.png
./gui/text_cursor.png
./gui/slot_armor_helmet.png
./gui/slot_clothing_boots.png
./gui/hotbar.png
./gui/button_normal.png
./gui/hotbar.png
./gui/slot_armor_helmet.png
./gui/button_delete.png
./gui/text_cursor.png
./gui/inventory.png
./gui/button_delete_hover.png
./gui/button_play_hover.png
./gui/health_full.png
./gui/hotbar_selected.png
./gui/slot_clothing_shirt.png
./gui/pixel_white.png
./gui/pixel_black.png
./gui/slot_clothing_pants.png
./gui/text_box.png
./gui/shield.png
./gui/button_hover.png
./text/char_bslash.png
./text/char_dollar.png
./text/char_l_w.png
./text/char_u_d.png
./text/char_u_t.png
./text/char_space.png
./text/char_l_x.png
./text/char_l_k.png
./text/char_6.png
./text/char_unknown.png
./text/char_comma.png
./text/char_obracket.png
./text/char_u_w.png
./text/char_7.png
./text/char_l_f.png
./text/char_vertical.png
./text/char_plus.png
./text/char_u_a.png
./text/char_star.png
./text/char_9.png
./text/char_u_k.png
./text/char_grave.png
./text/char_u_n.png
./text/char_percent.png
./text/char_u_m.png
./text/char_exclamation.png
./text/char_1.png
./text/char_l_q.png
./text/char_l_z.png
./text/char_l_h.png
./text/char_u_c.png
./text/char_l_g.png
./text/char_l_s.png
./text/char_fullstop.png
./text/char_u_j.png
./text/char_l_m.png
./text/char_l_t.png
./text/char_u_v.png
./text/char_colon.png
./text/char_l_i.png
./text/char_l_y.png
./text/char_semicolon.png
./text/char_u_l.png
./text/char_apostrophe.png
./text/char_u_e.png
./text/char_5.png
./text/char_2.png
./text/char_3.png
./text/char_l_p.png
./text/char_and.png
./text/char_fslash.png
./text/char_l_u.png
./text/char_u_f.png
./text/char_u_u.png
./text/char_at.png
./text/char_l_e.png
./text/char_l_l.png
./text/char_u_g.png
./text/char_u_q.png
./text/char_u_b.png
./text/char_l_o.png
./text/char_csbracket.png
./text/char_osbracket.png
./text/char_minus.png
./text/char_l_v.png
./text/char_lthan.png
./text/char_u_s.png
./text/char_equals.png
./text/char_8.png
./text/char_ccbracket.png
./text/char_underscore.png
./text/char_u_x.png
./text/char_0.png
./text/char_l_d.png
./text/char_l_c.png
./text/char_l_j.png
./text/char_u_z.png
./text/char_u_h.png
./text/char_pow.png
./text/char_hashtag.png
./text/char_gthan.png
./text/char_cbracket.png
./text/char_u_i.png
./text/char_question.png
./text/char_u_o.png
./text/char_u_y.png
./text/char_l_r.png
./text/char_l_b.png
./text/char_ocbracket.png
./text/char_l_a.png
./text/char_quotation.png
./text/char_l_n.png
./text/char_u_p.png
./text/char_tilde.png
./text/char_u_r.png
./text/char_4.png
./entity/armored_zombie_back_moving.png
./entity/zombie_front_still.png
./entity/tnt.png
./gui/slot_clothing_boots.png
./gui/selection_box_wide.png
./gui/gun.png
./gui/button_play.png
./tile/cactus4.png
./tile/hemp1.png
./tile/dirt.png
./tile/lantern.png
./tile/hemp8.png
./tile/wall.png
./tile/cactus_top.png
./tile/cactus2.png
./tile/rock.png
./tile/water.png
./tile/hemp4.png
./tile/stone.png
./tile/tree_leaves.png
./tile/sapling2.png
./tile/ladder_up.png
./tile/sapling3.png
./tile/lava_flow.png
./tile/ice_wall.png
./tile/grass.png
./tile/chest.png
./tile/sapling4.png
./tile/lava.png
./tile/tall_grass.png
./tile/hemp5.png
./tile/sapling1.png
./tile/snow.png
./tile/sandstone_wall.png
./tile/rock_sandstone.png
./tile/hemp6.png
./tile/cactus1.png
./tile/tree_branch_leaves.png
./tile/tunnel_down.png
./tile/tree_branch_leaves_snow.png
./tile/tree_leaves_snow.png
./tile/rock_ice.png
./tile/boss_portal.png
./tile/ladder.png
./tile/hemp7.png
./tile/grass_infested.png
./tile/tree_branch.png
./tile/sand.png
./tile/tree_base.png
./tile/cactus3.png
./tile/sandstone.png
./tile/hemp3.png
./tile/hemp2.png
./tile/ice.png
./entity/flare.png
./entity/boss1/boss_walking.png
./entity/grappling_hook.png
./entity/zombie_back_moving.png
./entity/tnt.png
./entity/armored_zombie_back_moving.png
./entity/armored_zombie_front_moving.png
./entity/player/hair_side.png
./entity/player/head_top.png
./entity/player/head_side.png
./entity/player/head_back.png
./entity/player/head_bottom.png
./entity/player/hair_front.png
./entity/player/head_front.png
./entity/player/hair_back.png
./entity/player/hair_top.png
./entity/dummy.png
./entity/armored_zombie_front_still.png
./entity/armored_zombie_back_still.png
./entity/zombie_front_moving.png
./entity/boss1/boss_walking_firing.png
./entity/boss1/boss_firing.png
./entity/boss1/boss_still.png
./entity/boss1/boss_walking_firing.png
./entity/armored_zombie_back_still.png
./entity/armored_zombie_front_moving.png
./entity/player/head_back.png
./entity/player/hair_top.png
./entity/player/head_front.png
./entity/player/head_top.png
./entity/player/hair_side.png
./entity/player/head_side.png
./entity/player/hair_back.png
./entity/player/hair_front.png
./entity/player/head_bottom.png
./entity/grappling_hook.png
./entity/boss1/boss_walking.png
./entity/zombie_back_still.png
./entity/dummy.png
./entity/zombie_back_moving.png
./entity/armored_zombie_front_still.png
./entity/zombie_front_moving.png
./particle/smoke_1.png
./particle/water.png
./particle/rain.png
./particle/blood.png
./particle/snow.png
./particle/smoke_3.png
./particle/smoke_4.png
./particle/smoke_2.png
./particle/smoke_0.png
./particle/bullet.png
./particle/lava.png
./particle/smoke_trail.png
./particle/smoke_5.png
./entity/zombie_front_still.png
./item/acorn.png
./item/grappling_hook.png
./item/gun_upgrade.png
./item/shield_upgrade.png
./item/rock.png
./item/flint_hatchet.png
./item/log.png
./item/log_snow.png
./item/hemp_seed.png
./item/ammo_box.png
./item/plant_fibre.png
./item/health_potion.png
./item/snow_pile.png
./item/flint.png
./item/sandstone.png